diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-05-12 04:20:06 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-05-12 04:20:06 +0000 |
commit | 14a5e76714708e70c7a7a962a60b5a2bf68602db (patch) | |
tree | 622c1188c3fb3e8ce8410c89c265b759fadac27b /gdb | |
parent | 13d0122493ff8353509896837bd61fdb571fdb09 (diff) | |
download | fsf-binutils-gdb-14a5e76714708e70c7a7a962a60b5a2bf68602db.zip fsf-binutils-gdb-14a5e76714708e70c7a7a962a60b5a2bf68602db.tar.gz fsf-binutils-gdb-14a5e76714708e70c7a7a962a60b5a2bf68602db.tar.bz2 |
* language.c (local_hex_string_custom): Simplify. Do not depend
on PRINTF_HAS_LONG_LONG or CC_HAS_LONG_LONG.
* memattr.c (mem_info_command): Replace calls to
longest_local_hex_string and longest_local_hex_string_custom.
* buildsym.c (make_blockvector): Ditto.
* solib.c (info_sharedlibrary_command): Ditto.
* tracepoint.c (tracepoints_info): Ditto.
* symtab.c (print_msymbol_info): Ditto.
* language.c (local_hex_string): Delete.
(local_hex_string_custom): Delete.
(longest_local_hex_string): Rename to local_hex_string.
(longest_local_hex_string_custom): Rename to
local_hex_string_custom.
* language.h (local_hex_string): Change parameter type to LONGEST.
(local_hex_string_custom): Ditto.
(longest_local_hex_string): Delete declaration.
(longest_local_hex_string_custom): Ditto.
* solib.c: Update copyright.
* memattr.c: Update copyright.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 25 | ||||
-rw-r--r-- | gdb/buildsym.c | 4 | ||||
-rw-r--r-- | gdb/language.c | 53 | ||||
-rw-r--r-- | gdb/language.h | 8 | ||||
-rw-r--r-- | gdb/memattr.c | 11 | ||||
-rw-r--r-- | gdb/solib.c | 10 | ||||
-rw-r--r-- | gdb/symtab.c | 10 | ||||
-rw-r--r-- | gdb/tracepoint.c | 8 |
8 files changed, 55 insertions, 74 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c6c9442..44fadb1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,30 @@ 2002-05-11 Andrew Cagney <ac131313@redhat.com> + * language.c (local_hex_string_custom): Simplify. Do not depend + on PRINTF_HAS_LONG_LONG or CC_HAS_LONG_LONG. + + * memattr.c (mem_info_command): Replace calls to + longest_local_hex_string and longest_local_hex_string_custom. + * buildsym.c (make_blockvector): Ditto. + * solib.c (info_sharedlibrary_command): Ditto. + * tracepoint.c (tracepoints_info): Ditto. + * symtab.c (print_msymbol_info): Ditto. + + * language.c (local_hex_string): Delete. + (local_hex_string_custom): Delete. + (longest_local_hex_string): Rename to local_hex_string. + (longest_local_hex_string_custom): Rename to + local_hex_string_custom. + * language.h (local_hex_string): Change parameter type to LONGEST. + (local_hex_string_custom): Ditto. + (longest_local_hex_string): Delete declaration. + (longest_local_hex_string_custom): Ditto. + + * solib.c: Update copyright. + * memattr.c: Update copyright. + +2002-05-11 Andrew Cagney <ac131313@redhat.com> + * arch-utils.h (legacy_register_to_value): Declare. (legacy_value_to_register): Declare. (legacy_convert_register_p): Declare. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 0e4f9b8..d7e99c0 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -36,7 +36,7 @@ #include "complaints.h" #include "gdb_string.h" #include "expression.h" /* For "enum exp_opcode" used by... */ -#include "language.h" /* For "longest_local_hex_string_custom" */ +#include "language.h" /* For "local_hex_string" */ #include "bcache.h" #include "filenames.h" /* For DOSish file names */ /* Ask buildsym.h to define the vars it normally declares `extern'. */ @@ -509,7 +509,7 @@ make_blockvector (struct objfile *objfile) = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)); complain (&blockvector_complaint, - longest_local_hex_string ((LONGEST) start)); + local_hex_string ((LONGEST) start)); } } } diff --git a/gdb/language.c b/gdb/language.c index 0b37a6f..1bfba98 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -595,34 +595,12 @@ local_hex_format_custom (char *pre) return form; } -/* Converts a number to hexadecimal and stores it in a static +/* Converts a LONGEST to custom hexadecimal and stores it in a static string. Returns a pointer to this string. */ char * -local_hex_string (unsigned long num) +local_hex_string (LONGEST num) { - static char res[50]; - - sprintf (res, local_hex_format (), num); - return res; -} - -/* Converts a LONGEST number to hexadecimal and stores it in a static - string. Returns a pointer to this string. */ -char * -longest_local_hex_string (LONGEST num) -{ - return longest_local_hex_string_custom (num, "l"); -} - -/* Converts a number to custom hexadecimal and stores it in a static - string. Returns a pointer to this string. */ -char * -local_hex_string_custom (unsigned long num, char *pre) -{ - static char res[50]; - - sprintf (res, local_hex_format_custom (pre), num); - return res; + return local_hex_string_custom (num, "l"); } /* Converts a LONGEST number to custom hexadecimal and stores it in a static @@ -630,12 +608,11 @@ local_hex_string_custom (unsigned long num, char *pre) should end with "l", e.g. "08l" as with calls to local_hex_string_custom */ char * -longest_local_hex_string_custom (LONGEST num, char *width) +local_hex_string_custom (LONGEST num, char *width) { #define RESULT_BUF_LEN 50 static char res2[RESULT_BUF_LEN]; char format[RESULT_BUF_LEN]; -#if !defined (PRINTF_HAS_LONG_LONG) int field_width; int num_len; int num_pad_chars; @@ -643,24 +620,7 @@ longest_local_hex_string_custom (LONGEST num, char *width) int pad_on_left; char *parse_ptr; char temp_nbr_buf[RESULT_BUF_LEN]; -#endif -#ifndef CC_HAS_LONG_LONG - /* If there is no long long, then LONGEST should be just long and we - can use local_hex_string_custom - */ - return local_hex_string_custom ((unsigned long) num, width); -#elif defined (PRINTF_HAS_LONG_LONG) - /* Just use printf. */ - strcpy (format, local_hex_format_prefix ()); /* 0x */ - strcat (format, "%"); - strcat (format, width); /* e.g. "08l" */ - strcat (format, "l"); /* need "ll" for long long */ - strcat (format, local_hex_format_specifier ()); /* "x" */ - strcat (format, local_hex_format_suffix ()); /* "" */ - sprintf (res2, format, num); - return res2; -#else /* !defined (PRINTF_HAS_LONG_LONG) */ /* Use phex_nz to print the number into a string, then build the result string from local_hex_format_prefix, padding and the hex representation as indicated by "width". */ @@ -687,7 +647,7 @@ longest_local_hex_string_custom (LONGEST num, char *width) if (strlen (local_hex_format_prefix ()) + num_len + num_pad_chars >= RESULT_BUF_LEN) /* paranoia */ internal_error (__FILE__, __LINE__, - "longest_local_hex_string_custom: insufficient space to store result"); + "local_hex_string_custom: insufficient space to store result"); strcpy (res2, local_hex_format_prefix ()); if (pad_on_left) @@ -708,9 +668,8 @@ longest_local_hex_string_custom (LONGEST num, char *width) } } return res2; -#endif -} /* longest_local_hex_string_custom */ +} /* local_hex_string_custom */ /* Returns the appropriate printf format for octal numbers. */ diff --git a/gdb/language.h b/gdb/language.h index 88375db..301fefd 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -395,13 +395,9 @@ extern char *longest_raw_hex_string (LONGEST); (language-specific) formats. Result is static and is overwritten by the next call. Takes printf options like "08l" or "l". */ -extern char *local_hex_string (unsigned long); /* language.c */ +extern char *local_hex_string (LONGEST); /* language.c */ -extern char *longest_local_hex_string (LONGEST); /* language.c */ - -extern char *local_hex_string_custom (unsigned long, char *); /* language.c */ - -extern char *longest_local_hex_string_custom (LONGEST, char *); /* language.c */ +extern char *local_hex_string_custom (LONGEST, char *); /* language.c */ /* Type predicates */ diff --git a/gdb/memattr.c b/gdb/memattr.c index 7387e8d..8c46d7e 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -1,5 +1,6 @@ /* Memory attributes support, for GDB. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -238,16 +239,16 @@ mem_info_command (char *args, int from_tty) m->number, m->enabled_p ? 'y' : 'n'); if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom ((unsigned long) m->lo, "08l"); + tmp = local_hex_string_custom ((unsigned long) m->lo, "08l"); else - tmp = longest_local_hex_string_custom ((unsigned long) m->lo, "016l"); + tmp = local_hex_string_custom ((unsigned long) m->lo, "016l"); printf_filtered ("%s ", tmp); if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom ((unsigned long) m->hi, "08l"); + tmp = local_hex_string_custom ((unsigned long) m->hi, "08l"); else - tmp = longest_local_hex_string_custom ((unsigned long) m->hi, "016l"); + tmp = local_hex_string_custom ((unsigned long) m->hi, "016l"); printf_filtered ("%s ", tmp); diff --git a/gdb/solib.c b/gdb/solib.c index 0c7eaba..d4876c1 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1,7 +1,7 @@ /* Handle shared libraries for GDB, the GNU Debugger. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -652,13 +652,13 @@ info_sharedlibrary_command (char *ignore, int from_tty) printf_unfiltered ("%-*s", addr_width, so->textsection != NULL - ? longest_local_hex_string_custom ( + ? local_hex_string_custom ( (LONGEST) so->textsection->addr, addr_fmt) : ""); printf_unfiltered ("%-*s", addr_width, so->textsection != NULL - ? longest_local_hex_string_custom ( + ? local_hex_string_custom ( (LONGEST) so->textsection->endaddr, addr_fmt) : ""); diff --git a/gdb/symtab.c b/gdb/symtab.c index 3a42867..3d687be 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2961,12 +2961,12 @@ print_msymbol_info (struct minimal_symbol *msymbol) char *tmp; if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) - & (CORE_ADDR) 0xffffffff, - "08l"); + tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) + & (CORE_ADDR) 0xffffffff, + "08l"); else - tmp = longest_local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol), - "016l"); + tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol), + "016l"); printf_filtered ("%s %s\n", tmp, SYMBOL_SOURCE_NAME (msymbol)); } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index dd5adb0..19f2906 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -502,11 +502,11 @@ tracepoints_info (char *tpnum_exp, int from_tty) char *tmp; if (TARGET_ADDR_BIT <= 32) - tmp = longest_local_hex_string_custom (t->address - & (CORE_ADDR) 0xffffffff, - "08l"); + tmp = local_hex_string_custom (t->address + & (CORE_ADDR) 0xffffffff, + "08l"); else - tmp = longest_local_hex_string_custom (t->address, "016l"); + tmp = local_hex_string_custom (t->address, "016l"); printf_filtered ("%s ", tmp); } |