Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Proposed fix to gdb for printing 64-bit addresses on AIX
@ 2002-04-29 11:16 Brian Taylor
  2002-05-04 20:08 ` Andrew Cagney
  2002-05-07  6:19 ` [RFC] Re: Proposed fix to gdb for printing 64-bit addresses Michal Ludvig
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Taylor @ 2002-04-29 11:16 UTC (permalink / raw)
  To: gdb-patches

Problem:
64-bit addresses reported by 'info break' and 'backtrace' are truncated 
when debugging a 64-bit executable on AIX 4.3.

ChangeLog entry:
2002-04-29  Brian Taylor  <briant@model.com>

        * ui-out.c (ui_out_field_core_addr): Use the function
        'longest_local_hex_string_custom' to format addresses > 32 bits 
wide.


Diff between OLD (5.1.1) version and NEW version:
diff -cp ui-out.c.orig ui-out.c
*** ui-out.c.orig       Thu Jul  5 20:53:11 2001
--- ui-out.c    Mon Apr 29 11:11:29 2002
*************** ui_out_field_core_addr (struct ui_out *u
*** 457,467 ****
                        const char *fldname,
                        CORE_ADDR address)
  {
!   char addstr[20];

!   /* FIXME-32x64: need a print_address_numeric with field width */
!   /* print_address_numeric (address, 1, local_stream); */
!   strcpy (addstr, local_hex_string_custom ((unsigned long) address, 
"08l"));

    ui_out_field_string (uiout, fldname, addstr);
  }
--- 457,469 ----
                        const char *fldname,
                        CORE_ADDR address)
  {
!   /* Modified to print 64 bit addresses for powerpc-ibm-aix4.3.2.0 */
!   char addstr[50];

!   if (TARGET_ADDR_BIT <= 32)
!     strcpy (addstr, local_hex_string_custom ((unsigned long) address, 
"08l"));!   else
!     strcpy (addstr, longest_local_hex_string_custom (address, "016l"));

    ui_out_field_string (uiout, fldname, addstr);
  }


-- 
Brian Taylor                          Model Technology
Staff Engineer                        10450 SW Nimbus Ave., Bldg. R-b
briant@model.com                      Portland, OR 97223-4347
Phone: (503) 526-3042                 Fax: (503) 526-5473



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Proposed fix to gdb for printing 64-bit addresses on AIX
  2002-04-29 11:16 Proposed fix to gdb for printing 64-bit addresses on AIX Brian Taylor
@ 2002-05-04 20:08 ` Andrew Cagney
  2002-05-07  6:19 ` [RFC] Re: Proposed fix to gdb for printing 64-bit addresses Michal Ludvig
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-05-04 20:08 UTC (permalink / raw)
  To: Brian Taylor; +Cc: gdb-patches

> Problem:
> 64-bit addresses reported by 'info break' and 'backtrace' are truncated when debugging a 64-bit executable on AIX 4.3.
> 
> ChangeLog entry:
> 2002-04-29  Brian Taylor  <briant@model.com>
> 
>        * ui-out.c (ui_out_field_core_addr): Use the function
>        'longest_local_hex_string_custom' to format addresses > 32 bits wide.
> 
I'm just checking this in....

Thanks!
Andrew




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC] Re: Proposed fix to gdb for printing 64-bit addresses
  2002-04-29 11:16 Proposed fix to gdb for printing 64-bit addresses on AIX Brian Taylor
  2002-05-04 20:08 ` Andrew Cagney
@ 2002-05-07  6:19 ` Michal Ludvig
  2002-05-07  7:56   ` Daniel Jacobowitz
  1 sibling, 1 reply; 6+ messages in thread
From: Michal Ludvig @ 2002-05-07  6:19 UTC (permalink / raw)
  To: Brian Taylor; +Cc: gdb-patches, Andrew Cagney

Hi,
unfortunately this produces quite ugly output on x86-64 where the 
debugged code usually lives on low addresses and thus the PC is 
prepended with a long string of zeros. Now:
#0  0x00000000004000d3 in cpyptrs () at dwarf.c:11
#1  0x00000000004000f8 in func () at dwarf.c:19

I propose to change the format string from "016l" to just "l" so that 
only valid digits will be printed:
#0  0x4000d3 in cpyptrs () at dwarf.c:11
#1  0x4000f8 in func () at dwarf.c:19

Than there is no need for different handling of 32/64b archs.

Comments?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz

Brian Taylor wrote:
> Problem:
> 64-bit addresses reported by 'info break' and 'backtrace' are truncated 
> when debugging a 64-bit executable on AIX 4.3.
> 
> ChangeLog entry:
> 2002-04-29  Brian Taylor  <briant@model.com>
> 
>        * ui-out.c (ui_out_field_core_addr): Use the function
>        'longest_local_hex_string_custom' to format addresses > 32 bits 
> wide.
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Re: Proposed fix to gdb for printing 64-bit addresses
  2002-05-07  6:19 ` [RFC] Re: Proposed fix to gdb for printing 64-bit addresses Michal Ludvig
