This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/13363] gdb crash when I try to print a std::queue inpython pretty printer


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

--- Comment #5 from asmwarrior <asmwarrior at gmail dot com> 2011-11-01 01:41:18 UTC ---
Hi Phil Muldoon:
I just do a test on whether your commit will cause the crash, the result is:
YES!

Here is my test:
I currently build the gdb with:
-------------------------
mkdir 2011-11-01
cd 2011-11-01
CFLAGS="-O0 -g" \
../gdb/configure \
--prefix=/mingw \
--host=mingw32 \
--build=mingw32 \
--target=mingw32 \
--with-python=/python/python \
--with-expat \
--disable-nls
-------------------------
Now, first, I build the gdb git version: 
Revision: eaafbca6b136e71ae0fafb8dbfda92c9fad14a29
Author: gdbadmin
Date: 2011-10-31 8:00:03
Message:
*** empty log message ***
----
Modified : gdb/version.in
)

And I just do the test, and the result the bad, gdb crashes. see the log:(looks
like the command "set python print-stack on" does not show anything on the
crash.

-------------------------------
E:\test_gdb>gdb-python27.exe gdb.exe
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from e:\test_gdb\gdb.exe...done.
(gdb) r
Starting program: e:\test_gdb\gdb.exe
[New Thread 1016.0x4d4]
GNU gdb (GDB) 7.3.50.20111031-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) [New Thread 1016.0xe64]
[New Thread 1016.0x8b4]
file a1.exe
Reading symbols from e:\test_gdb\a1.exe...done.
(gdb) source stl.gdb
(gdb) r
Starting program: e:\test_gdb\a1.exe
[New Thread 3252.0xc04]

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at E:\code\cb\test_code\gdbpython-demo\main.cpp:41
41      E:\code\cb\test_code\gdbpython-demo\main.cpp: No such file or
directory.

        in E:\code\cb\test_code\gdbpython-demo\main.cpp
(gdb) python print 1
1
(gdb) set python print-stack on
(gdb) python print 1
1
(gdb) p q
$1 =
Program received signal SIGSEGV, Segmentation fault.
0x005ac3a0 in typy_lookup_typename (type_name=0x0, block=0x0)
    at ../../gdb/gdb/python/py-type.c:586
586           if (!strncmp (type_name, "struct ", 7))
(gdb) bt
#0  0x005ac3a0 in typy_lookup_typename (type_name=0x0, block=0x0)
    at ../../gdb/gdb/python/py-type.c:586
#1  0x005ac647 in typy_lookup_type (demangled=0x534bb60, block=0x0)
    at ../../gdb/gdb/python/py-type.c:650
#2  0x005ac7bb in typy_legacy_template_argument (type=0x4e94378, block=0x0,
    argno=0) at ../../gdb/gdb/python/py-type.c:714
#3  0x005ac95d in typy_template_argument (self=0x2c84608, args=0x2c9c870)
    at ../../gdb/gdb/python/py-type.c:759
#4  0x1e08883b in python27!PyCFunction_Call ()
   from F:\cb\common_bin\python27.dll
#5  0x1e0bf781 in python27!PyEval_GetFuncDesc ()
   from F:\cb\common_bin\python27.dll
#6  0x02cc0198 in ?? ()
#7  0x1e1d57f8 in python27!PySuper_Type () from F:\cb\common_bin\python27.dll
#8  0x00000001 in ?? ()
#9  0x029be64c in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) q
A debugging session is active.

        Inferior 1 [process 1016] will be killed.

Quit anyway? (y or n) y

E:\test_gdb>
--------------------------------------------------------

Then I have look at your commit:
Revision: babf52b2dc571b5823c9985dde9015b9d011ce03
Author: pmuldoon
Date: 2011-10-27 17:14:26
Message:
2011-10-27  Phil Muldoon  <pmuldoon@redhat.com>

* python/py-breakpoint.c (bppy_set_enabled): Use TRY_CATCH.
    (bppy_set_task): Ditto.
    (bppy_delete_breakpoint): Ditto.
    * python/py-symbol.c (gdbpy_lookup_symbol): Ditto.
    (gdbpy_lookup_global_symbol): Ditto.
    * python/py-lazy-string.c (stpy_convert_to_value): Ditto.
    * python/py-frame.c (frapy_is_valid): Ditto.
    (frame_info_to_frame_object): Ditto.
    * python/py-type.c (typy_lookup_type): Ditto.
    (typy_getitem): Ditto.
    (typy_has_key): Ditto.
    (typy_richcompare): Use TRY_CATCH.  Do not return Py_NE on error.
----
Modified : gdb/ChangeLog
Modified : gdb/python/py-breakpoint.c
Modified : gdb/python/py-frame.c
Modified : gdb/python/py-lazy-string.c
Modified : gdb/python/py-symbol.c
Modified : gdb/python/py-type.c


I'm using TortoiseGit under Windows XP, then I just run "revert change by this
commit", and build the gdb again. The result gdb does not crash. see the log:
--------------------------
E:\test_gdb>gdb-python27.exe gdb.exe
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from e:\test_gdb\gdb.exe...done.
(gdb) r
Starting program: e:\test_gdb\gdb.exe
[New Thread 2772.0xc3c]
GNU gdb (GDB) 7.3.50.20111031-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) [New Thread 2772.0xdd4]
[New Thread 2772.0xd40]
file a1.exe
Reading symbols from e:\test_gdb\a1.exe...done.
(gdb) source stl.gdb
(gdb) set python print-stack on
(gdb) r
Starting program: e:\test_gdb\a1.exe
[New Thread 3544.0xdac]

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at E:\code\cb\test_code\gdbpython-demo\main.cpp:41
41      E:\code\cb\test_code\gdbpython-demo\main.cpp: No such file or
directory.

        in E:\code\cb\test_code\gdbpython-demo\main.cpp
(gdb) python print 1
1
(gdb) p q
$1 = std::queue wrapping: std::deque with 2 elements = {"a", "b"}
(gdb)
--------------------------------------------

So, I still think that your commit has some relation to the crash of gdb.

BTW: The above test program "a1.exe" is built from gcc 4.4.5.

If I build the "a1.exe" from gcc 4.6.2, then both the gdb with your commit
babf52b2dc571b5823c9985dde9015b9d011ce03 or without your commit do NOT crash.

So, your commit is not friendly to gcc 4.4.5?
Any ideas?

-- 
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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]