aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
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')
-rw-r--r--gdb/ChangeLog34
-rw-r--r--gdb/breakpoint.c41
-rw-r--r--gdb/buildsym.c9
-rw-r--r--gdb/c-valprint.c9
-rw-r--r--gdb/ch-valprint.c10
-rw-r--r--gdb/core.c2
-rw-r--r--gdb/cp-valprint.c7
-rw-r--r--gdb/defs.h14
-rw-r--r--gdb/gdbtypes.c149
-rw-r--r--gdb/maint.c1
-rw-r--r--gdb/mdebugread.c1
-rw-r--r--gdb/partial-stab.h2
-rw-r--r--gdb/printcmd.c66
-rw-r--r--gdb/remote-vx.c4
-rw-r--r--gdb/stack.c87
-rw-r--r--gdb/symmisc.c232
-rw-r--r--gdb/valprint.c18
-rw-r--r--gdb/xcoffexec.c1
18 files changed, 433 insertions, 254 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 59a4be7..36bae52 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,37 @@
+Wed Jan 26 10:57:21 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ 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.
+
Tue Jan 25 12:58:26 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* valops.c (value_assign): Set `type' after coercing toval.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index b2b5c50..717335f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -484,10 +484,6 @@ remove_breakpoints ()
register struct breakpoint *b;
int val;
-#ifdef BREAKPOINT_DEBUG
- printf_unfiltered ("Removing breakpoints.\n");
-#endif /* BREAKPOINT_DEBUG */
-
ALL_BREAKPOINTS (b)
if (b->type != bp_watchpoint && b->inserted)
{
@@ -495,14 +491,6 @@ remove_breakpoints ()
if (val)
return val;
b->inserted = 0;
-#ifdef BREAKPOINT_DEBUG
- printf_unfiltered ("Removed breakpoint at %s",
- local_hex_string((unsigned long) b->address));
- printf_unfiltered (", shadow %s",
- local_hex_string((unsigned long) b->shadow_contents[0]));
- printf_unfiltered (", %s.\n",
- local_hex_string((unsigned long) b->shadow_contents[1]));
-#endif /* BREAKPOINT_DEBUG */
}
return 0;
@@ -1506,8 +1494,10 @@ breakpoint_1 (bnum, allflag)
printf_filtered ("\n");
if (b->frame)
- printf_filtered ("\tstop only in stack frame at %s\n",
- local_hex_string((unsigned long) b->frame));
+ {
+ printf_filtered ("\tstop only in stack frame at ");
+ print_address_numeric (b->frame, gdb_stdout);
+ printf_filtered ("\n");
if (b->cond)
{
printf_filtered ("\tstop only if ");
@@ -1586,17 +1576,20 @@ describe_other_breakpoints (pc)
others++;
if (others > 0)
{
- printf_unfiltered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
+ printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
ALL_BREAKPOINTS (b)
if (b->address == pc)
{
others--;
- printf_unfiltered ("%d%s%s ",
- b->number,
- (b->enable == disabled) ? " (disabled)" : "",
- (others > 1) ? "," : ((others == 1) ? " and" : ""));
+ printf_filtered
+ ("%d%s%s ",
+ b->number,
+ (b->enable == disabled) ? " (disabled)" : "",
+ (others > 1) ? "," : ((others == 1) ? " and" : ""));
}
- printf_unfiltered ("also set at pc %s.\n", local_hex_string((unsigned long) pc));
+ printf_filtered ("also set at pc ");
+ print_address_numeric (pc, gdb_stdout);
+ printf_filtered (".\n");
}
}
@@ -1830,8 +1823,8 @@ mention (b)
print_expression (b->exp, gdb_stdout);
break;
case bp_breakpoint:
- printf_filtered ("Breakpoint %d at %s", b->number,
- local_hex_string((unsigned long) b->address));
+ printf_filtered ("Breakpoint %d at ", b->number);
+ print_address_numeric (b->address);
if (b->source_file)
printf_filtered (": file %s, line %d.",
b->source_file, b->line_number);
@@ -2055,8 +2048,8 @@ break_command_1 (arg, tempflag, from_tty)
if (sals.nelts > 1)
{
- printf_unfiltered ("Multiple breakpoints were set.\n");
- printf_unfiltered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
+ printf_filtered ("Multiple breakpoints were set.\n");
+ printf_filtered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
}
do_cleanups (old_chain);
}
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 58eb157..0fe22d1 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -351,6 +351,15 @@ make_blockvector (objfile)
if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1))
> BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)))
{
+
+ /* FIXME-32x64: loses if CORE_ADDR doesn't fit in a
+ long. Possible solutions include a version of
+ complain which takes a callback, a
+ sprintf_address_numeric to match
+ print_address_numeric, or a way to set up a GDB_FILE
+ * which causes sprintf rather than fprintf to be
+ called. */
+
complain (&blockvector_complaint,
(unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
}
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 7225b18..bee764d 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -172,7 +172,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
if (addressprint && format != 's')
{
- fprintf_filtered (stream, "0x%lx", (unsigned long)addr);
+ print_address_numeric (addr, stream);
}
/* For a pointer to char or unsigned char, also print the string
@@ -251,9 +251,10 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
}
if (addressprint)
{
- fprintf_filtered (stream, "@0x%lx",
- extract_unsigned_integer (valaddr,
- TARGET_PTR_BIT / HOST_CHAR_BIT));
+ fprintf_filtered (stream, "@");
+ print_address_numeric
+ (extract_address (valaddr,
+ TARGET_PTR_BIT / HOST_CHAR_BIT), stream);
if (deref_ref)
fputs_filtered (": ", stream);
}
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index 5cb21d3..37ca0f4 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -158,7 +158,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
}
if (addressprint && format != 's')
{
- fprintf_filtered (stream, "H'%lx", (unsigned long) addr);
+ print_address_numeric (addr, stream);
}
/* For a pointer to char or unsigned char, also print the string
@@ -265,9 +265,11 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
case TYPE_CODE_REF:
if (addressprint)
{
- fprintf_filtered (stream, "LOC(H'%lx)",
- extract_unsigned_integer (valaddr,
- TARGET_PTR_BIT / HOST_CHAR_BIT));
+ fprintf_filtered (stream, "LOC(");
+ print_address_numeric
+ (extract_address (valaddr, TARGET_PTR_BIT / HOST_CHAR_BIT),
+ stream);
+ fprintf_filtered (stream, ")");
if (deref_ref)
fputs_filtered (": ", stream);
}
diff --git a/gdb/core.c b/gdb/core.c
index 3d399f8..134a9af 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -136,7 +136,7 @@ memory_error (status, memaddr)
int status;
CORE_ADDR memaddr;
{
-
+ /* FIXME-32x64--casting CORE_ADDR to unsigned long */
if (status == EIO)
{
/* Actually, address between memaddr and memaddr + len
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 2ff2a8c..2617d79 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -392,8 +392,11 @@ cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream);
if (err != 0)
- fprintf_filtered (stream,
- "<invalid address 0x%lx>", (unsigned long) baddr);
+ {
+ fprintf_filtered (stream, "<invalid address ");
+ print_address_numeric (baddr, stream);
+ fprintf_filtered (stream, ">");
+ }
else
cp_print_value_fields (TYPE_BASECLASS (type, i), baddr, stream, format,
recurse, pretty,
diff --git a/gdb/defs.h b/gdb/defs.h
index 15060a6..4fce2e0 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -296,6 +296,9 @@ n_spaces PARAMS ((int));
extern void
gdb_printchar PARAMS ((int, GDB_FILE *, int));
+/* Print a host address. */
+extern void gdb_print_address PARAMS ((void *, GDB_FILE *));
+
extern void
fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, enum language, int));
@@ -346,6 +349,9 @@ extern void
print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, char *));
extern void
+print_address_numeric PARAMS ((CORE_ADDR, GDB_FILE *));
+
+extern void
print_address PARAMS ((CORE_ADDR, GDB_FILE *));
/* From source.c */
@@ -596,6 +602,14 @@ parse_escape PARAMS ((char **));
extern const char * const reg_names[];
+/* Message to be printed before the error message, when an error occurs. */
+
+extern char *error_pre_print;
+
+/* Message to be printed before the warning message, when a warning occurs. */
+
+extern char *warning_pre_print;
+
extern NORETURN void /* Does not return to the caller. */
error ();
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index d1a7da9..7795c13 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1204,33 +1204,45 @@ dump_fn_fieldlists (type, spaces)
int overload_idx;
struct fn_field *f;
- printfi_filtered (spaces, "fn_fieldlists 0x%lx\n",
- (unsigned long) TYPE_FN_FIELDLISTS (type));
+ printfi_filtered (spaces, "fn_fieldlists ");
+ gdb_print_address (TYPE_FN_FIELDLISTS (type), gdb_stdout);
+ printf_filtered ("\n");
for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++)
{
f = TYPE_FN_FIELDLIST1 (type, method_idx);
- printfi_filtered (spaces + 2, "[%d] name '%s' (0x%lx) length %d\n",
+ printfi_filtered (spaces + 2, "[%d] name '%s' (",
method_idx,
- TYPE_FN_FIELDLIST_NAME (type, method_idx),
- (unsigned long) TYPE_FN_FIELDLIST_NAME (type, method_idx),
- TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
+ TYPE_FN_FIELDLIST_NAME (type, method_idx));
+ gdb_print_address (TYPE_FN_FIELDLIST_NAME (type, method_idx),
+ gdb_stdout);
+ printf_filtered (") length %d\n",
+ TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
for (overload_idx = 0;
overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx);
overload_idx++)
{
- printfi_filtered (spaces + 4, "[%d] physname '%s' (0x%lx)\n",
+ printfi_filtered (spaces + 4, "[%d] physname '%s' (",
overload_idx,
- TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
- (unsigned long) TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
- printfi_filtered (spaces + 8, "type 0x%lx\n",
- (unsigned long) TYPE_FN_FIELD_TYPE (f, overload_idx));
+ TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
+ gdb_print_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
+ printf_filtered (")\n");
+ printfi_filtered (spaces + 8, "type ");
+ gdb_print_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout);
+ printf_filtered ("\n");
+
recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx),
spaces + 8 + 2);
- printfi_filtered (spaces + 8, "args 0x%lx\n",
- (unsigned long) TYPE_FN_FIELD_ARGS (f, overload_idx));
+
+ printfi_filtered (spaces + 8, "args ");
+ gdb_print_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout);
+ printf_filtered ("\n");
+
print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces);
- printfi_filtered (spaces + 8, "fcontext 0x%lx\n",
- (unsigned long) TYPE_FN_FIELD_FCONTEXT (f, overload_idx));
+ printfi_filtered (spaces + 8, "fcontext ");
+ gdb_print_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
+ gdb_stdout);
+ printf_filtered ("\n");
+
printfi_filtered (spaces + 8, "is_const %d\n",
TYPE_FN_FIELD_CONST (f, overload_idx));
printfi_filtered (spaces + 8, "is_volatile %d\n",
@@ -1260,9 +1272,11 @@ print_cplus_stuff (type, spaces)
TYPE_NFN_FIELDS_TOTAL (type));
if (TYPE_N_BASECLASSES (type) > 0)
{
- printfi_filtered (spaces, "virtual_field_bits (%d bits at *0x%lx)",
- TYPE_N_BASECLASSES (type),
- (unsigned long) TYPE_FIELD_VIRTUAL_BITS (type));
+ printfi_filtered (spaces, "virtual_field_bits (%d bits at *",
+ TYPE_N_BASECLASSES (type));
+ gdb_print_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout);
+ printf_filtered (")");
+
print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
TYPE_N_BASECLASSES (type));
puts_filtered ("\n");
@@ -1271,18 +1285,20 @@ print_cplus_stuff (type, spaces)
{
if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
{
- printfi_filtered (spaces, "private_field_bits (%d bits at *0x%lx)",
- TYPE_NFIELDS (type),
- (unsigned long) TYPE_FIELD_PRIVATE_BITS (type));
+ printfi_filtered (spaces, "private_field_bits (%d bits at *",
+ TYPE_NFIELDS (type));
+ gdb_print_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout);
+ printf_filtered (")");
print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
TYPE_NFIELDS (type));
puts_filtered ("\n");
}
if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
{
- printfi_filtered (spaces, "protected_field_bits (%d bits at *0x%lx)",
- TYPE_NFIELDS (type),
- (unsigned long) TYPE_FIELD_PROTECTED_BITS (type));
+ printfi_filtered (spaces, "protected_field_bits (%d bits at *",
+ TYPE_NFIELDS (type));
+ gdb_print_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout);
+ printf_filtered (")");
print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
TYPE_NFIELDS (type));
puts_filtered ("\n");
@@ -1301,14 +1317,20 @@ recursive_dump_type (type, spaces)
{
int idx;
- printfi_filtered (spaces, "type node 0x%lx\n", (unsigned long)type);
- printfi_filtered (spaces, "name '%s' (0x%lx)\n",
- TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>",
- (unsigned long)TYPE_NAME (type));
+ printfi_filtered (spaces, "type node ");
+ gdb_print_address (type, gdb_stdout);
+ printf_filtered ("\n");
+ printfi_filtered (spaces, "name '%s' (",
+ TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
+ gdb_print_address (TYPE_NAME (type), gdb_stdout);
+ printf_filtered (")\n");
if (TYPE_TAG_NAME (type) != NULL)
- printfi_filtered (spaces, "tagname '%s' (0x%lx)\n",
- TYPE_TAG_NAME (type),
- (unsigned long)TYPE_TAG_NAME (type));
+ {
+ printfi_filtered (spaces, "tagname '%s' (",
+ TYPE_TAG_NAME (type));
+ gdb_print_address (TYPE_TAG_NAME (type), gdb_stdout);
+ printf_filtered (")\n");
+ }
printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
switch (TYPE_CODE (type))
{
@@ -1375,20 +1397,25 @@ recursive_dump_type (type, spaces)
}
puts_filtered ("\n");
printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
- printfi_filtered (spaces, "objfile 0x%lx\n",
- (unsigned long) TYPE_OBJFILE (type));
- printfi_filtered (spaces, "target_type 0x%lx\n",
- (unsigned long) TYPE_TARGET_TYPE (type));
+ printfi_filtered (spaces, "objfile ");
+ gdb_print_address (TYPE_OBJFILE (type), gdb_stdout);
+ printf_filtered ("\n");
+ printfi_filtered (spaces, "target_type ");
+ gdb_print_address (TYPE_TARGET_TYPE (type), gdb_stdout);
+ printf_filtered ("\n");
if (TYPE_TARGET_TYPE (type) != NULL)
{
recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2);
}
- printfi_filtered (spaces, "pointer_type 0x%lx\n",
- (unsigned long) TYPE_POINTER_TYPE (type));
- printfi_filtered (spaces, "reference_type 0x%lx\n",
- (unsigned long) TYPE_REFERENCE_TYPE (type));
- printfi_filtered (spaces, "function_type 0x%lx\n",
- (unsigned long) TYPE_FUNCTION_TYPE (type));
+ printfi_filtered (spaces, "pointer_type ");
+ gdb_print_address (TYPE_POINTER_TYPE (type), gdb_stdout);
+ printf_filtered ("\n");
+ printfi_filtered (spaces, "reference_type ");
+ gdb_print_address (TYPE_REFERENCE_TYPE (type), gdb_stdout);
+ printf_filtered ("\n");
+ printfi_filtered (spaces, "function_type ");
+ gdb_print_address (TYPE_FUNCTION_TYPE (type), gdb_stdout);
+ printf_filtered ("\n");
printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED)
{
@@ -1399,26 +1426,30 @@ recursive_dump_type (type, spaces)
puts_filtered (" TYPE_FLAG_STUB");
}
puts_filtered ("\n");
- printfi_filtered (spaces, "nfields %d 0x%lx\n", TYPE_NFIELDS (type),
- (unsigned long) TYPE_FIELDS (type));
+ printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
+ gdb_print_address (TYPE_FIELDS (type));
+ puts_filtered ("\n");
for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{
printfi_filtered (spaces + 2,
- "[%d] bitpos %d bitsize %d type 0x%lx name '%s' (0x%lx)\n",
+ "[%d] bitpos %d bitsize %d type "
idx, TYPE_FIELD_BITPOS (type, idx),
- TYPE_FIELD_BITSIZE (type, idx),
- (unsigned long) TYPE_FIELD_TYPE (type, idx),
- TYPE_FIELD_NAME (type, idx) != NULL
- ? TYPE_FIELD_NAME (type, idx)
- : "<NULL>",
- (unsigned long) TYPE_FIELD_NAME (type, idx));
+ TYPE_FIELD_BITSIZE (type, idx));
+ gdb_print_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout);
+ printf_filtered (" name '%s' (",
+ TYPE_FIELD_NAME (type, idx) != NULL
+ ? TYPE_FIELD_NAME (type, idx)
+ : "<NULL>");
+ gdb_print_address (TYPE_FIELD_NAME (type, idx));
+ printf_filtered (")\n");
if (TYPE_FIELD_TYPE (type, idx) != NULL)
{
recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
}
}
- printfi_filtered (spaces, "vptr_basetype 0x%lx\n",
- (unsigned long) TYPE_VPTR_BASETYPE (type));
+ printfi_filtered (spaces, "vptr_basetype ");
+ gdb_print_address (TYPE_VPTR_BASETYPE (type), gdb_stdout);
+ puts_filtered ("\n");
if (TYPE_VPTR_BASETYPE (type) != NULL)
{
recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2);
@@ -1428,14 +1459,16 @@ recursive_dump_type (type, spaces)
{
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
- printfi_filtered (spaces, "arg_types 0x%lx\n",
- (unsigned long) TYPE_ARG_TYPES (type));
+ printfi_filtered (spaces, "arg_types ");
+ gdb_print_address (TYPE_ARG_TYPES (type));
+ puts_filtered ("\n");
print_arg_types (TYPE_ARG_TYPES (type), spaces);
break;
case TYPE_CODE_STRUCT:
- printfi_filtered (spaces, "cplus_stuff 0x%lx\n",
- (unsigned long) TYPE_CPLUS_SPECIFIC (type));
+ printfi_filtered (spaces, "cplus_stuff ");
+ gdb_print_address (TYPE_CPLUS_SPECIFIC (type));
+ puts_filtered ("\n");
print_cplus_stuff (type, spaces);
break;
@@ -1443,8 +1476,8 @@ recursive_dump_type (type, spaces)
/* We have to pick one of the union types to be able print and test
the value. Pick cplus_struct_type, even though we know it isn't
any particular one. */
- printfi_filtered (spaces, "type_specific 0x%lx",
- (unsigned long) TYPE_CPLUS_SPECIFIC (type));
+ printfi_filtered (spaces, "type_specific ");
+ gdb_print_address (TYPE_CPLUS_SPECIFIC (type));
if (TYPE_CPLUS_SPECIFIC (type) != NULL)
{
printf_filtered (" (unknown data form)");
diff --git a/gdb/maint.c b/gdb/maint.c
index fe7fdbf5..378ac0a 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -137,6 +137,7 @@ print_section_table (abfd, asect, ignore)
flags = bfd_get_section_flags (abfd, asect);
+ /* FIXME-32x64: Need print_address_numeric with field width. */
printf_filtered (" %s",
local_hex_string_custom
((unsigned long) bfd_section_vma (abfd, asect), "08l"));
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ca6aa83..dd50a5e 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1712,6 +1712,7 @@ parse_procedure (pr, search_symtab, first_off)
if (pr->isym == -1)
{
/* Static procedure at address pr->adr. Sigh. */
+ /* FIXME-32x64. assuming pr->adr fits in long. */
complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr);
return;
}
diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h
index b5a9a01..e529cc2 100644
--- a/gdb/partial-stab.h
+++ b/gdb/partial-stab.h
@@ -668,6 +668,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* If we haven't found it yet, ignore it. It's probably some
new type we don't know about yet. */
complain (&unknown_symtype_complaint,
- local_hex_string ((unsigned long) CUR_SYMBOL_TYPE));
+ local_hex_string (CUR_SYMBOL_TYPE));
continue;
}
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. */
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index bc67664..5c1aeaa 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -566,8 +566,8 @@ static void
vx_run_files_info ()
{
printf_unfiltered ("\tRunning %s VxWorks process %s",
- vx_running? "child": "attached",
- local_hex_string((unsigned long) inferior_pid));
+ vx_running ? "child" : "attached",
+ local_hex_string (inferior_pid));
if (vx_running)
printf_unfiltered (", function `%s'", vx_running);
printf_unfiltered(".\n");
diff --git a/gdb/stack.c b/gdb/stack.c
index 747afda..4d4a004 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -286,7 +286,10 @@ print_frame_info (fi, level, source, args)
printf_filtered ("#%-2d ", level);
if (addressprint)
if (fi->pc != sal.pc || !sal.symtab)
- printf_filtered ("%s in ", local_hex_string((unsigned long) fi->pc));
+ {
+ print_address_numeric (fi->pc);
+ printf_filtered (" in ");
+ }
fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
DMGL_ANSI);
wrap_here (" ");
@@ -327,7 +330,10 @@ print_frame_info (fi, level, source, args)
if (!done)
{
if (addressprint && mid_statement)
- printf_filtered ("%s\t", local_hex_string((unsigned long) fi->pc));
+ {
+ print_address_numeric (fi->pc, gdb_stdout);
+ printf_filtered ("\t");
+ }
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
}
current_source_line = max (sal.line - lines_to_list/2, 1);
@@ -489,17 +495,22 @@ frame_info (addr_exp, from_tty)
}
calling_frame = get_prev_frame (frame);
- if (!addr_exp && selected_frame_level >= 0) {
- printf_filtered ("Stack level %d, frame at %s:\n",
- selected_frame_level,
- local_hex_string((unsigned long) FRAME_FP(frame)));
- } else {
- printf_filtered ("Stack frame at %s:\n",
- local_hex_string((unsigned long) FRAME_FP(frame)));
- }
- printf_filtered (" %s = %s",
- reg_names[PC_REGNUM],
- local_hex_string((unsigned long) fi->pc));
+ if (!addr_exp && selected_frame_level >= 0)
+ {
+ printf_filtered ("Stack level %d, frame at "
+ selected_frame_level);
+ print_address_numeric (FRAME_FP(frame), gdb_stdout);
+ printf_filtered (":\n");
+ }
+ else
+ {
+ printf_filtered ("Stack frame at ");
+ print_address_numeric (FRAME_FP(frame), gdb_stdout);
+ printf_filtered (":\n");
+ }
+ printf_filtered (" %s = ",
+ reg_names[PC_REGNUM]);
+ print_address_numeric (fi->pc, gdb_stdout);
wrap_here (" ");
if (funname)
@@ -513,8 +524,9 @@ frame_info (addr_exp, from_tty)
printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
puts_filtered ("; ");
wrap_here (" ");
- printf_filtered ("saved %s %s\n", reg_names[PC_REGNUM],
- local_hex_string((unsigned long) FRAME_SAVED_PC (frame)));
+ printf_filtered ("saved %s ", reg_names[PC_REGNUM]);
+ print_address_numeric (FRAME_SAVED_PC (frame), gdb_stdout);
+ printf_filtered ("\n");
{
int frameless = 0;
@@ -526,18 +538,22 @@ frame_info (addr_exp, from_tty)
}
if (calling_frame)
- printf_filtered (" called by frame at %s",
- local_hex_string((unsigned long) FRAME_FP (calling_frame)));
+ {
+ printf_filtered (" called by frame at ");
+ print_address_numeric (FRAME_FP (calling_frame), gdb_stdout);
+ }
if (fi->next && calling_frame)
puts_filtered (",");
wrap_here (" ");
if (fi->next)
- printf_filtered (" caller of frame at %s",
- local_hex_string ((unsigned long) fi->next->frame));
+ {
+ printf_filtered (" caller of frame at ");
+ print_address_numeric (fi->next->frame, gdb_stdout);
+ }
if (fi->next || calling_frame)
puts_filtered ("\n");
if (s)
- printf_filtered(" source language %s.\n", language_str(s->language));
+ printf_filtered (" source language %s.\n", language_str (s->language));
#ifdef PRINT_EXTRA_FRAME_INFO
PRINT_EXTRA_FRAME_INFO (fi);
@@ -550,11 +566,12 @@ frame_info (addr_exp, from_tty)
int numargs;
if (arg_list == 0)
- printf_filtered (" Arglist at unknown address.\n");
+ printf_filtered (" Arglist at unknown address.\n");
else
{
- printf_filtered (" Arglist at %s,",
- local_hex_string((unsigned long) arg_list));
+ printf_filtered (" Arglist at ");
+ print_address_numeric (arg_list, gdb_stdout);
+ printf_filtered (",");
FRAME_NUM_ARGS (numargs, fi);
if (numargs < 0)
@@ -574,18 +591,22 @@ frame_info (addr_exp, from_tty)
CORE_ADDR arg_list = FRAME_LOCALS_ADDRESS (fi);
if (arg_list == 0)
- printf_filtered (" Locals at unknown address,");
+ printf_filtered (" Locals at unknown address,");
else
- printf_filtered (" Locals at %s,",
- local_hex_string((unsigned long) arg_list));
+ {
+ printf_filtered (" Locals at ");
+ print_address_numeric (arg_list, gdb_stdout);
+ printf_filtered (",");
+ }
}
#if defined (FRAME_FIND_SAVED_REGS)
get_frame_saved_regs (fi, &fsr);
/* The sp is special; what's returned isn't the save address, but
actually the value of the previous frame's sp. */
- printf_filtered (" Previous frame's sp is %s\n",
- local_hex_string((unsigned long) fsr.regs[SP_REGNUM]));
+ printf_filtered (" Previous frame's sp is ");
+ print_address_numeric (fsr.regs[SP_REGNUM], gdb_stdout);
+ printf_filtered ("\n");
count = 0;
for (i = 0; i < NUM_REGS; i++)
if (fsr.regs[i] && i != SP_REGNUM)
@@ -595,8 +616,8 @@ frame_info (addr_exp, from_tty)
else
puts_filtered (",");
wrap_here (" ");
- printf_filtered (" %s at %s", reg_names[i],
- local_hex_string((unsigned long) fsr.regs[i]));
+ printf_filtered (" %s at ", reg_names[i]);
+ print_address_numeric (fsr.regs[i], gdb_stdout);
count++;
}
if (count)
@@ -804,8 +825,10 @@ print_block_frame_labels (b, have_default, stream)
values_printed = 1;
fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
if (addressprint)
- fprintf_filtered (stream, " %s",
- local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
+ {
+ fprintf_filtered (stream, " ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), stream);
+ }
fprintf_filtered (stream, " in file %s, line %d\n",
sal.symtab->filename, sal.line);
}
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index f81fcdc..bfc8dc5 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -47,13 +47,13 @@ FILE *std_err;
/* Prototypes for local functions */
static void
-dump_symtab PARAMS ((struct objfile *, struct symtab *, FILE *));
+dump_symtab PARAMS ((struct objfile *, struct symtab *, GDB_FILE *));
static void
-dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, FILE *));
+dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, GDB_FILE *));
static void
-dump_msymbols PARAMS ((struct objfile *, FILE *));
+dump_msymbols PARAMS ((struct objfile *, GDB_FILE *));
static void
dump_objfile PARAMS ((struct objfile *));
@@ -62,12 +62,12 @@ static int
block_depth PARAMS ((struct block *));
static void
-print_partial_symbol PARAMS ((struct partial_symbol *, int, char *, FILE *));
+print_partial_symbol PARAMS ((struct partial_symbol *, int, char *, GDB_FILE *));
struct print_symbol_args {
struct symbol *symbol;
int depth;
- FILE *outfile;
+ GDB_FILE *outfile;
};
static int print_symbol PARAMS ((char *));
@@ -159,8 +159,12 @@ dump_objfile (objfile)
struct partial_symtab *psymtab;
printf_filtered ("\nObject file %s: ", objfile -> name);
- printf_filtered ("Objfile at %x, bfd at %x, %d minsyms\n\n",
- objfile, objfile -> obfd, objfile->minimal_symbol_count);
+ printf_filtered ("Objfile at ");
+ gdb_print_address (objfile, gdb_stdout);
+ printf_filtered (", bfd at ");
+ gdb_print_address (objfile->obfd, gdb_stdout);
+ printf_filtered (", %d minsyms\n\n",
+ objfile->minimal_symbol_count);
if (objfile -> psymtabs)
{
@@ -169,7 +173,10 @@ dump_objfile (objfile)
psymtab != NULL;
psymtab = psymtab -> next)
{
- printf_filtered ("%s at %x, ", psymtab -> filename, psymtab);
+ printf_filtered ("%s at ",
+ psymtab -> filename);
+ gdb_print_address (psymtab);
+ printf_filtered (", ");
if (psymtab -> objfile != objfile)
{
printf_filtered ("NOT ON CHAIN! ");
@@ -186,7 +193,9 @@ dump_objfile (objfile)
symtab != NULL;
symtab = symtab->next)
{
- printf_filtered ("%s at %x, ", symtab -> filename, symtab);
+ printf_filtered ("%s at ", symtab -> filename);
+ gdb_print_address (symtab);
+ printf_filtered (", ");
if (symtab -> objfile != objfile)
{
printf_filtered ("NOT ON CHAIN! ");
@@ -202,7 +211,7 @@ dump_objfile (objfile)
static void
dump_msymbols (objfile, outfile)
struct objfile *objfile;
- FILE *outfile;
+ GDB_FILE *outfile;
{
struct minimal_symbol *msymbol;
int index;
@@ -247,7 +256,7 @@ dump_msymbols (objfile, outfile)
ms_type = '?';
break;
}
- fprintf_filtered (outfile, "[%2d] %c %#10x %s", index, ms_type,
+ fprintf_filtered (outfile, "[%2d] %c %#10lx %s", index, ms_type,
SYMBOL_VALUE_ADDRESS (msymbol), SYMBOL_NAME (msymbol));
if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
{
@@ -267,40 +276,50 @@ static void
dump_psymtab (objfile, psymtab, outfile)
struct objfile *objfile;
struct partial_symtab *psymtab;
- FILE *outfile;
+ GDB_FILE *outfile;
{
int i;
fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
psymtab -> filename);
- fprintf_filtered (outfile, "(object 0x%x)\n\n", psymtab);
- fprintf (outfile, " Read from object file %s (0x%x)\n",
- objfile -> name, (unsigned int) objfile);
-
+ fprintf_filtered (outfile, "(object )");
+ gdb_print_address (psymtab, outfile);
+ fprintf_filtered (outfile, ")\n\n");
+ fprintf_unfiltered (outfile, " Read from object file %s (",
+ objfile -> name);
+ gdb_print_address (objfile, outfile);
+ fprintf_unfiltered (outfile, ")\n");
+
if (psymtab -> readin)
{
fprintf_filtered (outfile,
- " Full symtab was read (at 0x%x by function at 0x%x)\n",
- psymtab -> symtab, psymtab -> read_symtab);
+ " Full symtab was read (at ");
+ gdb_print_address (psymtab->symtab, outfile);
+ fprintf_filtered (outfile, " by function at ");
+ gdb_print_address (psymtab->read_symtab, outfile);
+ fprintf_filtered (outfile, ")\n");
+ }
+
+ fprintf_filtered (outfile, " Relocate symbols by ");
+ for (i = 0; i < psymtab->objfile->num_sections; ++i)
+ {
+ wrap_here (" ");
+ print_address_numeric (ANOFFSET (psymtab->section_offsets, i), outfile);
+ fprintf_filtered (outfile, ", ");
}
- /* FIXME, we need to be able to print the relocation stuff. */
- /* This prints some garbage for anything but stabs right now. FIXME. */
- if (psymtab->section_offsets)
- fprintf_filtered (outfile, " Relocate symbols by 0x%x, 0x%x, 0x%x, 0x%x.\n",
- ANOFFSET (psymtab->section_offsets, 0),
- ANOFFSET (psymtab->section_offsets, 1),
- ANOFFSET (psymtab->section_offsets, 2),
- ANOFFSET (psymtab->section_offsets, 3));
-
- fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n",
- psymtab -> textlow, psymtab -> texthigh);
+ fprintf_filtered (outfile, " Symbols cover text addresses ");
+ print_address_numeric (psymtab->textlow, outfile);
+ fprintf_filtered (outfile, "-");
+ print_address_numeric (psymtab->texthigh, outfile);
+ fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
psymtab -> number_of_dependencies);
for (i = 0; i < psymtab -> number_of_dependencies; i++)
{
- fprintf_filtered (outfile, " %d 0x%lx %s\n", i,
- (unsigned long) psymtab -> dependencies[i],
+ fprintf_filtered (outfile, " %d ", i);
+ gdb_print_address (psymtab -> dependencies[i], outfile);
+ fprintf_filtered (outfile, " %s\n",
psymtab -> dependencies[i] -> filename);
}
if (psymtab -> n_global_syms > 0)
@@ -322,7 +341,7 @@ static void
dump_symtab (objfile, symtab, outfile)
struct objfile *objfile;
struct symtab *symtab;
- FILE *outfile;
+ GDB_FILE *outfile;
{
register int i, j;
int len, blen;
@@ -331,22 +350,27 @@ dump_symtab (objfile, symtab, outfile)
register struct block *b;
int depth;
- fprintf (outfile, "\nSymtab for file %s\n", symtab->filename);
- fprintf (outfile, "Read from object file %s (%x)\n", objfile->name,
- (unsigned int) objfile);
- fprintf (outfile, "Language: %s\n", language_str (symtab -> language));
-
+ fprintf_filtered (outfile, "\nSymtab for file %s\n", symtab->filename);
+ fprintf_filtered (outfile, "Read from object file %s (", objfile->name);
+ gdb_print_address (objfile, outfile);
+ fprintf_filtered (outfile, ")\n");
+ fprintf_filtered (outfile, "Language: %s\n", language_str (symtab -> language));
+
/* First print the line table. */
l = LINETABLE (symtab);
- if (l) {
- fprintf (outfile, "\nLine table:\n\n");
- len = l->nitems;
- for (i = 0; i < len; i++)
- fprintf (outfile, " line %d at %x\n", l->item[i].line,
- l->item[i].pc);
- }
+ if (l)
+ {
+ fprintf_filtered (outfile, "\nLine table:\n\n");
+ len = l->nitems;
+ for (i = 0; i < len; i++)
+ {
+ fprintf_filtered (outfile, " line %d at ", l->item[i].line);
+ print_address_numeric (l->item[i].pc, outfile);
+ fprintf_filtered (outfile, "\n");
+ }
+ }
/* Now print the block info. */
- fprintf (outfile, "\nBlockvector:\n\n");
+ fprintf_filtered (outfile, "\nBlockvector:\n\n");
bv = BLOCKVECTOR (symtab);
len = BLOCKVECTOR_NBLOCKS (bv);
for (i = 0; i < len; i++)
@@ -354,22 +378,32 @@ dump_symtab (objfile, symtab, outfile)
b = BLOCKVECTOR_BLOCK (bv, i);
depth = block_depth (b) * 2;
print_spaces (depth, outfile);
- fprintf (outfile, "block #%03d (object 0x%x) ", i, (unsigned int) b);
- fprintf (outfile, "[0x%x..0x%x]", BLOCK_START (b), BLOCK_END (b));
+ fprintf_filtered (outfile, "block #%03d (object ", i);
+ gdb_print_address (b, outfile);
+ fprintf_filtered (outfile, ") ");
+ fprintf_filtered (outfile, "[");
+ print_address_numeric (BLOCK_START (b), outfile);
+ fprintf_filtered (outfile, "..");
+ print_address_numeric (BLOCK_END (b), outfile);
+ fprintf_filtered (outfile, "]");
if (BLOCK_SUPERBLOCK (b))
- fprintf (outfile, " (under 0x%x)", (unsigned int) BLOCK_SUPERBLOCK (b));
+ {
+ fprintf_filtered (outfile, " (under ");
+ gdb_print_address (BLOCK_SUPERBLOCK (b), outfile);
+ fprintf_filtered (outfile, ")");
+ }
if (BLOCK_FUNCTION (b))
{
- fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
+ fprintf_filtered (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL)
{
- fprintf (outfile, " %s",
+ fprintf_filtered (outfile, " %s",
SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)));
}
}
if (BLOCK_GCC_COMPILED(b))
- fprintf (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
- fputc ('\n', outfile);
+ fprintf_filtered (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
+ fputc_filtered ('\n', outfile);
blen = BLOCK_NSYMS (b);
for (j = 0; j < blen; j++)
{
@@ -381,7 +415,7 @@ dump_symtab (objfile, symtab, outfile)
RETURN_MASK_ERROR);
}
}
- fprintf (outfile, "\n");
+ fprintf_filtered (outfile, "\n");
}
void
@@ -390,7 +424,7 @@ maintenance_print_symbols (args, from_tty)
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *symname = NULL;
char *filename = DEV_TTY;
@@ -422,7 +456,7 @@ maintenance_print_symbols (args, from_tty)
filename = tilde_expand (filename);
make_cleanup (free, filename);
- outfile = fopen (filename, FOPEN_WT);
+ outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, (char *) outfile);
@@ -446,24 +480,25 @@ print_symbol (args)
{
struct symbol *symbol = ((struct print_symbol_args *)args)->symbol;
int depth = ((struct print_symbol_args *)args)->depth;
- FILE *outfile = ((struct print_symbol_args *)args)->outfile;
+ GDB_FILE *outfile = ((struct print_symbol_args *)args)->outfile;
print_spaces (depth, outfile);
if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
{
- fprintf (outfile, "label %s at 0x%x\n", SYMBOL_SOURCE_NAME (symbol),
- SYMBOL_VALUE_ADDRESS (symbol));
+ fprintf_filtered (outfile, "label %s at ", SYMBOL_SOURCE_NAME (symbol));
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
+ fprintf_filtered (outfile, "\n");
return 1;
}
if (SYMBOL_NAMESPACE (symbol) == STRUCT_NAMESPACE)
{
- if (TYPE_NAME (SYMBOL_TYPE (symbol)))
+ if (TYPE_TAG_NAME (SYMBOL_TYPE (symbol)))
{
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
}
else
{
- fprintf (outfile, "%s %s = ",
+ fprintf_filtered (outfile, "%s %s = ",
(TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM
? "enum"
: (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
@@ -471,12 +506,12 @@ print_symbol (args)
SYMBOL_NAME (symbol));
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
}
- fprintf (outfile, ";\n");
+ fprintf_filtered (outfile, ";\n");
}
else
{
if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF)
- fprintf (outfile, "typedef ");
+ fprintf_filtered (outfile, "typedef ");
if (SYMBOL_TYPE (symbol))
{
/* Print details of types, except for enums where it's clutter. */
@@ -484,70 +519,75 @@ print_symbol (args)
outfile,
TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
depth);
- fprintf (outfile, "; ");
+ fprintf_filtered (outfile, "; ");
}
else
- fprintf (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol));
+ fprintf_filtered (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol));
switch (SYMBOL_CLASS (symbol))
{
case LOC_CONST:
- fprintf (outfile, "const %ld (0x%lx),",
- SYMBOL_VALUE (symbol), SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "const %ld (0x%lx),",
+ SYMBOL_VALUE (symbol),
+ SYMBOL_VALUE (symbol));
break;
case LOC_CONST_BYTES:
- fprintf (outfile, "const %u hex bytes:",
+ fprintf_filtered (outfile, "const %u hex bytes:",
TYPE_LENGTH (SYMBOL_TYPE (symbol)));
{
unsigned i;
for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (symbol)); i++)
- fprintf (outfile, " %2x",
+ fprintf_filtered (outfile, " %02x",
(unsigned)SYMBOL_VALUE_BYTES (symbol) [i]);
- fprintf (outfile, ",");
+ fprintf_filtered (outfile, ",");
}
break;
case LOC_STATIC:
- fprintf (outfile, "static at 0x%x,", SYMBOL_VALUE_ADDRESS (symbol));
+ fprintf_filtered (outfile, "static at ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
+ fprintf_filtered (outfile, ",");
break;
case LOC_REGISTER:
- fprintf (outfile, "register %ld,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "register %ld,", SYMBOL_VALUE (symbol));
break;
case LOC_ARG:
- fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "arg at offset 0x%lx,",
+ SYMBOL_VALUE (symbol));
break;
case LOC_LOCAL_ARG:
- fprintf (outfile, "arg at offset 0x%lx from fp,",
+ fprintf_filtered (outfile, "arg at offset 0x%lx from fp,",
SYMBOL_VALUE (symbol));
break;
case LOC_REF_ARG:
- fprintf (outfile, "reference arg at 0x%lx,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "reference arg at 0x%lx,", SYMBOL_VALUE (symbol));
break;
case LOC_REGPARM:
- fprintf (outfile, "parameter register %ld,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "parameter register %ld,", SYMBOL_VALUE (symbol));
break;
case LOC_REGPARM_ADDR:
- fprintf (outfile, "address parameter register %ld,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "address parameter register %ld,", SYMBOL_VALUE (symbol));
break;
case LOC_LOCAL:
- fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol));
+ fprintf_filtered (outfile, "local at offset 0x%lx,",
+ SYMBOL_VALUE (symbol));
break;
case LOC_BASEREG:
- fprintf (outfile, "local at 0x%lx from register %d",
+ fprintf_filtered (outfile, "local at 0x%lx from register %d",
SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
break;
case LOC_BASEREG_ARG:
- fprintf (outfile, "arg at 0x%lx from register %d,",
+ fprintf_filtered (outfile, "arg at 0x%lx from register %d,",
SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
break;
@@ -555,25 +595,30 @@ print_symbol (args)
break;
case LOC_LABEL:
- fprintf (outfile, "label at 0x%lx", SYMBOL_VALUE_ADDRESS (symbol));
+ fprintf_filtered (outfile, "label at ");
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
break;
case LOC_BLOCK:
- fprintf (outfile, "block (object 0x%x) starting at 0x%x,",
- (unsigned int) SYMBOL_BLOCK_VALUE (symbol),
- BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)));
+ fprintf_filtered (outfile, "block (object ");
+ gdb_print_address (SYMBOL_BLOCK_VALUE (symbol), outfile);
+ fprintf_filtered (outfile, ") starting at ");
+ print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)),
+ outfile);
+ fprintf_filtered (outfile, ",");
break;
case LOC_OPTIMIZED_OUT:
- fprintf (outfile, "optimized out");
+ fprintf_filtered (outfile, "optimized out");
break;
default:
- fprintf (outfile, "botched symbol class %x", SYMBOL_CLASS (symbol));
+ fprintf_filtered (outfile, "botched symbol class %x",
+ SYMBOL_CLASS (symbol));
break;
}
}
- fprintf (outfile, "\n");
+ fprintf_filtered (outfile, "\n");
return 1;
}
@@ -583,7 +628,7 @@ maintenance_print_psymbols (args, from_tty)
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *symname = NULL;
char *filename = DEV_TTY;
@@ -615,7 +660,7 @@ maintenance_print_psymbols (args, from_tty)
filename = tilde_expand (filename);
make_cleanup (free, filename);
- outfile = fopen (filename, FOPEN_WT);
+ outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, outfile);
@@ -633,7 +678,7 @@ print_partial_symbol (p, count, what, outfile)
struct partial_symbol *p;
int count;
char *what;
- FILE *outfile;
+ GDB_FILE *outfile;
{
fprintf_filtered (outfile, " %s partial symbols:\n", what);
@@ -715,7 +760,10 @@ print_partial_symbol (p, count, what, outfile)
break;
}
fputs_filtered (", ", outfile);
- fprintf_filtered (outfile, "0x%x\n", SYMBOL_VALUE (p));
+ /* FIXME-32x64: Need to use SYMBOL_VALUE_ADDRESS, etc.; this
+ could be 32 bits when some of the other fields in the union
+ are 64. */
+ fprintf_filtered (outfile, "0x%lx\n", SYMBOL_VALUE (p));
p++;
}
}
@@ -726,7 +774,7 @@ maintenance_print_msymbols (args, from_tty)
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *filename = DEV_TTY;
char *symname = NULL;
@@ -757,7 +805,7 @@ maintenance_print_msymbols (args, from_tty)
filename = tilde_expand (filename);
make_cleanup (free, filename);
- outfile = fopen (filename, FOPEN_WT);
+ outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0)
perror_with_name (filename);
make_cleanup (fclose, outfile);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index c91b7cd..a3242fd 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -460,7 +460,7 @@ print_floating (valaddr, type, stream)
/* Assume that floating point byte order is the same as
integer byte order. */
low = extract_unsigned_integer (valaddr, 4);
- nonnegative = low >= 0;
+ nonnegative = ((low & 0x80000000) == 0);
is_nan = ((((low >> 23) & 0xFF) == 0xFF)
&& 0 != (low & 0x7FFFFF));
low &= 0x7fffff;
@@ -479,7 +479,7 @@ print_floating (valaddr, type, stream)
low = extract_unsigned_integer (valaddr, 4);
high = extract_unsigned_integer (valaddr + 4, 4);
#endif
- nonnegative = high >= 0;
+ nonnegative = ((high & 0x80000000) == 0);
is_nan = (((high >> 20) & 0x7ff) == 0x7ff
&& ! ((((high & 0xfffff) == 0)) && (low == 0)));
high &= 0xfffff;
@@ -719,9 +719,10 @@ val_print_string (addr, len, stream)
are looking for a null terminator to end the fetching, so we might as
well read in blocks that are large enough to be efficient, but not so
large as to be slow if fetchlimit happens to be large. So we choose the
- minimum of DEFAULT_PRINT_MAX and fetchlimit. */
+ minimum of 8 and fetchlimit. We used to use 200 instead of 8 but
+ 200 is way too big for remote debugging over a serial line. */
- chunksize = (len == 0 ? min (PRINT_MAX_DEFAULT, fetchlimit) : fetchlimit);
+ chunksize = (len == 0 ? min (8, fetchlimit) : fetchlimit);
/* Loop until we either have all the characters to print, or we encounter
some error, such as bumping into the end of the address space. */
@@ -766,7 +767,7 @@ val_print_string (addr, len, stream)
} while (bufptr < limit && *(bufptr - 1) != '\0');
}
} while (errcode == 0 /* no error */
- && bufptr < buffer + fetchlimit /* no overrun */
+ && bufsize < fetchlimit /* no overrun */
&& !(len == 0 && *(bufptr - 1) == '\0')); /* no null term */
/* We now have either successfully filled the buffer to fetchlimit, or
@@ -803,12 +804,13 @@ val_print_string (addr, len, stream)
{
if (errcode == EIO)
{
- fprintf_filtered (stream,
- " <Address 0x%lx out of bounds>",
- (unsigned long) addr);
+ fprintf_filtered (stream, " <Address ");
+ print_address_numeric (addr, stream);
+ fprintf_filtered (stream, " out of bounds>");
}
else
{
+ /* FIXME-32x64: assumes addr fits in a long. */
error ("Error reading memory address 0x%lx: %s.",
(unsigned long) addr,
safe_strerror (errcode));
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index cb20bc3..074df77 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -727,6 +727,7 @@ print_section_info (t, abfd)
{
struct section_table *p;
+ /* FIXME-32x64: Need a version of print_address_numeric with field width. */
printf_filtered ("\t`%s', ", bfd_get_filename(abfd));
wrap_here (" ");
printf_filtered ("file type %s.\n", bfd_get_target(abfd));