gdb, btrace: forward fetch_registers for unknown threads
In the record-btrace target, while replaying, we can only provide the PC
register. The btrace state is stored in the thread_info. So, when trying
to determine whether we are currently replaying, GDB calls
find_thread_ptid() to obtain the thread_info. It also asserts that we do
have a thread_info.
For new threads, libthread-db may fetch registers before the thread is
known to GDB. In this case, find_thread_ptid() returns nullptr and the
assertion fails.
Forward the fetch_registers request to the target beneath in that case.
gdb/ChangeLog:
2020-03-19 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_target::fetch_registers): Forward
request if we do not have a thread_info.
gdb/testsuite/ChangeLog:
2020-03-19 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/enable-new-thread.c: New test.
* gdb.btrace/enable-new-thread.exp: New file.