+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.
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)
{
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;
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 ");
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");
}
}
\f
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);
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);
}
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)));
}
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
}
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);
}
}
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
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);
}
int status;
CORE_ADDR memaddr;
{
-
+ /* FIXME-32x64--casting CORE_ADDR to unsigned long */
if (status == EIO)
{
/* Actually, address between memaddr and memaddr + len
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,
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));
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 *));
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 ();
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",
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");
{
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");
{
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))
{
}
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)
{
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);
{
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;
/* 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)");
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"));
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;
}
/* 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;
}
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
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, " ");
}
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, "");
+ }
}
\f
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);
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:
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:
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:
}
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. */
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");
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 (" ");
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);
}
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)
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;
}
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);
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)
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)
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)
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);
}
/* 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 *));
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 *));
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)
{
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! ");
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! ");
static void
dump_msymbols (objfile, outfile)
struct objfile *objfile;
- FILE *outfile;
+ GDB_FILE *outfile;
{
struct minimal_symbol *msymbol;
int index;
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)
{
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)
dump_symtab (objfile, symtab, outfile)
struct objfile *objfile;
struct symtab *symtab;
- FILE *outfile;
+ GDB_FILE *outfile;
{
register int i, j;
int len, blen;
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++)
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++)
{
RETURN_MASK_ERROR);
}
}
- fprintf (outfile, "\n");
+ fprintf_filtered (outfile, "\n");
}
void
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *symname = NULL;
char *filename = DEV_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);
{
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
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. */
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;
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;
}
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *symname = NULL;
char *filename = DEV_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);
struct partial_symbol *p;
int count;
char *what;
- FILE *outfile;
+ GDB_FILE *outfile;
{
fprintf_filtered (outfile, " %s partial symbols:\n", what);
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++;
}
}
int from_tty;
{
char **argv;
- FILE *outfile;
+ GDB_FILE *outfile;
struct cleanup *cleanups;
char *filename = DEV_TTY;
char *symname = NULL;
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);
/* 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;
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;
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. */
} 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
{
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));
{
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));