This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [Python] Segfault when clearing pspace
From: gdb-patches-owner@sourceware.org [gdb-patches-owner@sourceware.org] On Behalf Of Tom Tromey [tromey@redhat.com]
>>>>> "Marc" == Marc Khouzam <marc.khouzam@ericsson.com> writes:
Marc> The existing FIXME comment about how to get the arch seems to
Marc> confirm that something should be fixed there.
Marc> Below the patch is a session that shows how to reproduce
Marc> the crash.
Marc> What do you think?
> Please remove the FIXME comment.
> This is ok with that change plus a ChangeLog entry.
I committed the following to HEAD and 7_2.
Thanks Tom!
Marc
2010-12-17 Marc Khouzam <marc.khouzam@ericsson.com>
* python/py-progspace.c (py_free_pspace): Obtain arch another
way to avoid dereferencing a null pointer.
### Eclipse Workspace Patch 1.0
#P src
Index: gdb/python/py-progspace.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-progspace.c,v
retrieving revision 1.3
diff -u -r1.3 py-progspace.c
--- gdb/python/py-progspace.c 17 May 2010 21:23:25 -0000 1.3
+++ gdb/python/py-progspace.c 18 Dec 2010 01:26:51 -0000
@@ -23,6 +23,7 @@
#include "progspace.h"
#include "objfiles.h"
#include "language.h"
+#include "arch-utils.h"
typedef struct
{
@@ -134,9 +135,7 @@
{
struct cleanup *cleanup;
pspace_object *object = datum;
- /* FIXME: What's the right way to get a program space's arch?
- There may be multiple. */
- struct gdbarch *arch = get_objfile_arch (pspace->symfile_object_file);
+ struct gdbarch *arch = get_current_arch ();
cleanup = ensure_python_env (arch, current_language);
object->pspace = NULL;