Message ID | 1463628849-311-1-git-send-email-tom@tromey.com |
---|---|
State | New |
Headers | show |
Tom Tromey <tom@tromey.com> writes: > 2016-05-18 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-18 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. We've already done something similar in py-event and py-type. Patch looks good to me.
>> PR python/19438, PR python/18393: >> * python/py-objfile.c (objfpy_initialize): Initialize self->dict. >> * python/py-progspace.c (pspy_initialize): Initialize self->dict. Yao> We've already done something similar in py-event and py-type. Patch Yao> looks good to me. Thanks, I'm checking it in. Tom
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 92024b6..7da1385 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-05-18 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-18 Tom Tromey <tom@tromey.com> + * rust-lang.c (rust_subscript): Initialize "high". 2016-05-17 Simon Marchi <simon.marchi@ericsson.com> diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index cd26c5b..82df4b2 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -196,7 +196,10 @@ static int objfpy_initialize (objfile_object *self) { self->objfile = NULL; - self->dict = NULL; + + self->dict = PyDict_New (); + if (self->dict == NULL) + return 0; self->printers = PyList_New (0); if (self->printers == NULL) diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index e1258c7..6fc53cb 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -97,7 +97,10 @@ static int pspy_initialize (pspace_object *self) { self->pspace = NULL; - self->dict = NULL; + + self->dict = PyDict_New (); + if (self->dict == NULL) + return 0; self->printers = PyList_New (0); if (self->printers == NULL) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a773c63..c813436 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-05-18 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. + 2016-05-18 Simon Marchi <simon.marchi@ericsson.com> * gdb.mi/mi-threads-interrupt.c: New file. diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp index 1bbb4cf..62ca309 100644 --- a/gdb/testsuite/gdb.python/py-objfile.exp +++ b/gdb/testsuite/gdb.python/py-objfile.exp @@ -45,6 +45,8 @@ gdb_test "python print (objfile.filename)" "${testfile}" \ gdb_test "python print (objfile.username)" "${testfile}" \ "Get objfile user name" +gdb_test_no_output "python dir(objfile)" + gdb_test "python print (gdb.lookup_objfile (\"${testfile}\").filename)" \ "${testfile}" "print lookup_objfile filename" gdb_test "python print (gdb.lookup_objfile (\"junk\"))" \ diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp index 5c1db1c..396d0f2 100644 --- a/gdb/testsuite/gdb.python/py-progspace.exp +++ b/gdb/testsuite/gdb.python/py-progspace.exp @@ -37,6 +37,8 @@ gdb_test "python print (gdb.current_progspace().filename)" "None" \ "current progspace filename (None)" gdb_test "python print (gdb.progspaces())" "\\\[<gdb.Progspace object at $hex>\\\]" +gdb_test_no_output "python dir(gdb.current_progspace())" + gdb_load ${binfile} gdb_py_test_silent_cmd "python progspace = gdb.current_progspace()" \