Make the remote target always register a thread

Pedro Alves pedro@codesourcery.com
Thu Jun 26 02:22:00 GMT 2008


Hi,

This patch makes the remote target always put a thread in the
thread list.  This is needed so we can get rid of context
switching on the core side.

This is also the fix I suggested for the crash reported in this thread:
"How to catch GDB crash"
http://sourceware.org/ml/gdb/2008-06/msg00242.html

(The crash will still be there for other targets that
don't always register the main thread)

The remote target is special in its handling of threads,
as depending on the optional thread related packets supported,
inferior_ptid can "upgrade" from magic_null_ptid to a
real ptid, hence care must be taken to not leave an old
thread in the thread list with magic_null_ptid ptid, if
threads are reported.

I've tested those special cases manually by hacking GDB,
so I could test combinations like,

target remote, no qC support, but qfThreadInfo supported,
target remote, no qC support, but T AA thread:TID is reported,

target extended-remote, attaching, with no threads support (no
qC, or qfThreadInfo or T AA thread:TID, or the old thread listing
protocol)

target extended-remote, running, again with no threads support.

All the above, but after connecting, enabling T AA thread:TID
All the above, but after connecting, enabling qC

GDB behaved correctly, in those cases, that is, the <main>
thread is upgraded to a real ptid correctly.

The start_remote change is needed, because we're
adding the thread to the list before calling it, so we can't
call init_thread_list there.  Instead the call is moved to the
start_remote called.  There's another caller in monitor.c,
so that also gets the obvious change.

Regtested with a native gdbserver on x86_64-unknown-linux-gnu.

OK?

-- 
Pedro Alves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 002-remote_always_a_thread.diff
Type: text/x-diff
Size: 6028 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080626/09bfda67/attachment.bin>


More information about the Gdb-patches mailing list