This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/18393] GDB 7.9 segfaults on: python dir(gdb.current_progspace())
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 23 May 2016 16:17:15 +0000
- Subject: [Bug python/18393] GDB 7.9 segfaults on: python dir(gdb.current_progspace())
- Auto-submitted: auto-generated
- References: <bug-18393-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18393
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f6ed0e0efe2c4dcd35b0e483dc3b5da7fe4edf0
commit 0f6ed0e0efe2c4dcd35b0e483dc3b5da7fe4edf0
Author: Tom Tromey <tom@tromey.com>
Date: Wed May 18 21:19:17 2016 -0600
Fix PR python/19438, PR python/18393 - initialize dictionaries
This fixes PR python/19438 and PR python/18393. Both bugs are about
invoking dir() on some Python object implemented by gdb, and getting a
crash.
The crash happens because the dictionary field of these objects was
not initialized. Apparently what happens is that this field can be
lazily initialized by Python when assigning to an attribute; and it
can also be handled ok when using dir() but without __dict__ defined;
but gdb defines __dict__ because this isn't supplied automatically by
Python.
The docs on this seem rather sparse, but this patch works ok.
An alternative might be to lazily create the dictionary in
gdb_py_generic_dict, but I went with this approach because it seemed
more straightforward.
Built and regtested on x86-64 Fedora 23.
2016-05-23 Tom Tromey <tom@tromey.com>
PR python/19438, PR python/18393:
* python/py-objfile.c (objfpy_initialize): Initialize self->dict.
* python/py-progspace.c (pspy_initialize): Initialize self->dict.
2016-05-23 Tom Tromey <tom@tromey.com>
PR python/19438, PR python/18393:
* gdb.python/py-progspace.exp: Add "dir" test.
* gdb.python/py-objfile.exp: Add "dir" test.
--
You are receiving this mail because:
You are on the CC list for the bug.