@ 2002-05-07  7:56   ` Daniel Jacobowitz
  2002-05-07  8:54     ` Michal Ludvig
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2002-05-07  7:56 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: Brian Taylor, gdb-patches, Andrew Cagney

On Tue, May 07, 2002 at 03:19:02PM +0200, Michal Ludvig wrote:
> Hi,
> unfortunately this produces quite ugly output on x86-64 where the 
> debugged code usually lives on low addresses and thus the PC is 
> prepended with a long string of zeros. Now:
> #0  0x00000000004000d3 in cpyptrs () at dwarf.c:11
> #1  0x00000000004000f8 in func () at dwarf.c:19
> 
> I propose to change the format string from "016l" to just "l" so that 
> only valid digits will be printed:
> #0  0x4000d3 in cpyptrs () at dwarf.c:11
> #1  0x4000f8 in func () at dwarf.c:19
> 
> Than there is no need for different handling of 32/64b archs.
> 
> Comments?

I'd rather not do that, actually; I find it very confusing when a
seven-digit hex number is printed (I assume it is an eight-digit one). 
It might be appropriate to print just eight digits of low 64-bit
addresses...  I don't feel too strongly about this issue, though.

Anyone else have an opinion?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Re: Proposed fix to gdb for printing 64-bit addresses
  2002-05-07  7:56   ` Daniel Jacobowitz
@ 2002-05-07  8:54     ` Michal Ludvig
  2002-05-07 10:49       ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Ludvig @ 2002-05-07  8:54 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz wrote:
> On Tue, May 07, 2002 at 03:19:02PM +0200, Michal Ludvig wrote:
>>I propose to change the format string from "016l" to just "l" so that 
>>only valid digits will be printed:
>>#0  0x4000d3 in cpyptrs () at dwarf.c:11
>>#1  0x4000f8 in func () at dwarf.c:19
> 
> I'd rather not do that, actually; I find it very confusing when a
> seven-digit hex number is printed (I assume it is an eight-digit one). 
> It might be appropriate to print just eight digits of low 64-bit
> addresses...  I don't feel too strongly about this issue, though.

So what about changing 'strcpy(addstr, local_hex_string_custom((unsigned 
long) address, "016l"))' to 'sprintf(addstr, "%010p", address)' ?
This would print _at_least_ 8 digits, but wouldn't cut it down when the 
number is longer.

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] Re: Proposed fix to gdb for printing 64-bit addresses
  2002-05-07  8:54     ` Michal Ludvig
@ 2002-05-07 10:49       ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2002-05-07 10:49 UTC (permalink / raw)
  To: Michal Ludvig; +Cc: gdb-patches

> Than there is no need for different handling of 32/64b archs.


Hmm, what interesting timing, note the patch:


http://sources.redhat.com/ml/gdb-patches/2002-05/msg00114.html

in particular:

> There are, I think, several good follow-on patches:
> 
> 	local_address_string{,_custom}()
> 		to handle the address case
> 		Get rid of all those if (TARGET_ADDR_BIT) ... else ...
> 

[I'm not the cli maintainer so it isn't my call]

I suspect it would be better to retain the current behavour - print all 
TARGET_ADDR_BITs of a core address but then let the user override that 
using a ``set ...'' command (like `set output-radix').  If there is a 
``local_address_string()'' function then that is much easier.

Part of the intent of ui_out_field_core_addr() was to address this - 
have one place determining the way that addresses were displayed so that 
it could be changed uniformly across all of GDB.

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-05-07 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-29 11:16 Proposed fix to gdb for printing 64-bit addresses on AIX Brian Taylor
2002-05-04 20:08 ` Andrew Cagney
2002-05-07  6:19 ` [RFC] Re: Proposed fix to gdb for printing 64-bit addresses Michal Ludvig
2002-05-07  7:56   ` Daniel Jacobowitz
2002-05-07  8:54     ` Michal Ludvig
2002-05-07 10:49       ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox