New testsuite errors with gdbserver (remote)

Keith Seitz keiths@redhat.com
Thu Feb 17 20:48:00 GMT 2011


On 02/17/2011 10:48 AM, Michael Snyder wrote:
> Somewhat to my surprise, these new failures narrow down to this change:

I've given this a peek, and here's what I've found out...

When the exit notification is sent, and python picks it up, it is 
setting up the python environment (architecture and language). The 
python exit callback does this by calling get_current_arch.

The problem is that (long before this) wait_for_inferior sets the 
inferior with TID = 0. It is this inferior object that is then passed 
around for the event notification. Alas, unlike natives, where the 
inferior is popped, the inferior is still around.

As a result, target_has_stack goes to check the thread status and cannot 
find the appropriate thread (since the one in the list hasn't been 
cleared). This leads to the internal error you're seeing.

I'm not sure how valid it is to call get_current_arch from an exit 
event. Maybe it is. Maybe it isn't. Someone who knows a lot more about 
this is going to have to investigate this or guide me.

Nonetheless, if you pass target_gdbarch instead to ensure_python_env in 
python_inferior_exit (in python/py_inferior.c), things will behave much 
better. Once again, I don't know if this is strictly correct, but it 
should at least get you going with gdbserver again.

I hope this leads someone to a better solution.

Keith

Index: python/py-inferior.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-inferior.c,v
retrieving revision 1.5
diff -u -p -r1.5 py-inferior.c
--- python/py-inferior.c	4 Feb 2011 21:54:16 -0000	1.5
+++ python/py-inferior.c	17 Feb 2011 20:46:08 -0000
@@ -116,7 +116,7 @@ python_inferior_exit (struct inferior *i
    ptid_t ptidp;
    struct target_waitstatus status;

-  cleanup = ensure_python_env (get_current_arch (), current_language);
+  cleanup = ensure_python_env (target_gdbarch, current_language);

    get_last_target_status (&ptidp, &status);



More information about the Gdb mailing list