diff options
author | Tim Wiederhake <tim.wiederhake@intel.com> | 2017-05-02 11:35:54 +0200 |
---|---|---|
committer | Tim Wiederhake <tim.wiederhake@intel.com> | 2017-05-02 11:35:54 +0200 |
commit | ae20e79ae852fee8f7d42701a54a95de3b79ecea (patch) | |
tree | 616d593dcb7ef8249449028538998a7ff6a180e4 /gdb/btrace.c | |
parent | 8d0050ea192c41349c1f2b000866c1bdb761abeb (diff) | |
download | fsf-binutils-gdb-ae20e79ae852fee8f7d42701a54a95de3b79ecea.zip fsf-binutils-gdb-ae20e79ae852fee8f7d42701a54a95de3b79ecea.tar.gz fsf-binutils-gdb-ae20e79ae852fee8f7d42701a54a95de3b79ecea.tar.bz2 |
Python: Use correct ptid in btrace recording
The user would always get the instruction_history and function_call_history
objects of the current thread, not the thread for which the gdb.Record object
was created.
The attached testcase fails without this patch and passes with the patch.
Diffstat (limited to 'gdb/btrace.c')
-rw-r--r-- | gdb/btrace.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c index 238df0a..3801086 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -1802,11 +1802,17 @@ btrace_fetch (struct thread_info *tp) if (btinfo->replay != NULL) return; + /* With CLI usage, TP->PTID always equals INFERIOR_PTID here. Now that we + can store a gdb.Record object in Python referring to a different thread + than the current one, temporarily set INFERIOR_PTID. */ + cleanup = save_inferior_ptid (); + inferior_ptid = tp->ptid; + /* We should not be called on running or exited threads. */ gdb_assert (can_access_registers_ptid (tp->ptid)); btrace_data_init (&btrace); - cleanup = make_cleanup_btrace_data (&btrace); + make_cleanup_btrace_data (&btrace); /* Let's first try to extend the trace we already have. */ if (btinfo->end != NULL) |