From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22244 invoked by alias); 4 Sep 2008 19:26:43 -0000 Received: (qmail 22076 invoked by uid 22791); 4 Sep 2008 19:26:40 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 04 Sep 2008 19:25:56 +0000 Received: from spaceape9.eur.corp.google.com (spaceape9.eur.corp.google.com [172.28.16.143]) by smtp-out.google.com with ESMTP id m84JPjic018449 for ; Thu, 4 Sep 2008 20:25:45 +0100 Received: from localhost (ruffy.corp.google.com [172.18.118.116]) by spaceape9.eur.corp.google.com with ESMTP id m84JPhex021958 for ; Thu, 4 Sep 2008 12:25:44 -0700 Received: by localhost (Postfix, from userid 67641) id 461661C7892; Thu, 4 Sep 2008 12:25:43 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [RFA] rename paddr_[du] to p{,u}longest Message-Id: <20080904192543.461661C7892@localhost> Date: Thu, 04 Sep 2008 19:26:00 -0000 From: dje@google.com (Doug Evans) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00068.txt.bz2 Hi. paddr_[du] claim to print addresses (CORE_ADDR) given their name but they are really intended to support printing {,U}LONGEST values. This patch renames them to plongest/pulongest, and changes the type of the unsigned printer from CORE_ADDR to ULONGEST to support printing 64 bit unsigned values when CORE_ADDR is 32-bits (decimal2str takes a ULONGEST parameter so there's no real reason why pulongest(/paddr_u) can't take a ULONGEST too). 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. Index: auxv.c =================================================================== RCS file: /cvs/src/src/gdb/auxv.c,v retrieving revision 1.12 diff -u -p -u -p -r1.12 auxv.c --- auxv.c 17 Jul 2008 20:56:11 -0000 1.12 +++ auxv.c 4 Sep 2008 19:06:39 -0000 @@ -229,11 +229,11 @@ fprint_target_auxv (struct ui_file *file } 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)); Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.233 diff -u -p -u -p -r1.233 defs.h --- defs.h 16 Aug 2008 20:36:29 -0000 1.233 +++ defs.h 4 Sep 2008 19:06:39 -0000 @@ -489,17 +489,19 @@ extern void gdb_print_host_address (cons 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); Index: gcore.c =================================================================== RCS file: /cvs/src/src/gdb/gcore.c,v retrieving revision 1.28 diff -u -p -u -p -r1.28 gcore.c --- gcore.c 20 Aug 2008 11:21:44 -0000 1.28 +++ gcore.c 4 Sep 2008 19:06:39 -0000 @@ -325,7 +325,7 @@ gcore_create_callback (CORE_ADDR vaddr, 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, 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 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)) Index: gdbarch.c =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.c,v retrieving revision 1.434 diff -u -p -u -p -r1.434 gdbarch.c --- gdbarch.c 26 Aug 2008 17:21:29 -0000 1.434 +++ gdbarch.c 4 Sep 2008 19:06:39 -0000 @@ -651,7 +651,7 @@ gdbarch_dump (struct gdbarch *gdbarch, s 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, s (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, s 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, s (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, s (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, s (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, s (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, s (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, s (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, s 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, s (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, s (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, s (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, s (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, s (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, s (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, s (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)); Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.475 diff -u -p -u -p -r1.475 gdbarch.sh --- gdbarch.sh 26 Aug 2008 17:21:29 -0000 1.475 +++ gdbarch.sh 4 Sep 2008 19:06:39 -0000 @@ -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_B # 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" Index: ia64-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ia64-tdep.c,v retrieving revision 1.182 diff -u -p -u -p -r1.182 ia64-tdep.c --- ia64-tdep.c 2 Sep 2008 09:32:56 -0000 1.182 +++ ia64-tdep.c 4 Sep 2008 19:06:39 -0000 @@ -2396,7 +2396,7 @@ get_kernel_table (unw_word_t ip, unw_dyn "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 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 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)); } Index: maint.c =================================================================== RCS file: /cvs/src/src/gdb/maint.c,v retrieving revision 1.65 diff -u -p -u -p -r1.65 maint.c --- maint.c 29 Aug 2008 18:31:34 -0000 1.65 +++ maint.c 4 Sep 2008 19:06:39 -0000 @@ -485,7 +485,7 @@ maintenance_translate_address (char *arg 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 Index: remote-mips.c =================================================================== RCS file: /cvs/src/src/gdb/remote-mips.c,v retrieving revision 1.89 diff -u -p -u -p -r1.89 remote-mips.c --- remote-mips.c 26 Aug 2008 17:21:29 -0000 1.89 +++ remote-mips.c 4 Sep 2008 19:06:40 -0000 @@ -2620,7 +2620,7 @@ send_srec (char *srec, int len, CORE_ADD 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); Index: target.c =================================================================== RCS file: /cvs/src/src/gdb/target.c,v retrieving revision 1.177 diff -u -p -u -p -r1.177 target.c --- target.c 26 Aug 2008 17:21:29 -0000 1.177 +++ target.c 4 Sep 2008 19:06:40 -0000 @@ -1173,7 +1173,7 @@ target_xfer_partial (struct target_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"); Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.193 diff -u -p -u -p -r1.193 utils.c --- utils.c 13 Jul 2008 11:28:31 -0000 1.193 +++ utils.c 4 Sep 2008 19:06:43 -0000 @@ -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. */