public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/27021] New: Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer': when using pretty-printer
@ 2020-12-05  7:35 ppluzhnikov at google dot com
  2020-12-05 16:40 ` [Bug python/27021] " ppluzhnikov at google dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ppluzhnikov at google dot com @ 2020-12-05  7:35 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27021
           Summary: Python Exception <class 'AttributeError'> 'NoneType'
                    object has no attribute 'pointer': when using
                    pretty-printer
           Product: gdb
           Version: 9.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: ppluzhnikov at google dot com
  Target Milestone: ---

Not sure whether this reproduces at head, but suspect it does.

gdb ./a.out core.111836 
GNU gdb (GDB) Fedora 9.1-6.fc32
...

Reading symbols from ./a.out...
[New LWP 111836]
Core was generated by `./a.out'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f8589eb89e5 in raise () from /lib64/libc.so.6

Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.31-4.fc32.x86_64 libgcc-10.2.1-6.fc32.x86_64
libstdc++-10.2.1-6.fc32.x86_64

(gdb) p foo_map
$1 = std::map with 2 elements = {[1] = 10, [2] = 20}   <<<=== expected output
(gdb) q

Now install debuginfo and try again (same binary and core):

sudo dnf debuginfo-install glibc-2.31-4.fc32.x86_64 libgcc-10.2.1-6.fc32.x86_64
libstdc++-10.2.1-6.fc32.x86_64

gdb ./a.out core.111836 
GNU gdb (GDB) Fedora 9.1-6.fc32
...

Reading symbols from ./a.out...
[New LWP 111836]
Core was generated by `./a.out'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50        return ret;
(gdb) p foo_map
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute
'pointer':    <<<=== bug
$1 = std::map with 2 elements
(gdb) up
#1  0x00007f8589ea1895 in __GI_abort () at abort.c:79
79            raise (SIGABRT);
(gdb) p foo_map
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute
'pointer':    <<<=== bug
$2 = std::map with 2 elements
(gdb) up
#2  0x000000000040123b in foo () at foo.cc:10
10        abort();
(gdb) p foo_map
$3 = std::map with 2 elements = {[1] = 10, [2] = 20}   <<<=== now works!

(gdb) down
#1  0x00007f8589ea1895 in __GI_abort () at abort.c:79
79            raise (SIGABRT);
(gdb) p foo_map
Python Exception <class 'AttributeError'> 'NoneType' object has no attribute
'pointer':   <<<=== bug
$4 = std::map with 2 elements


It looks like GDB is trying to look up std::map::pointer in the DSO for current
frame despite the symbol being defined in a.out and having nothing to do with
current frame.

Source for a.out:

--- main.cc ---
int foo();
int main() { return foo(); }

--- foo.cc ---
#include <stdlib.h>
#include <map>

std::map<int, int> foo_map;

int foo()
{
  foo_map[1] = 10;
  foo_map[2] = 20;
  abort();
}


Build with 'g++ -g main.cc foo.cc'

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

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

end of thread, other threads:[~2020-12-16 12:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05  7:35 [Bug python/27021] New: Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer': when using pretty-printer ppluzhnikov at google dot com
2020-12-05 16:40 ` [Bug python/27021] " ppluzhnikov at google dot com
2020-12-06 15:08 ` z49x2vmq at gmail dot com
2020-12-06 16:58 ` ppluzhnikov at google dot com
2020-12-08  1:05 ` z49x2vmq at gmail dot com
2020-12-08  1:11 ` z49x2vmq at gmail dot com
2020-12-08 18:31 ` simark at simark dot ca
2020-12-16 12:33 ` rae.kim at gmail 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).