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.
This commit is contained in:
Jim Kingdon 1994-01-27 00:36:05 +00:00
parent 9a27b06e98
commit 833e0d94cc
18 changed files with 432 additions and 253 deletions

View file

@ -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) 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. * valops.c (value_assign): Set `type' after coercing toval.

View file

@ -484,10 +484,6 @@ remove_breakpoints ()
register struct breakpoint *b; register struct breakpoint *b;
int val; int val;
#ifdef BREAKPOINT_DEBUG
printf_unfiltered ("Removing breakpoints.\n");
#endif /* BREAKPOINT_DEBUG */
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->type != bp_watchpoint && b->inserted) if (b->type != bp_watchpoint && b->inserted)
{ {
@ -495,14 +491,6 @@ remove_breakpoints ()
if (val) if (val)
return val; return val;
b->inserted = 0; 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; return 0;
@ -1506,8 +1494,10 @@ breakpoint_1 (bnum, allflag)
printf_filtered ("\n"); printf_filtered ("\n");
if (b->frame) 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) if (b->cond)
{ {
printf_filtered ("\tstop only if "); printf_filtered ("\tstop only if ");
@ -1586,17 +1576,20 @@ describe_other_breakpoints (pc)
others++; others++;
if (others > 0) if (others > 0)
{ {
printf_unfiltered ("Note: breakpoint%s ", (others > 1) ? "s" : ""); printf_filtered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
ALL_BREAKPOINTS (b) ALL_BREAKPOINTS (b)
if (b->address == pc) if (b->address == pc)
{ {
others--; others--;
printf_unfiltered ("%d%s%s ", printf_filtered
("%d%s%s ",
b->number, b->number,
(b->enable == disabled) ? " (disabled)" : "", (b->enable == disabled) ? " (disabled)" : "",
(others > 1) ? "," : ((others == 1) ? " and" : "")); (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); print_expression (b->exp, gdb_stdout);
break; break;
case bp_breakpoint: case bp_breakpoint:
printf_filtered ("Breakpoint %d at %s", b->number, printf_filtered ("Breakpoint %d at ", b->number);
local_hex_string((unsigned long) b->address)); print_address_numeric (b->address);
if (b->source_file) if (b->source_file)
printf_filtered (": file %s, line %d.", printf_filtered (": file %s, line %d.",
b->source_file, b->line_number); b->source_file, b->line_number);
@ -2055,8 +2048,8 @@ break_command_1 (arg, tempflag, from_tty)
if (sals.nelts > 1) if (sals.nelts > 1)
{ {
printf_unfiltered ("Multiple breakpoints were set.\n"); printf_filtered ("Multiple breakpoints were set.\n");
printf_unfiltered ("Use the \"delete\" command to delete unwanted breakpoints.\n"); printf_filtered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
} }
do_cleanups (old_chain); do_cleanups (old_chain);
} }

View file

@ -351,6 +351,15 @@ make_blockvector (objfile)
if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1)) if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1))
> BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i))) > 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, complain (&blockvector_complaint,
(unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i))); (unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
} }

View file

@ -172,7 +172,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
if (addressprint && format != 's') 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 /* 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) if (addressprint)
{ {
fprintf_filtered (stream, "@0x%lx", fprintf_filtered (stream, "@");
extract_unsigned_integer (valaddr, print_address_numeric
TARGET_PTR_BIT / HOST_CHAR_BIT)); (extract_address (valaddr,
TARGET_PTR_BIT / HOST_CHAR_BIT), stream);
if (deref_ref) if (deref_ref)
fputs_filtered (": ", stream); fputs_filtered (": ", stream);
} }

View file

@ -158,7 +158,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
} }
if (addressprint && format != 's') 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 /* 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: case TYPE_CODE_REF:
if (addressprint) if (addressprint)
{ {
fprintf_filtered (stream, "LOC(H'%lx)", fprintf_filtered (stream, "LOC(");
extract_unsigned_integer (valaddr, print_address_numeric
TARGET_PTR_BIT / HOST_CHAR_BIT)); (extract_address (valaddr, TARGET_PTR_BIT / HOST_CHAR_BIT),
stream);
fprintf_filtered (stream, ")");
if (deref_ref) if (deref_ref)
fputs_filtered (": ", stream); fputs_filtered (": ", stream);
} }

View file

@ -136,7 +136,7 @@ memory_error (status, memaddr)
int status; int status;
CORE_ADDR memaddr; CORE_ADDR memaddr;
{ {
/* FIXME-32x64--casting CORE_ADDR to unsigned long */
if (status == EIO) if (status == EIO)
{ {
/* Actually, address between memaddr and memaddr + len /* Actually, address between memaddr and memaddr + len

View file

@ -392,8 +392,11 @@ cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
fputs_filtered (basename ? basename : "", stream); fputs_filtered (basename ? basename : "", stream);
fputs_filtered ("> = ", stream); fputs_filtered ("> = ", stream);
if (err != 0) 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 else
cp_print_value_fields (TYPE_BASECLASS (type, i), baddr, stream, format, cp_print_value_fields (TYPE_BASECLASS (type, i), baddr, stream, format,
recurse, pretty, recurse, pretty,

View file

@ -296,6 +296,9 @@ n_spaces PARAMS ((int));
extern void extern void
gdb_printchar PARAMS ((int, GDB_FILE *, int)); gdb_printchar PARAMS ((int, GDB_FILE *, int));
/* Print a host address. */
extern void gdb_print_address PARAMS ((void *, GDB_FILE *));
extern void extern void
fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, enum language, int)); fprintf_symbol_filtered PARAMS ((GDB_FILE *, char *, enum language, int));
@ -345,6 +348,9 @@ set_next_address PARAMS ((CORE_ADDR));
extern void extern void
print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, char *)); print_address_symbolic PARAMS ((CORE_ADDR, GDB_FILE *, int, char *));
extern void
print_address_numeric PARAMS ((CORE_ADDR, GDB_FILE *));
extern void extern void
print_address PARAMS ((CORE_ADDR, GDB_FILE *)); print_address PARAMS ((CORE_ADDR, GDB_FILE *));
@ -596,6 +602,14 @@ parse_escape PARAMS ((char **));
extern const char * const reg_names[]; 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. */ extern NORETURN void /* Does not return to the caller. */
error (); error ();

View file

@ -1204,33 +1204,45 @@ dump_fn_fieldlists (type, spaces)
int overload_idx; int overload_idx;
struct fn_field *f; struct fn_field *f;
printfi_filtered (spaces, "fn_fieldlists 0x%lx\n", printfi_filtered (spaces, "fn_fieldlists ");
(unsigned long) TYPE_FN_FIELDLISTS (type)); gdb_print_address (TYPE_FN_FIELDLISTS (type), gdb_stdout);
printf_filtered ("\n");
for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++) for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++)
{ {
f = TYPE_FN_FIELDLIST1 (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, method_idx,
TYPE_FN_FIELDLIST_NAME (type, method_idx), TYPE_FN_FIELDLIST_NAME (type, method_idx));
(unsigned long) 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)); TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
for (overload_idx = 0; for (overload_idx = 0;
overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx); overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx);
overload_idx++) overload_idx++)
{ {
printfi_filtered (spaces + 4, "[%d] physname '%s' (0x%lx)\n", printfi_filtered (spaces + 4, "[%d] physname '%s' (",
overload_idx, overload_idx,
TYPE_FN_FIELD_PHYSNAME (f, overload_idx), TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
(unsigned long) TYPE_FN_FIELD_PHYSNAME (f, overload_idx)); gdb_print_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx));
printfi_filtered (spaces + 8, "type 0x%lx\n", printf_filtered (")\n");
(unsigned long) TYPE_FN_FIELD_TYPE (f, overload_idx)); 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), recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx),
spaces + 8 + 2); 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); print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces);
printfi_filtered (spaces + 8, "fcontext 0x%lx\n", printfi_filtered (spaces + 8, "fcontext ");
(unsigned long) TYPE_FN_FIELD_FCONTEXT (f, overload_idx)); gdb_print_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx),
gdb_stdout);
printf_filtered ("\n");
printfi_filtered (spaces + 8, "is_const %d\n", printfi_filtered (spaces + 8, "is_const %d\n",
TYPE_FN_FIELD_CONST (f, overload_idx)); TYPE_FN_FIELD_CONST (f, overload_idx));
printfi_filtered (spaces + 8, "is_volatile %d\n", printfi_filtered (spaces + 8, "is_volatile %d\n",
@ -1260,9 +1272,11 @@ print_cplus_stuff (type, spaces)
TYPE_NFN_FIELDS_TOTAL (type)); TYPE_NFN_FIELDS_TOTAL (type));
if (TYPE_N_BASECLASSES (type) > 0) if (TYPE_N_BASECLASSES (type) > 0)
{ {
printfi_filtered (spaces, "virtual_field_bits (%d bits at *0x%lx)", printfi_filtered (spaces, "virtual_field_bits (%d bits at *",
TYPE_N_BASECLASSES (type), TYPE_N_BASECLASSES (type));
(unsigned long) TYPE_FIELD_VIRTUAL_BITS (type)); gdb_print_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type), print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
TYPE_N_BASECLASSES (type)); TYPE_N_BASECLASSES (type));
puts_filtered ("\n"); puts_filtered ("\n");
@ -1271,18 +1285,20 @@ print_cplus_stuff (type, spaces)
{ {
if (TYPE_FIELD_PRIVATE_BITS (type) != NULL) if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
{ {
printfi_filtered (spaces, "private_field_bits (%d bits at *0x%lx)", printfi_filtered (spaces, "private_field_bits (%d bits at *",
TYPE_NFIELDS (type), TYPE_NFIELDS (type));
(unsigned long) TYPE_FIELD_PRIVATE_BITS (type)); gdb_print_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type), print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
TYPE_NFIELDS (type)); TYPE_NFIELDS (type));
puts_filtered ("\n"); puts_filtered ("\n");
} }
if (TYPE_FIELD_PROTECTED_BITS (type) != NULL) if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
{ {
printfi_filtered (spaces, "protected_field_bits (%d bits at *0x%lx)", printfi_filtered (spaces, "protected_field_bits (%d bits at *",
TYPE_NFIELDS (type), TYPE_NFIELDS (type));
(unsigned long) TYPE_FIELD_PROTECTED_BITS (type)); gdb_print_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout);
printf_filtered (")");
print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type), print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
TYPE_NFIELDS (type)); TYPE_NFIELDS (type));
puts_filtered ("\n"); puts_filtered ("\n");
@ -1301,14 +1317,20 @@ recursive_dump_type (type, spaces)
{ {
int idx; int idx;
printfi_filtered (spaces, "type node 0x%lx\n", (unsigned long)type); printfi_filtered (spaces, "type node ");
printfi_filtered (spaces, "name '%s' (0x%lx)\n", gdb_print_address (type, gdb_stdout);
TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>", printf_filtered ("\n");
(unsigned long)TYPE_NAME (type)); 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) if (TYPE_TAG_NAME (type) != NULL)
printfi_filtered (spaces, "tagname '%s' (0x%lx)\n", {
TYPE_TAG_NAME (type), printfi_filtered (spaces, "tagname '%s' (",
(unsigned long)TYPE_TAG_NAME (type)); 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)); printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
switch (TYPE_CODE (type)) switch (TYPE_CODE (type))
{ {
@ -1375,20 +1397,25 @@ recursive_dump_type (type, spaces)
} }
puts_filtered ("\n"); puts_filtered ("\n");
printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type)); printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
printfi_filtered (spaces, "objfile 0x%lx\n", printfi_filtered (spaces, "objfile ");
(unsigned long) TYPE_OBJFILE (type)); gdb_print_address (TYPE_OBJFILE (type), gdb_stdout);
printfi_filtered (spaces, "target_type 0x%lx\n", printf_filtered ("\n");
(unsigned long) TYPE_TARGET_TYPE (type)); printfi_filtered (spaces, "target_type ");
gdb_print_address (TYPE_TARGET_TYPE (type), gdb_stdout);
printf_filtered ("\n");
if (TYPE_TARGET_TYPE (type) != NULL) if (TYPE_TARGET_TYPE (type) != NULL)
{ {
recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2); recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2);
} }
printfi_filtered (spaces, "pointer_type 0x%lx\n", printfi_filtered (spaces, "pointer_type ");
(unsigned long) TYPE_POINTER_TYPE (type)); gdb_print_address (TYPE_POINTER_TYPE (type), gdb_stdout);
printfi_filtered (spaces, "reference_type 0x%lx\n", printf_filtered ("\n");
(unsigned long) TYPE_REFERENCE_TYPE (type)); printfi_filtered (spaces, "reference_type ");
printfi_filtered (spaces, "function_type 0x%lx\n", gdb_print_address (TYPE_REFERENCE_TYPE (type), gdb_stdout);
(unsigned long) TYPE_FUNCTION_TYPE (type)); 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)); printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type));
if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED) if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED)
{ {
@ -1399,26 +1426,30 @@ recursive_dump_type (type, spaces)
puts_filtered (" TYPE_FLAG_STUB"); puts_filtered (" TYPE_FLAG_STUB");
} }
puts_filtered ("\n"); puts_filtered ("\n");
printfi_filtered (spaces, "nfields %d 0x%lx\n", TYPE_NFIELDS (type), printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type));
(unsigned long) TYPE_FIELDS (type)); gdb_print_address (TYPE_FIELDS (type));
puts_filtered ("\n");
for (idx = 0; idx < TYPE_NFIELDS (type); idx++) for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{ {
printfi_filtered (spaces + 2, 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), idx, TYPE_FIELD_BITPOS (type, idx),
TYPE_FIELD_BITSIZE (type, idx), TYPE_FIELD_BITSIZE (type, idx));
(unsigned long) TYPE_FIELD_TYPE (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
? TYPE_FIELD_NAME (type, idx) ? TYPE_FIELD_NAME (type, idx)
: "<NULL>", : "<NULL>");
(unsigned long) TYPE_FIELD_NAME (type, idx)); gdb_print_address (TYPE_FIELD_NAME (type, idx));
printf_filtered (")\n");
if (TYPE_FIELD_TYPE (type, idx) != NULL) if (TYPE_FIELD_TYPE (type, idx) != NULL)
{ {
recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4); recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
} }
} }
printfi_filtered (spaces, "vptr_basetype 0x%lx\n", printfi_filtered (spaces, "vptr_basetype ");
(unsigned long) TYPE_VPTR_BASETYPE (type)); gdb_print_address (TYPE_VPTR_BASETYPE (type), gdb_stdout);
puts_filtered ("\n");
if (TYPE_VPTR_BASETYPE (type) != NULL) if (TYPE_VPTR_BASETYPE (type) != NULL)
{ {
recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2); 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_METHOD:
case TYPE_CODE_FUNC: case TYPE_CODE_FUNC:
printfi_filtered (spaces, "arg_types 0x%lx\n", printfi_filtered (spaces, "arg_types ");
(unsigned long) TYPE_ARG_TYPES (type)); gdb_print_address (TYPE_ARG_TYPES (type));
puts_filtered ("\n");
print_arg_types (TYPE_ARG_TYPES (type), spaces); print_arg_types (TYPE_ARG_TYPES (type), spaces);
break; break;
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
printfi_filtered (spaces, "cplus_stuff 0x%lx\n", printfi_filtered (spaces, "cplus_stuff ");
(unsigned long) TYPE_CPLUS_SPECIFIC (type)); gdb_print_address (TYPE_CPLUS_SPECIFIC (type));
puts_filtered ("\n");
print_cplus_stuff (type, spaces); print_cplus_stuff (type, spaces);
break; 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 /* 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 the value. Pick cplus_struct_type, even though we know it isn't
any particular one. */ any particular one. */
printfi_filtered (spaces, "type_specific 0x%lx", printfi_filtered (spaces, "type_specific ");
(unsigned long) TYPE_CPLUS_SPECIFIC (type)); gdb_print_address (TYPE_CPLUS_SPECIFIC (type));
if (TYPE_CPLUS_SPECIFIC (type) != NULL) if (TYPE_CPLUS_SPECIFIC (type) != NULL)
{ {
printf_filtered (" (unknown data form)"); printf_filtered (" (unknown data form)");

View file

@ -137,6 +137,7 @@ print_section_table (abfd, asect, ignore)
flags = bfd_get_section_flags (abfd, asect); flags = bfd_get_section_flags (abfd, asect);
/* FIXME-32x64: Need print_address_numeric with field width. */
printf_filtered (" %s", printf_filtered (" %s",
local_hex_string_custom local_hex_string_custom
((unsigned long) bfd_section_vma (abfd, asect), "08l")); ((unsigned long) bfd_section_vma (abfd, asect), "08l"));

View file

@ -1712,6 +1712,7 @@ parse_procedure (pr, search_symtab, first_off)
if (pr->isym == -1) if (pr->isym == -1)
{ {
/* Static procedure at address pr->adr. Sigh. */ /* Static procedure at address pr->adr. Sigh. */
/* FIXME-32x64. assuming pr->adr fits in long. */
complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr); complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr);
return; return;
} }

View file

@ -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 /* If we haven't found it yet, ignore it. It's probably some
new type we don't know about yet. */ new type we don't know about yet. */
complain (&unknown_symtype_complaint, complain (&unknown_symtype_complaint,
local_hex_string ((unsigned long) CUR_SYMBOL_TYPE)); local_hex_string (CUR_SYMBOL_TYPE));
continue; continue;
} }

View file

@ -596,6 +596,17 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
fputs_filtered (">", stream); 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. /* Print address ADDR symbolically on STREAM.
First print it as a number. Then perhaps print First print it as a number. Then perhaps print
@ -606,14 +617,7 @@ print_address (addr, stream)
CORE_ADDR addr; CORE_ADDR addr;
GDB_FILE *stream; GDB_FILE *stream;
{ {
#if 0 && defined (ADDR_BITS_REMOVE) print_address_numeric (addr, stream);
/* 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_symbolic (addr, stream, asm_demangle, " "); print_address_symbolic (addr, stream, asm_demangle, " ");
} }
@ -628,12 +632,17 @@ print_address_demangle (addr, stream, do_demangle)
GDB_FILE *stream; GDB_FILE *stream;
int do_demangle; int do_demangle;
{ {
if (addr == 0) { if (addr == 0)
{
fprintf_filtered (stream, "0"); fprintf_filtered (stream, "0");
} else if (addressprint) { }
fprintf_filtered (stream, local_hex_format(), (unsigned long) addr); else if (addressprint)
{
print_address_numeric (addr, stream);
print_address_symbolic (addr, stream, do_demangle, " "); print_address_symbolic (addr, stream, do_demangle, " ");
} else { }
else
{
print_address_symbolic (addr, stream, do_demangle, ""); print_address_symbolic (addr, stream, do_demangle, "");
} }
} }
@ -924,8 +933,9 @@ address_info (exp, from_tty)
printf_filtered ("Symbol \""); printf_filtered ("Symbol \"");
fprintf_symbol_filtered (gdb_stdout, exp, fprintf_symbol_filtered (gdb_stdout, exp,
current_language->la_language, DMGL_ANSI); current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is at %s in a file compiled without debugging.\n", printf_filtered ("\" is at ");
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (msymbol))); print_address_numeric (SYMBOL_VALUE_ADDRESS (msymbol), gdb_stdout);
printf_filtered (" in a file compiled without debugging.\n");
} }
else else
error ("No symbol \"%s\" in current context.", exp); error ("No symbol \"%s\" in current context.", exp);
@ -947,8 +957,8 @@ address_info (exp, from_tty)
break; break;
case LOC_LABEL: case LOC_LABEL:
printf_filtered ("a label at address %s", printf_filtered ("a label at address ");
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym))); print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
break; break;
case LOC_REGISTER: case LOC_REGISTER:
@ -956,8 +966,8 @@ address_info (exp, from_tty)
break; break;
case LOC_STATIC: case LOC_STATIC:
printf_filtered ("static storage at address %s", printf_filtered ("static storage at address ");
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym))); print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
break; break;
case LOC_REGPARM: case LOC_REGPARM:
@ -999,8 +1009,9 @@ address_info (exp, from_tty)
break; break;
case LOC_BLOCK: case LOC_BLOCK:
printf_filtered ("a function at address %s", printf_filtered ("a function at address ");
local_hex_string((unsigned long) BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))); print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
gdb_stdout);
break; break;
case LOC_OPTIMIZED_OUT: case LOC_OPTIMIZED_OUT:
@ -1979,8 +1990,11 @@ disassemble_command (arg, from_tty)
} }
else else
{ {
printf_filtered ("from %s ", local_hex_string((unsigned long) low)); printf_filtered ("from ");
printf_filtered ("to %s:\n", local_hex_string((unsigned long) high)); print_address_numeric (low, gdb_stdout);
printf_filtered (" to ");
print_address_numeric (high, gdb_stdout);
printf_filtered (":\n");
} }
/* Dump the specified range. */ /* Dump the specified range. */

View file

@ -567,7 +567,7 @@ vx_run_files_info ()
{ {
printf_unfiltered ("\tRunning %s VxWorks process %s", printf_unfiltered ("\tRunning %s VxWorks process %s",
vx_running ? "child" : "attached", vx_running ? "child" : "attached",
local_hex_string((unsigned long) inferior_pid)); local_hex_string (inferior_pid));
if (vx_running) if (vx_running)
printf_unfiltered (", function `%s'", vx_running); printf_unfiltered (", function `%s'", vx_running);
printf_unfiltered(".\n"); printf_unfiltered(".\n");

