aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-27 00:36:05 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-27 00:36:05 +0000
commit833e0d94ccb34e8ac566a574fd5a75fb967434a5 (patch)
tree52a27d6ecae0b66b7f3125460fd8d57ae689ac85 /gdb/printcmd.c
parent9a27b06e9823be3f762f9b87bd936e5e22359e9b (diff)
downloadgdb-833e0d94ccb34e8ac566a574fd5a75fb967434a5.zip
gdb-833e0d94ccb34e8ac566a574fd5a75fb967434a5.tar.gz
gdb-833e0d94ccb34e8ac566a574fd5a75fb967434a5.tar.bz2
Fix many sins which will come up in 32 bit x 64 bit GDB, and
various miscellaneous things discovered in the process: * printcmd.c, defs.h (print_address_numeric): New function. * c-valprint.c (c_val_print), ch-valprint.c (chill_val_print) breakpoint.c (describe_other_breakpoints, breakpoint_1, mention), cp-valprint.c (cplus_print_value), infcmd.c (jump_command), printcmd.c, stack.c, symfile.c, symmisc.c, valprint.c: Use it. * utils.c, defs.h (gdb_print_address): New function. * expprint (dump_expression), gdbtypes.h: Use it. * breakpoint.c (describe_other_breakpoints), symmisc.c (dump_symtab, print_symbol): Use filtered not unfiltered I/O. (remove_breakpoints): Remove BREAKPOINT_DEBUG code. Might as well just run gdb under a debugger for this (and it had problems with printing addresses, how to print b->shadow, etc.). * buildsym.c (make_blockvector), core.c (memory_error), exec.c (print_section_info), maint.c (print_section_table), mdebugread.c (parse_procedure), solib.c, source.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Add comments saying code is broken. Marked with "FIXME-32x64". * dbxread.c (process_one_symbol), partial-stab.h (default), remote-vx.c (vx_run_files_info): Don't cast int being passed to local_hex_string. * symmisc.c (print_symbol): Don't cast long being passed to %lx. * symtab.h (general_symbol_info): Add comment about SYMBOL_VALUE only being a long. * symmisc.c (print_symbol): Print "offset" in message for LOC_ARG and LOC_LOCAL. * printcmd.c (print_address): Remove #if 0 code with ADDR_BITS_REMOVE. * source.c: Include <sys/types.h> regardless of USG.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 95259fb..f6be184 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -596,6 +596,17 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
fputs_filtered (">", stream);
}
+/* Print address ADDR on STREAM. */
+void
+print_address_numeric (addr, stream)
+ CORE_ADDR addr;
+ GDB_FILE *stream;
+{
+ /* This assumes a CORE_ADDR can fit in a LONGEST. Probably a safe
+ assumption. We pass use_local but I'm not completely sure whether
+ that is correct. When (if ever) should we *not* use_local? */
+ print_longest (stream, 'x', 1, (unsigned LONGEST) addr);
+}
/* Print address ADDR symbolically on STREAM.
First print it as a number. Then perhaps print
@@ -606,14 +617,7 @@ print_address (addr, stream)
CORE_ADDR addr;
GDB_FILE *stream;
{
-#if 0 && defined (ADDR_BITS_REMOVE)
- /* This is wrong for pointer to char, in which we do want to print
- the low bits. */
- fprintf_filtered (stream, local_hex_format(),
- (unsigned long) ADDR_BITS_REMOVE(addr));
-#else
- fprintf_filtered (stream, local_hex_format(), (unsigned long) addr);
-#endif
+ print_address_numeric (addr, stream);
print_address_symbolic (addr, stream, asm_demangle, " ");
}
@@ -628,14 +632,19 @@ print_address_demangle (addr, stream, do_demangle)
GDB_FILE *stream;
int do_demangle;
{
- if (addr == 0) {
- fprintf_filtered (stream, "0");
- } else if (addressprint) {
- fprintf_filtered (stream, local_hex_format(), (unsigned long) addr);
- print_address_symbolic (addr, stream, do_demangle, " ");
- } else {
- print_address_symbolic (addr, stream, do_demangle, "");
- }
+ if (addr == 0)
+ {
+ fprintf_filtered (stream, "0");
+ }
+ else if (addressprint)
+ {
+ print_address_numeric (addr, stream);
+ print_address_symbolic (addr, stream, do_demangle, " ");
+ }
+ else
+ {
+ print_address_symbolic (addr, stream, do_demangle, "");
+ }
}
@@ -924,8 +933,9 @@ address_info (exp, from_tty)
printf_filtered ("Symbol \"");
fprintf_symbol_filtered (gdb_stdout, exp,
current_language->la_language, DMGL_ANSI);
- printf_filtered ("\" is at %s in a file compiled without debugging.\n",
- local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (msymbol)));
+ printf_filtered ("\" is at ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (msymbol), gdb_stdout);
+ printf_filtered (" in a file compiled without debugging.\n");
}
else
error ("No symbol \"%s\" in current context.", exp);
@@ -947,8 +957,8 @@ address_info (exp, from_tty)
break;
case LOC_LABEL:
- printf_filtered ("a label at address %s",
- local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
+ printf_filtered ("a label at address ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
break;
case LOC_REGISTER:
@@ -956,8 +966,8 @@ address_info (exp, from_tty)
break;
case LOC_STATIC:
- printf_filtered ("static storage at address %s",
- local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
+ printf_filtered ("static storage at address ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
break;
case LOC_REGPARM:
@@ -999,8 +1009,9 @@ address_info (exp, from_tty)
break;
case LOC_BLOCK:
- printf_filtered ("a function at address %s",
- local_hex_string((unsigned long) BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
+ printf_filtered ("a function at address ");
+ print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
+ gdb_stdout);
break;
case LOC_OPTIMIZED_OUT:
@@ -1979,8 +1990,11 @@ disassemble_command (arg, from_tty)
}
else
{
- printf_filtered ("from %s ", local_hex_string((unsigned long) low));
- printf_filtered ("to %s:\n", local_hex_string((unsigned long) high));
+ printf_filtered ("from ");
+ print_address_numeric (low, gdb_stdout);
+ printf_filtered (" to ");
+ print_address_numeric (high, gdb_stdout);
+ printf_filtered (":\n");
}
/* Dump the specified range. */