public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/15121] New: x/a broken for addresses in shared libraries
@ 2013-02-08  2:12 ppluzhnikov at google dot com
  2015-09-05 17:55 ` [Bug gdb/15121] " ppluzhnikov at google dot com
  2023-05-13 23:47 ` ppluzhnikov at google dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ppluzhnikov at google dot com @ 2013-02-08  2:12 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15121

             Bug #: 15121
           Summary: x/a broken for addresses in shared libraries
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: ppluzhnikov@google.com
    Classification: Unclassified


x/a used to print symbol name regardless of whether the address was in main
executable or a shared library. It no longer does. I noticed that around 7.4
release, confirmed in  7.5.50.20130208-cvs.


Test:

// t.c
int main ()
{
  return bar ();
}

// foo.c
#include <stdlib.h>

int foo ()
{
  abort ();
}

int baz ()
{
  return foo ();
}

int bar ()
{
  return baz ();
}


gcc -m32 -g -fPIC -shared -o foo.so foo.c
gcc -m32 -g t.c ./foo.so

gdb ./a.out
(gdb) run
Starting program: /tmp/a.out 

Program received signal SIGABRT, Aborted.
0xf7fdb430 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fdb430 in __kernel_vsyscall ()
#1  0xf7e3b1df in __GI_raise (sig=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xf7e3e825 in __GI_abort () at abort.c:91
#3  0xf7fd64d3 in foo () at foo.c:5
#4  0xf7fd64ea in baz () at foo.c:10
#5  0xf7fd6507 in bar () at foo.c:15
#6  0x080484af in main () at t.c:3
(gdb) fr 3
#3  0xf7fd64d3 in foo () at foo.c:5
5         abort ();
(gdb) x/2a $ebp
0xffffc708:     0xffffc718      0xf7fd64ea    << why no symbol?
(gdb) up
#4  0xf7fd64ea in baz () at foo.c:10
10        return foo ();
(gdb) x/2a $ebp
0xffffc718:     0xffffc728      0xf7fd6507    << why no symbol?
(gdb) up
#5  0xf7fd6507 in bar () at foo.c:15
15        return baz ();
(gdb) x/2a $ebp
0xffffc728:     0xffffc738      0x80484af <main+11>  << symbol ok
(gdb) 

GDB clearly knows what 0xf7fd64ea and 0xf7fd6507 are:

(gdb) p/a 0xf7fd64ea
$2 = 0xf7fd64ea <baz+23>
(gdb) p/a 0xf7fd6507
$3 = 0xf7fd6507 <bar+23>

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/15121] x/a broken for addresses in shared libraries
  2013-02-08  2:12 [Bug gdb/15121] New: x/a broken for addresses in shared libraries ppluzhnikov at google dot com
@ 2015-09-05 17:55 ` ppluzhnikov at google dot com
  2023-05-13 23:47 ` ppluzhnikov at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ppluzhnikov at google dot com @ 2015-09-05 17:55 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15121

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |ppluzhnikov at google dot com

--- Comment #1 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
The problem only happens when a 64-bit GDB is debugging 32-bit program (which
is probably why this hasn't been bothering everyone else for the last 5 years).

The problem is that unpack_pointer() sign-extends the returned value from
0xf7fd65e6 to 0xfffffffff7fd65e6 here:

#0  unpack_pointer (type=0xf4dea0, valaddr=0xfb0ea0 "\370\323\377\377") at
../../gdb/value.c:2931
#1  0x00000000005de455 in print_scalar_formatted (valaddr=0xfb0ea0,
type=0xf4dea0, options=0x7fffffffdc00, size=119, stream=0xefd6a0) at
../../gdb/printcmd.c:445
#2  0x00000000005d9b09 in val_print_scalar_formatted (type=0xf4dea0,
valaddr=0xfb0ea0 "\370\323\377\377", embedded_offset=0, val=0xf80570,
options=0x7fffffffdc00, size=119, stream=0xefd6a0) at ../../gdb/valprint.c:1205
#3  0x00000000005ddf4e in print_formatted (val=0xf80570, size=119,
options=0x7fffffffdc00, stream=0xefd6a0) at ../../gdb/printcmd.c:319
#4  0x00000000005df280 in do_examine (fmt=..., gdbarch=0xf49eb0,
addr=4294956008) at ../../gdb/printcmd.c:907
#5  0x00000000005e0a2c in x_command (exp=0xd5f195 "", from_tty=1) at
../../gdb/printcmd.c:1467

Subsequent find_pc_section() calls on 0xfffffffff7fd65e6 fail (naturally).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug gdb/15121] x/a broken for addresses in shared libraries
  2013-02-08  2:12 [Bug gdb/15121] New: x/a broken for addresses in shared libraries ppluzhnikov at google dot com
  2015-09-05 17:55 ` [Bug gdb/15121] " ppluzhnikov at google dot com
@ 2023-05-13 23:47 ` ppluzhnikov at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ppluzhnikov at google dot com @ 2023-05-13 23:47 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15121

--- Comment #3 from Paul Pluzhnikov <ppluzhnikov at google dot com> ---
Reconfirmed using 14.0.50.20230513-git

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-05-13 23:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08  2:12 [Bug gdb/15121] New: x/a broken for addresses in shared libraries ppluzhnikov at google dot com
2015-09-05 17:55 ` [Bug gdb/15121] " ppluzhnikov at google dot com
2023-05-13 23:47 ` ppluzhnikov at google dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).