View file

@ -286,7 +286,10 @@ print_frame_info (fi, level, source, args)
printf_filtered ("#%-2d ", level); printf_filtered ("#%-2d ", level);
if (addressprint) if (addressprint)
if (fi->pc != sal.pc || !sal.symtab) 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, fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
DMGL_ANSI); DMGL_ANSI);
wrap_here (" "); wrap_here (" ");
@ -327,7 +330,10 @@ print_frame_info (fi, level, source, args)
if (!done) if (!done)
{ {
if (addressprint && mid_statement) 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); print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
} }
current_source_line = max (sal.line - lines_to_list/2, 1); 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); calling_frame = get_prev_frame (frame);
if (!addr_exp && selected_frame_level >= 0) { if (!addr_exp && selected_frame_level >= 0)
printf_filtered ("Stack level %d, frame at %s:\n", {
selected_frame_level, printf_filtered ("Stack level %d, frame at "
local_hex_string((unsigned long) FRAME_FP(frame))); selected_frame_level);
} else { print_address_numeric (FRAME_FP(frame), gdb_stdout);
printf_filtered ("Stack frame at %s:\n", printf_filtered (":\n");
local_hex_string((unsigned long) FRAME_FP(frame)));
} }
printf_filtered (" %s = %s", else
reg_names[PC_REGNUM], {
local_hex_string((unsigned long) fi->pc)); 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 (" "); wrap_here (" ");
if (funname) if (funname)
@ -513,8 +524,9 @@ frame_info (addr_exp, from_tty)
printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line); printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
puts_filtered ("; "); puts_filtered ("; ");
wrap_here (" "); wrap_here (" ");
printf_filtered ("saved %s %s\n", reg_names[PC_REGNUM], printf_filtered ("saved %s ", reg_names[PC_REGNUM]);
local_hex_string((unsigned long) FRAME_SAVED_PC (frame))); print_address_numeric (FRAME_SAVED_PC (frame), gdb_stdout);
printf_filtered ("\n");
{ {
int frameless = 0; int frameless = 0;
@ -526,14 +538,18 @@ frame_info (addr_exp, from_tty)
} }
if (calling_frame) 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) if (fi->next && calling_frame)
puts_filtered (","); puts_filtered (",");
wrap_here (" "); wrap_here (" ");
if (fi->next) 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) if (fi->next || calling_frame)
puts_filtered ("\n"); puts_filtered ("\n");
if (s) if (s)
@ -553,8 +569,9 @@ frame_info (addr_exp, from_tty)
printf_filtered (" Arglist at unknown address.\n"); printf_filtered (" Arglist at unknown address.\n");
else else
{ {
printf_filtered (" Arglist at %s,", printf_filtered (" Arglist at ");
local_hex_string((unsigned long) arg_list)); print_address_numeric (arg_list, gdb_stdout);
printf_filtered (",");
FRAME_NUM_ARGS (numargs, fi); FRAME_NUM_ARGS (numargs, fi);
if (numargs < 0) if (numargs < 0)
@ -576,16 +593,20 @@ frame_info (addr_exp, from_tty)
if (arg_list == 0) if (arg_list == 0)
printf_filtered (" Locals at unknown address,"); printf_filtered (" Locals at unknown address,");
else 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) #if defined (FRAME_FIND_SAVED_REGS)
get_frame_saved_regs (fi, &fsr); get_frame_saved_regs (fi, &fsr);
/* The sp is special; what's returned isn't the save address, but /* The sp is special; what's returned isn't the save address, but
actually the value of the previous frame's sp. */ actually the value of the previous frame's sp. */
printf_filtered (" Previous frame's sp is %s\n", printf_filtered (" Previous frame's sp is ");
local_hex_string((unsigned long) fsr.regs[SP_REGNUM])); print_address_numeric (fsr.regs[SP_REGNUM], gdb_stdout);
printf_filtered ("\n");
count = 0; count = 0;
for (i = 0; i < NUM_REGS; i++) for (i = 0; i < NUM_REGS; i++)
if (fsr.regs[i] && i != SP_REGNUM) if (fsr.regs[i] && i != SP_REGNUM)
@ -595,8 +616,8 @@ frame_info (addr_exp, from_tty)
else else
puts_filtered (","); puts_filtered (",");
wrap_here (" "); wrap_here (" ");
printf_filtered (" %s at %s", reg_names[i], printf_filtered (" %s at ", reg_names[i]);
local_hex_string((unsigned long) fsr.regs[i])); print_address_numeric (fsr.regs[i], gdb_stdout);
count++; count++;
} }
if (count) if (count)
@ -804,8 +825,10 @@ print_block_frame_labels (b, have_default, stream)
values_printed = 1; values_printed = 1;
fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream); fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
if (addressprint) 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", fprintf_filtered (stream, " in file %s, line %d\n",
sal.symtab->filename, sal.line); sal.symtab->filename, sal.line);
} }

View file

@ -47,13 +47,13 @@ FILE *std_err;
/* Prototypes for local functions */ /* Prototypes for local functions */
static void static void
dump_symtab PARAMS ((struct objfile *, struct symtab *, FILE *)); dump_symtab PARAMS ((struct objfile *, struct symtab *, GDB_FILE *));
static void static void
dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, FILE *)); dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, GDB_FILE *));
static void static void
dump_msymbols PARAMS ((struct objfile *, FILE *)); dump_msymbols PARAMS ((struct objfile *, GDB_FILE *));
static void static void
dump_objfile PARAMS ((struct objfile *)); dump_objfile PARAMS ((struct objfile *));
@ -62,12 +62,12 @@ static int
block_depth PARAMS ((struct block *)); block_depth PARAMS ((struct block *));
static void 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 print_symbol_args {
struct symbol *symbol; struct symbol *symbol;
int depth; int depth;
FILE *outfile; GDB_FILE *outfile;
}; };
static int print_symbol PARAMS ((char *)); static int print_symbol PARAMS ((char *));
@ -159,8 +159,12 @@ dump_objfile (objfile)
struct partial_symtab *psymtab; struct partial_symtab *psymtab;
printf_filtered ("\nObject file %s: ", objfile -> name); printf_filtered ("\nObject file %s: ", objfile -> name);
printf_filtered ("Objfile at %x, bfd at %x, %d minsyms\n\n", printf_filtered ("Objfile at ");
objfile, objfile -> obfd, objfile->minimal_symbol_count); 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) if (objfile -> psymtabs)
{ {
@ -169,7 +173,10 @@ dump_objfile (objfile)
psymtab != NULL; psymtab != NULL;
psymtab = psymtab -> next) 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) if (psymtab -> objfile != objfile)
{ {
printf_filtered ("NOT ON CHAIN! "); printf_filtered ("NOT ON CHAIN! ");
@ -186,7 +193,9 @@ dump_objfile (objfile)
symtab != NULL; symtab != NULL;
symtab = symtab->next) 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) if (symtab -> objfile != objfile)
{ {
printf_filtered ("NOT ON CHAIN! "); printf_filtered ("NOT ON CHAIN! ");
@ -202,7 +211,7 @@ dump_objfile (objfile)
static void static void
dump_msymbols (objfile, outfile) dump_msymbols (objfile, outfile)
struct objfile *objfile; struct objfile *objfile;
FILE *outfile; GDB_FILE *outfile;
{ {
struct minimal_symbol *msymbol; struct minimal_symbol *msymbol;
int index; int index;
@ -247,7 +256,7 @@ dump_msymbols (objfile, outfile)
ms_type = '?'; ms_type = '?';
break; 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)); SYMBOL_VALUE_ADDRESS (msymbol), SYMBOL_NAME (msymbol));
if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL) if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
{ {
@ -267,40 +276,50 @@ static void
dump_psymtab (objfile, psymtab, outfile) dump_psymtab (objfile, psymtab, outfile)
struct objfile *objfile; struct objfile *objfile;
struct partial_symtab *psymtab; struct partial_symtab *psymtab;
FILE *outfile; GDB_FILE *outfile;
{ {
int i; int i;
fprintf_filtered (outfile, "\nPartial symtab for source file %s ", fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
psymtab -> filename); psymtab -> filename);
fprintf_filtered (outfile, "(object 0x%x)\n\n", psymtab); fprintf_filtered (outfile, "(object )");
fprintf (outfile, " Read from object file %s (0x%x)\n", gdb_print_address (psymtab, outfile);
objfile -> name, (unsigned int) objfile); 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) if (psymtab -> readin)
{ {
fprintf_filtered (outfile, fprintf_filtered (outfile,
" Full symtab was read (at 0x%x by function at 0x%x)\n", " Full symtab was read (at ");
psymtab -> symtab, psymtab -> read_symtab); gdb_print_address (psymtab->symtab, outfile);
fprintf_filtered (outfile, " by function at ");
gdb_print_address (psymtab->read_symtab, outfile);
fprintf_filtered (outfile, ")\n");
} }
/* FIXME, we need to be able to print the relocation stuff. */ fprintf_filtered (outfile, " Relocate symbols by ");
/* This prints some garbage for anything but stabs right now. FIXME. */ for (i = 0; i < psymtab->objfile->num_sections; ++i)
if (psymtab->section_offsets) {
fprintf_filtered (outfile, " Relocate symbols by 0x%x, 0x%x, 0x%x, 0x%x.\n", wrap_here (" ");
ANOFFSET (psymtab->section_offsets, 0), print_address_numeric (ANOFFSET (psymtab->section_offsets, i), outfile);
ANOFFSET (psymtab->section_offsets, 1), fprintf_filtered (outfile, ", ");
ANOFFSET (psymtab->section_offsets, 2), }
ANOFFSET (psymtab->section_offsets, 3));
fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n", fprintf_filtered (outfile, " Symbols cover text addresses ");
psymtab -> textlow, psymtab -> texthigh); 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", fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
psymtab -> number_of_dependencies); psymtab -> number_of_dependencies);
for (i = 0; i < psymtab -> number_of_dependencies; i++) for (i = 0; i < psymtab -> number_of_dependencies; i++)
{ {
fprintf_filtered (outfile, " %d 0x%lx %s\n", i, fprintf_filtered (outfile, " %d ", i);
(unsigned long) psymtab -> dependencies[i], gdb_print_address (psymtab -> dependencies[i], outfile);
fprintf_filtered (outfile, " %s\n",
psymtab -> dependencies[i] -> filename); psymtab -> dependencies[i] -> filename);
} }
if (psymtab -> n_global_syms > 0) if (psymtab -> n_global_syms > 0)
@ -322,7 +341,7 @@ static void
dump_symtab (objfile, symtab, outfile) dump_symtab (objfile, symtab, outfile)
struct objfile *objfile; struct objfile *objfile;
struct symtab *symtab; struct symtab *symtab;
FILE *outfile; GDB_FILE *outfile;
{ {
register int i, j; register int i, j;
int len, blen; int len, blen;
@ -331,22 +350,27 @@ dump_symtab (objfile, symtab, outfile)
register struct block *b; register struct block *b;
int depth; int depth;
fprintf (outfile, "\nSymtab for file %s\n", symtab->filename); fprintf_filtered (outfile, "\nSymtab for file %s\n", symtab->filename);
fprintf (outfile, "Read from object file %s (%x)\n", objfile->name, fprintf_filtered (outfile, "Read from object file %s (", objfile->name);
(unsigned int) objfile); gdb_print_address (objfile, outfile);
fprintf (outfile, "Language: %s\n", language_str (symtab -> language)); fprintf_filtered (outfile, ")\n");
fprintf_filtered (outfile, "Language: %s\n", language_str (symtab -> language));
/* First print the line table. */ /* First print the line table. */
l = LINETABLE (symtab); l = LINETABLE (symtab);
if (l) { if (l)
fprintf (outfile, "\nLine table:\n\n"); {
fprintf_filtered (outfile, "\nLine table:\n\n");
len = l->nitems; len = l->nitems;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
fprintf (outfile, " line %d at %x\n", l->item[i].line, {
l->item[i].pc); 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. */ /* Now print the block info. */
fprintf (outfile, "\nBlockvector:\n\n"); fprintf_filtered (outfile, "\nBlockvector:\n\n");
bv = BLOCKVECTOR (symtab); bv = BLOCKVECTOR (symtab);
len = BLOCKVECTOR_NBLOCKS (bv); len = BLOCKVECTOR_NBLOCKS (bv);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -354,22 +378,32 @@ dump_symtab (objfile, symtab, outfile)
b = BLOCKVECTOR_BLOCK (bv, i); b = BLOCKVECTOR_BLOCK (bv, i);
depth = block_depth (b) * 2; depth = block_depth (b) * 2;
print_spaces (depth, outfile); print_spaces (depth, outfile);
fprintf (outfile, "block #%03d (object 0x%x) ", i, (unsigned int) b); fprintf_filtered (outfile, "block #%03d (object ", i);
fprintf (outfile, "[0x%x..0x%x]", BLOCK_START (b), BLOCK_END (b)); 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)) 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)) 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) if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL)
{ {
fprintf (outfile, " %s", fprintf_filtered (outfile, " %s",
SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b))); SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)));
} }
} }
if (BLOCK_GCC_COMPILED(b)) if (BLOCK_GCC_COMPILED(b))
fprintf (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b)); fprintf_filtered (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
fputc ('\n', outfile); fputc_filtered ('\n', outfile);
blen = BLOCK_NSYMS (b); blen = BLOCK_NSYMS (b);
for (j = 0; j < blen; j++) for (j = 0; j < blen; j++)
{ {
@ -381,7 +415,7 @@ dump_symtab (objfile, symtab, outfile)
RETURN_MASK_ERROR); RETURN_MASK_ERROR);
} }
} }
fprintf (outfile, "\n"); fprintf_filtered (outfile, "\n");
} }
void void
@ -390,7 +424,7 @@ maintenance_print_symbols (args, from_tty)
int from_tty; int from_tty;
{ {
char **argv; char **argv;
FILE *outfile; GDB_FILE *outfile;
struct cleanup *cleanups; struct cleanup *cleanups;
char *symname = NULL; char *symname = NULL;
char *filename = DEV_TTY; char *filename = DEV_TTY;
@ -422,7 +456,7 @@ maintenance_print_symbols (args, from_tty)
filename = tilde_expand (filename); filename = tilde_expand (filename);
make_cleanup (free, filename); make_cleanup (free, filename);
outfile = fopen (filename, FOPEN_WT); outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0) if (outfile == 0)
perror_with_name (filename); perror_with_name (filename);
make_cleanup (fclose, (char *) outfile); make_cleanup (fclose, (char *) outfile);
@ -446,24 +480,25 @@ print_symbol (args)
{ {
struct symbol *symbol = ((struct print_symbol_args *)args)->symbol; struct symbol *symbol = ((struct print_symbol_args *)args)->symbol;
int depth = ((struct print_symbol_args *)args)->depth; 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); print_spaces (depth, outfile);
if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE) if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
{ {
fprintf (outfile, "label %s at 0x%x\n", SYMBOL_SOURCE_NAME (symbol), fprintf_filtered (outfile, "label %s at ", SYMBOL_SOURCE_NAME (symbol));
SYMBOL_VALUE_ADDRESS (symbol)); print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
fprintf_filtered (outfile, "\n");
return 1; return 1;
} }
if (SYMBOL_NAMESPACE (symbol) == STRUCT_NAMESPACE) 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); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
} }
else else
{ {
fprintf (outfile, "%s %s = ", fprintf_filtered (outfile, "%s %s = ",
(TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM
? "enum" ? "enum"
: (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
@ -471,12 +506,12 @@ print_symbol (args)
SYMBOL_NAME (symbol)); SYMBOL_NAME (symbol));
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth); LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
} }
fprintf (outfile, ";\n"); fprintf_filtered (outfile, ";\n");
} }
else else
{ {
if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF) if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF)
fprintf (outfile, "typedef "); fprintf_filtered (outfile, "typedef ");
if (SYMBOL_TYPE (symbol)) if (SYMBOL_TYPE (symbol))
{ {
/* Print details of types, except for enums where it's clutter. */ /* Print details of types, except for enums where it's clutter. */
@ -484,70 +519,75 @@ print_symbol (args)
outfile, outfile,
TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM, TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
depth); depth);
fprintf (outfile, "; "); fprintf_filtered (outfile, "; ");
} }
else else
fprintf (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol)); fprintf_filtered (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol));
switch (SYMBOL_CLASS (symbol)) switch (SYMBOL_CLASS (symbol))
{ {
case LOC_CONST: case LOC_CONST:
fprintf (outfile, "const %ld (0x%lx),", fprintf_filtered (outfile, "const %ld (0x%lx),",
SYMBOL_VALUE (symbol), SYMBOL_VALUE (symbol)); SYMBOL_VALUE (symbol),
SYMBOL_VALUE (symbol));
break; break;
case LOC_CONST_BYTES: case LOC_CONST_BYTES:
fprintf (outfile, "const %u hex bytes:", fprintf_filtered (outfile, "const %u hex bytes:",
TYPE_LENGTH (SYMBOL_TYPE (symbol))); TYPE_LENGTH (SYMBOL_TYPE (symbol)));
{ {
unsigned i; unsigned i;
for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (symbol)); i++) for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (symbol)); i++)
fprintf (outfile, " %2x", fprintf_filtered (outfile, " %02x",
(unsigned)SYMBOL_VALUE_BYTES (symbol) [i]); (unsigned)SYMBOL_VALUE_BYTES (symbol) [i]);
fprintf (outfile, ","); fprintf_filtered (outfile, ",");
} }
break; break;
case LOC_STATIC: 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; break;
case LOC_REGISTER: case LOC_REGISTER:
fprintf (outfile, "register %ld,", SYMBOL_VALUE (symbol)); fprintf_filtered (outfile, "register %ld,", SYMBOL_VALUE (symbol));
break; break;
case LOC_ARG: case LOC_ARG:
fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol)); fprintf_filtered (outfile, "arg at offset 0x%lx,",
SYMBOL_VALUE (symbol));
break; break;
case LOC_LOCAL_ARG: 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)); SYMBOL_VALUE (symbol));
break; break;
case LOC_REF_ARG: 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; break;
case LOC_REGPARM: case LOC_REGPARM:
fprintf (outfile, "parameter register %ld,", SYMBOL_VALUE (symbol)); fprintf_filtered (outfile, "parameter register %ld,", SYMBOL_VALUE (symbol));
break; break;
case LOC_REGPARM_ADDR: case LOC_REGPARM_ADDR:
fprintf (outfile, "address parameter register %ld,", SYMBOL_VALUE (symbol)); fprintf_filtered (outfile, "address parameter register %ld,", SYMBOL_VALUE (symbol));
break; break;
case LOC_LOCAL: case LOC_LOCAL:
fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol)); fprintf_filtered (outfile, "local at offset 0x%lx,",
SYMBOL_VALUE (symbol));
break; break;
case LOC_BASEREG: 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)); SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
break; break;
case LOC_BASEREG_ARG: 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)); SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
break; break;
@ -555,25 +595,30 @@ print_symbol (args)
break; break;
case LOC_LABEL: 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; break;
case LOC_BLOCK: case LOC_BLOCK:
fprintf (outfile, "block (object 0x%x) starting at 0x%x,", fprintf_filtered (outfile, "block (object ");
(unsigned int) SYMBOL_BLOCK_VALUE (symbol), gdb_print_address (SYMBOL_BLOCK_VALUE (symbol), outfile);
BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))); fprintf_filtered (outfile, ") starting at ");
print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)),
outfile);
fprintf_filtered (outfile, ",");
break; break;
case LOC_OPTIMIZED_OUT: case LOC_OPTIMIZED_OUT:
fprintf (outfile, "optimized out"); fprintf_filtered (outfile, "optimized out");
break; break;
default: default:
fprintf (outfile, "botched symbol class %x", SYMBOL_CLASS (symbol)); fprintf_filtered (outfile, "botched symbol class %x",
SYMBOL_CLASS (symbol));
break; break;
} }
} }
fprintf (outfile, "\n"); fprintf_filtered (outfile, "\n");
return 1; return 1;
} }
@ -583,7 +628,7 @@ maintenance_print_psymbols (args, from_tty)
int from_tty; int from_tty;
{ {
char **argv; char **argv;
FILE *outfile; GDB_FILE *outfile;
struct cleanup *cleanups; struct cleanup *cleanups;
char *symname = NULL; char *symname = NULL;
char *filename = DEV_TTY; char *filename = DEV_TTY;
@ -615,7 +660,7 @@ maintenance_print_psymbols (args, from_tty)
filename = tilde_expand (filename); filename = tilde_expand (filename);
make_cleanup (free, filename); make_cleanup (free, filename);
outfile = fopen (filename, FOPEN_WT); outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0) if (outfile == 0)
perror_with_name (filename); perror_with_name (filename);
make_cleanup (fclose, outfile); make_cleanup (fclose, outfile);
@ -633,7 +678,7 @@ print_partial_symbol (p, count, what, outfile)
struct partial_symbol *p; struct partial_symbol *p;
int count; int count;
char *what; char *what;
FILE *outfile; GDB_FILE *outfile;
{ {
fprintf_filtered (outfile, " %s partial symbols:\n", what); fprintf_filtered (outfile, " %s partial symbols:\n", what);
@ -715,7 +760,10 @@ print_partial_symbol (p, count, what, outfile)
break; break;
} }
fputs_filtered (", ", outfile); 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++; p++;
} }
} }
@ -726,7 +774,7 @@ maintenance_print_msymbols (args, from_tty)
int from_tty; int from_tty;
{ {
char **argv; char **argv;
FILE *outfile; GDB_FILE *outfile;
struct cleanup *cleanups; struct cleanup *cleanups;
char *filename = DEV_TTY; char *filename = DEV_TTY;
char *symname = NULL; char *symname = NULL;
@ -757,7 +805,7 @@ maintenance_print_msymbols (args, from_tty)
filename = tilde_expand (filename); filename = tilde_expand (filename);
make_cleanup (free, filename); make_cleanup (free, filename);
outfile = fopen (filename, FOPEN_WT); outfile = gdb_fopen (filename, FOPEN_WT);
if (outfile == 0) if (outfile == 0)
perror_with_name (filename); perror_with_name (filename);
make_cleanup (fclose, outfile); make_cleanup (fclose, outfile);

View file

@ -460,7 +460,7 @@ print_floating (valaddr, type, stream)
/* Assume that floating point byte order is the same as /* Assume that floating point byte order is the same as
integer byte order. */ integer byte order. */
low = extract_unsigned_integer (valaddr, 4); low = extract_unsigned_integer (valaddr, 4);
nonnegative = low >= 0; nonnegative = ((low & 0x80000000) == 0);
is_nan = ((((low >> 23) & 0xFF) == 0xFF) is_nan = ((((low >> 23) & 0xFF) == 0xFF)
&& 0 != (low & 0x7FFFFF)); && 0 != (low & 0x7FFFFF));
low &= 0x7fffff; low &= 0x7fffff;
@ -479,7 +479,7 @@ print_floating (valaddr, type, stream)
low = extract_unsigned_integer (valaddr, 4); low = extract_unsigned_integer (valaddr, 4);
high = extract_unsigned_integer (valaddr + 4, 4); high = extract_unsigned_integer (valaddr + 4, 4);
#endif #endif
nonnegative = high >= 0; nonnegative = ((high & 0x80000000) == 0);
is_nan = (((high >> 20) & 0x7ff) == 0x7ff is_nan = (((high >> 20) & 0x7ff) == 0x7ff
&& ! ((((high & 0xfffff) == 0)) && (low == 0))); && ! ((((high & 0xfffff) == 0)) && (low == 0)));
high &= 0xfffff; 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 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 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 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 /* 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. */ 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 (bufptr < limit && *(bufptr - 1) != '\0');
} }
} while (errcode == 0 /* no error */ } while (errcode == 0 /* no error */
&& bufptr < buffer + fetchlimit /* no overrun */ && bufsize < fetchlimit /* no overrun */
&& !(len == 0 && *(bufptr - 1) == '\0')); /* no null term */ && !(len == 0 && *(bufptr - 1) == '\0')); /* no null term */
/* We now have either successfully filled the buffer to fetchlimit, or /* We now have either successfully filled the buffer to fetchlimit, or
@ -803,12 +804,13 @@ val_print_string (addr, len, stream)
{ {
if (errcode == EIO) if (errcode == EIO)
{ {
fprintf_filtered (stream, fprintf_filtered (stream, " <Address ");
" <Address 0x%lx out of bounds>", print_address_numeric (addr, stream);
(unsigned long) addr); fprintf_filtered (stream, " out of bounds>");
} }
else else
{ {
/* FIXME-32x64: assumes addr fits in a long. */
error ("Error reading memory address 0x%lx: %s.", error ("Error reading memory address 0x%lx: %s.",
(unsigned long) addr, (unsigned long) addr,
safe_strerror (errcode)); safe_strerror (errcode));

View file

@ -727,6 +727,7 @@ print_section_info (t, abfd)
{ {
struct section_table *p; struct section_table *p;
/* FIXME-32x64: Need a version of print_address_numeric with field width. */
printf_filtered ("\t`%s', ", bfd_get_filename(abfd)); printf_filtered ("\t`%s', ", bfd_get_filename(abfd));
wrap_here (" "); wrap_here (" ");
printf_filtered ("file type %s.\n", bfd_get_target(abfd)); printf_filtered ("file type %s.\n", bfd_get_target(abfd));