From 623d3eb139cf841da1f6fd08c68c29b12b74ddb0 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 4 Sep 2008 22:49:30 +0000 Subject: [PATCH] * defs.h (plongest,pulongest): Renamed from paddr_u,paddr_d. Change argument of pulongest from CORE_ADDR to ULONGEST. All callers updated. * utils.c (plongest): Renamed from paddr_d. (pulongest): Renamed from paddr_u, change arg type to ULONGEST. * remote-mips.c (send_srec): Use paddr_nz instead of paddr_u in `CORE_ADDR addr' arg of error message. --- gdb/ChangeLog | 10 ++++++++ gdb/auxv.c | 4 +-- gdb/defs.h | 10 +++++--- gdb/gcore.c | 6 ++--- gdb/gdbarch.c | 62 +++++++++++++++++++++++------------------------ gdb/gdbarch.sh | 6 ++--- gdb/ia64-tdep.c | 6 ++--- gdb/maint.c | 2 +- gdb/remote-mips.c | 2 +- gdb/target.c | 4 +-- gdb/utils.c | 12 ++++----- 11 files changed, 68 insertions(+), 56 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9f8b83c282..ab6b1c74a47 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2008-09-04 Doug Evans + + * defs.h (plongest,pulongest): Renamed from paddr_u,paddr_d. + Change argument of pulongest from CORE_ADDR to ULONGEST. + All callers updated. + * utils.c (plongest): Renamed from paddr_d. + (pulongest): Renamed from paddr_u, change arg type to ULONGEST. + * remote-mips.c (send_srec): Use paddr_nz instead of paddr_u in + `CORE_ADDR addr' arg of error message. + 2008-09-03 Angela Marie Thomas * ser-tcp.c (ser_tcp_send_break): New function. diff --git a/gdb/auxv.c b/gdb/auxv.c index 549b666cb3c..0baec1a7bf7 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -229,11 +229,11 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops) } fprintf_filtered (file, "%-4s %-20s %-30s ", - paddr_d (type), name, description); + plongest (type), name, description); switch (flavor) { case dec: - fprintf_filtered (file, "%s\n", paddr_d (val)); + fprintf_filtered (file, "%s\n", plongest (val)); break; case hex: fprintf_filtered (file, "0x%s\n", paddr_nz (val)); diff --git a/gdb/defs.h b/gdb/defs.h index 0521ec7c9d7..e5990c7c880 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -489,17 +489,19 @@ extern void gdb_print_host_address (const void *addr, struct ui_file *stream); extern const char *host_address_to_string (const void *addr); /* Convert a CORE_ADDR into a HEX string. paddr() is like %08lx. - paddr_nz() is like %lx. paddr_u() is like %lu. paddr_width() is - for ``%*''. */ + paddr_nz() is like %lx. */ extern int strlen_paddr (void); extern char *paddr (CORE_ADDR addr); extern char *paddr_nz (CORE_ADDR addr); -extern char *paddr_u (CORE_ADDR addr); -extern char *paddr_d (LONGEST addr); /* Like 0x%lx. */ extern const char *paddress (CORE_ADDR addr); +/* %d for LONGEST */ +extern char *plongest (LONGEST l); +/* %u for ULONGEST */ +extern char *pulongest (ULONGEST l); + extern char *phex (ULONGEST l, int sizeof_l); extern char *phex_nz (ULONGEST l, int sizeof_l); extern char *int_string (LONGEST, int, int, int, int); diff --git a/gdb/gcore.c b/gdb/gcore.c index 7c69e4bee4a..2784a5e03da 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -325,7 +325,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, if (info_verbose) { fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at 0x%s\n", - paddr_d (size), paddr_nz (vaddr)); + plongest (size), paddr_nz (vaddr)); } return 0; @@ -383,7 +383,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, if (info_verbose) { fprintf_filtered (gdb_stdout, "Save segment, %s bytes at 0x%s\n", - paddr_d (size), paddr_nz (vaddr)); + plongest (size), paddr_nz (vaddr)); } bfd_set_section_size (obfd, osec, size); @@ -476,7 +476,7 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) memhunk, size) != 0) { warning (_("Memory read failed for corefile section, %s bytes at 0x%s."), - paddr_d (size), paddr (bfd_section_vma (obfd, osec))); + plongest (size), paddr (bfd_section_vma (obfd, osec))); break; } if (!bfd_set_section_contents (obfd, osec, memhunk, offset, size)) diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index aa5063e1102..c41d1ce3f21 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -651,7 +651,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) gdb_nm_file); fprintf_unfiltered (file, "gdbarch_dump: addr_bit = %s\n", - paddr_d (gdbarch->addr_bit)); + plongest (gdbarch->addr_bit)); fprintf_unfiltered (file, "gdbarch_dump: addr_bits_remove = <0x%lx>\n", (long) gdbarch->addr_bits_remove); @@ -684,37 +684,37 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->adjust_breakpoint_address); fprintf_unfiltered (file, "gdbarch_dump: believe_pcc_promotion = %s\n", - paddr_d (gdbarch->believe_pcc_promotion)); + plongest (gdbarch->believe_pcc_promotion)); fprintf_unfiltered (file, "gdbarch_dump: bfd_arch_info = %s\n", gdbarch_bfd_arch_info (gdbarch)->printable_name); fprintf_unfiltered (file, "gdbarch_dump: bits_big_endian = %s\n", - paddr_d (gdbarch->bits_big_endian)); + plongest (gdbarch->bits_big_endian)); fprintf_unfiltered (file, "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n", (long) gdbarch->breakpoint_from_pc); fprintf_unfiltered (file, "gdbarch_dump: byte_order = %s\n", - paddr_d (gdbarch->byte_order)); + plongest (gdbarch->byte_order)); fprintf_unfiltered (file, "gdbarch_dump: byte_order_for_code = %s\n", - paddr_d (gdbarch->byte_order_for_code)); + plongest (gdbarch->byte_order_for_code)); fprintf_unfiltered (file, "gdbarch_dump: call_dummy_location = %s\n", - paddr_d (gdbarch->call_dummy_location)); + plongest (gdbarch->call_dummy_location)); fprintf_unfiltered (file, "gdbarch_dump: cannot_fetch_register = <0x%lx>\n", (long) gdbarch->cannot_fetch_register); fprintf_unfiltered (file, "gdbarch_dump: cannot_step_breakpoint = %s\n", - paddr_d (gdbarch->cannot_step_breakpoint)); + plongest (gdbarch->cannot_step_breakpoint)); fprintf_unfiltered (file, "gdbarch_dump: cannot_store_register = <0x%lx>\n", (long) gdbarch->cannot_store_register); fprintf_unfiltered (file, "gdbarch_dump: char_signed = %s\n", - paddr_d (gdbarch->char_signed)); + plongest (gdbarch->char_signed)); fprintf_unfiltered (file, "gdbarch_dump: coff_make_msymbol_special = <0x%lx>\n", (long) gdbarch->coff_make_msymbol_special); @@ -747,7 +747,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) paddr_nz (gdbarch->decr_pc_after_break)); fprintf_unfiltered (file, "gdbarch_dump: deprecated_fp_regnum = %s\n", - paddr_d (gdbarch->deprecated_fp_regnum)); + plongest (gdbarch->deprecated_fp_regnum)); fprintf_unfiltered (file, "gdbarch_dump: deprecated_function_start_offset = 0x%s\n", paddr_nz (gdbarch->deprecated_function_start_offset)); @@ -771,7 +771,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->displaced_step_location); fprintf_unfiltered (file, "gdbarch_dump: double_bit = %s\n", - paddr_d (gdbarch->double_bit)); + plongest (gdbarch->double_bit)); fprintf_unfiltered (file, "gdbarch_dump: double_format = %s\n", pformat (gdbarch->double_format)); @@ -804,13 +804,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->fetch_tls_load_module_address); fprintf_unfiltered (file, "gdbarch_dump: float_bit = %s\n", - paddr_d (gdbarch->float_bit)); + plongest (gdbarch->float_bit)); fprintf_unfiltered (file, "gdbarch_dump: float_format = %s\n", pformat (gdbarch->float_format)); fprintf_unfiltered (file, "gdbarch_dump: fp0_regnum = %s\n", - paddr_d (gdbarch->fp0_regnum)); + plongest (gdbarch->fp0_regnum)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_frame_align_p() = %d\n", gdbarch_frame_align_p (gdbarch)); @@ -828,7 +828,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->frame_num_args); fprintf_unfiltered (file, "gdbarch_dump: frame_red_zone_size = %s\n", - paddr_d (gdbarch->frame_red_zone_size)); + plongest (gdbarch->frame_red_zone_size)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n", gdbarch_get_longjmp_target_p (gdbarch)); @@ -837,7 +837,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->get_longjmp_target); fprintf_unfiltered (file, "gdbarch_dump: have_nonsteppable_watchpoint = %s\n", - paddr_d (gdbarch->have_nonsteppable_watchpoint)); + plongest (gdbarch->have_nonsteppable_watchpoint)); fprintf_unfiltered (file, "gdbarch_dump: in_function_epilogue_p = <0x%lx>\n", (long) gdbarch->in_function_epilogue_p); @@ -849,7 +849,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->inner_than); fprintf_unfiltered (file, "gdbarch_dump: int_bit = %s\n", - paddr_d (gdbarch->int_bit)); + plongest (gdbarch->int_bit)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n", gdbarch_integer_to_address_p (gdbarch)); @@ -858,22 +858,22 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->integer_to_address); fprintf_unfiltered (file, "gdbarch_dump: long_bit = %s\n", - paddr_d (gdbarch->long_bit)); + plongest (gdbarch->long_bit)); fprintf_unfiltered (file, "gdbarch_dump: long_double_bit = %s\n", - paddr_d (gdbarch->long_double_bit)); + plongest (gdbarch->long_double_bit)); fprintf_unfiltered (file, "gdbarch_dump: long_double_format = %s\n", pformat (gdbarch->long_double_format)); fprintf_unfiltered (file, "gdbarch_dump: long_long_bit = %s\n", - paddr_d (gdbarch->long_long_bit)); + plongest (gdbarch->long_long_bit)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_max_insn_length_p() = %d\n", gdbarch_max_insn_length_p (gdbarch)); fprintf_unfiltered (file, "gdbarch_dump: max_insn_length = %s\n", - paddr_d (gdbarch->max_insn_length)); + plongest (gdbarch->max_insn_length)); fprintf_unfiltered (file, "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n", (long) gdbarch->memory_insert_breakpoint); @@ -885,13 +885,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) gdbarch->name_of_malloc); fprintf_unfiltered (file, "gdbarch_dump: num_pseudo_regs = %s\n", - paddr_d (gdbarch->num_pseudo_regs)); + plongest (gdbarch->num_pseudo_regs)); fprintf_unfiltered (file, "gdbarch_dump: num_regs = %s\n", - paddr_d (gdbarch->num_regs)); + plongest (gdbarch->num_regs)); fprintf_unfiltered (file, "gdbarch_dump: osabi = %s\n", - paddr_d (gdbarch->osabi)); + plongest (gdbarch->osabi)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_overlay_update_p() = %d\n", gdbarch_overlay_update_p (gdbarch)); @@ -900,7 +900,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->overlay_update); fprintf_unfiltered (file, "gdbarch_dump: pc_regnum = %s\n", - paddr_d (gdbarch->pc_regnum)); + plongest (gdbarch->pc_regnum)); fprintf_unfiltered (file, "gdbarch_dump: pointer_to_address = <0x%lx>\n", (long) gdbarch->pointer_to_address); @@ -924,7 +924,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->print_vector_info); fprintf_unfiltered (file, "gdbarch_dump: ps_regnum = %s\n", - paddr_d (gdbarch->ps_regnum)); + plongest (gdbarch->ps_regnum)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n", gdbarch_pseudo_register_read_p (gdbarch)); @@ -939,7 +939,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->pseudo_register_write); fprintf_unfiltered (file, "gdbarch_dump: ptr_bit = %s\n", - paddr_d (gdbarch->ptr_bit)); + plongest (gdbarch->ptr_bit)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n", gdbarch_push_dummy_call_p (gdbarch)); @@ -1002,7 +1002,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->sdb_reg_to_regnum); fprintf_unfiltered (file, "gdbarch_dump: short_bit = %s\n", - paddr_d (gdbarch->short_bit)); + plongest (gdbarch->short_bit)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n", gdbarch_single_step_through_delay_p (gdbarch)); @@ -1041,10 +1041,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->software_single_step); fprintf_unfiltered (file, "gdbarch_dump: sofun_address_maybe_missing = %s\n", - paddr_d (gdbarch->sofun_address_maybe_missing)); + plongest (gdbarch->sofun_address_maybe_missing)); fprintf_unfiltered (file, "gdbarch_dump: sp_regnum = %s\n", - paddr_d (gdbarch->sp_regnum)); + plongest (gdbarch->sp_regnum)); fprintf_unfiltered (file, "gdbarch_dump: stab_reg_to_regnum = <0x%lx>\n", (long) gdbarch->stab_reg_to_regnum); @@ -1059,7 +1059,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->static_transform_name); fprintf_unfiltered (file, "gdbarch_dump: target_desc = %s\n", - paddr_d ((long) gdbarch->target_desc)); + plongest ((long) gdbarch->target_desc)); fprintf_unfiltered (file, "gdbarch_dump: target_signal_from_host = <0x%lx>\n", (long) gdbarch->target_signal_from_host); @@ -1086,13 +1086,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) gdbarch->value_to_register); fprintf_unfiltered (file, "gdbarch_dump: vbit_in_delta = %s\n", - paddr_d (gdbarch->vbit_in_delta)); + plongest (gdbarch->vbit_in_delta)); fprintf_unfiltered (file, "gdbarch_dump: virtual_frame_pointer = <0x%lx>\n", (long) gdbarch->virtual_frame_pointer); fprintf_unfiltered (file, "gdbarch_dump: vtable_function_descriptors = %s\n", - paddr_d (gdbarch->vtable_function_descriptors)); + plongest (gdbarch->vtable_function_descriptors)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_write_pc_p() = %d\n", gdbarch_write_pc_p (gdbarch)); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 156311e89b1..82f68f03dc5 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -318,7 +318,7 @@ do # An optional expression that convers MEMBER to a value # suitable for formatting using %s. - # If PRINT is empty, paddr_nz (for CORE_ADDR) or paddr_d + # If PRINT is empty, paddr_nz (for CORE_ADDR) or plongest # (anything else) is used. garbage_at_eol ) : ;; @@ -343,7 +343,7 @@ i:int:byte_order_for_code:::BFD_ENDIAN_BIG # i:enum gdb_osabi:osabi:::GDB_OSABI_UNKNOWN # -i:const struct target_desc *:target_desc:::::::paddr_d ((long) gdbarch->target_desc) +i:const struct target_desc *:target_desc:::::::plongest ((long) gdbarch->target_desc) # The bit byte-order has to do just with numbering of bits in debugging symbols # and such. Conceptually, it's quite separate from byte/word byte order. @@ -1479,7 +1479,7 @@ do ;; :* ) fmt="%s" - print="paddr_d (gdbarch->${function})" + print="plongest (gdbarch->${function})" ;; * ) fmt="%s" diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 1302741f51b..df5f43adc3e 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2396,7 +2396,7 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) "segbase=0x%s, length=%s, gp=0x%s\n", (char *) di->u.ti.name_ptr, paddr_nz (di->u.ti.segbase), - paddr_u (di->u.ti.table_len), + pulongest (di->u.ti.table_len), paddr_nz (di->gp)); return 0; } @@ -2505,7 +2505,7 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, paddr_nz (di.u.ti.segbase), paddr_nz (di.start_ip), paddr_nz (di.end_ip), paddr_nz (di.gp), - paddr_u (di.u.ti.table_len), + pulongest (di.u.ti.table_len), paddr_nz ((CORE_ADDR)di.u.ti.table_data)); } else @@ -2522,7 +2522,7 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, paddr_nz (di.u.rti.segbase), paddr_nz (di.start_ip), paddr_nz (di.end_ip), paddr_nz (di.gp), - paddr_u (di.u.rti.table_len), + pulongest (di.u.rti.table_len), paddr_nz (di.u.rti.table_data)); } diff --git a/gdb/maint.c b/gdb/maint.c index 3190bd767f0..b223f25801b 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -485,7 +485,7 @@ maintenance_translate_address (char *arg, int from_tty) if (sym) printf_filtered ("%s+%s\n", SYMBOL_PRINT_NAME (sym), - paddr_u (address - SYMBOL_VALUE_ADDRESS (sym))); + pulongest (address - SYMBOL_VALUE_ADDRESS (sym))); else if (sect) printf_filtered (_("no symbol at %s:0x%s\n"), sect->name, paddr (address)); else diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 9b8ca0bf24f..bde8614a7b9 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2620,7 +2620,7 @@ send_srec (char *srec, int len, CORE_ADDR addr) case 0x6: /* ACK */ return; case 0x15: /* NACK */ - fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte %s! Retrying.\n", paddr_u (addr)); + fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte 0x%s! Retrying.\n", paddr_nz (addr)); continue; default: error ("Download got unexpected ack char: 0x%x, retrying.\n", ch); diff --git a/gdb/target.c b/gdb/target.c index edd804dc50b..9dd8f3e5307 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1173,7 +1173,7 @@ target_xfer_partial (struct target_ops *ops, (int) object, (annex ? annex : "(null)"), (long) readbuf, (long) writebuf, - paddr_nz (offset), paddr_d (len), paddr_d (retval)); + paddr_nz (offset), plongest (len), plongest (retval)); if (readbuf) myaddr = readbuf; @@ -2566,7 +2566,7 @@ debug_print_register (const char * func, { ULONGEST val = extract_unsigned_integer (buf, size); fprintf_unfiltered (gdb_stdlog, " 0x%s %s", - paddr_nz (val), paddr_d (val)); + paddr_nz (val), plongest (val)); } } fprintf_unfiltered (gdb_stdlog, "\n"); diff --git a/gdb/utils.c b/gdb/utils.c index c787dd044d3..4aa33676504 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2676,18 +2676,18 @@ octal2str (ULONGEST addr, int width) } char * -paddr_u (CORE_ADDR addr) +pulongest (ULONGEST u) { - return decimal2str ("", addr, 0); + return decimal2str ("", u, 0); } char * -paddr_d (LONGEST addr) +plongest (LONGEST l) { - if (addr < 0) - return decimal2str ("-", -addr, 0); + if (l < 0) + return decimal2str ("-", -l, 0); else - return decimal2str ("", addr, 0); + return decimal2str ("", l, 0); } /* Eliminate warning from compiler on 32-bit systems. */ -- 2.30.2