aboutsummaryrefslogtreecommitdiff
path: root/gdb/objc-lang.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-10-09 18:11:01 +0100
committerPedro Alves <palves@redhat.com>2017-10-09 18:11:01 +0100
commitcbd2b4e316370ab740433b06ed65786831232c8f (patch)
tree3d24752cec304cbbb0d261eac1f3f0119e600ba4 /gdb/objc-lang.c
parenta181c0bf7461c28cdb72a4074c6d7608119fb575 (diff)
downloadbinutils-cbd2b4e316370ab740433b06ed65786831232c8f.zip
binutils-cbd2b4e316370ab740433b06ed65786831232c8f.tar.gz
binutils-cbd2b4e316370ab740433b06ed65786831232c8f.tar.bz2
Multi-arch exec, more register reading avoidance
As mentioned in commit bf93d7ba9931 ("Add thread after updating gdbarch when exec'ing"), we should avoid doing register reads after a process does an exec and before we've updated that inferior's gdbarch. Otherwise, we may interpret the registers using the wrong architecture. There's still (at least) one case where we still read registers post-exec with the pre-exec architecture. That's when infrun decides it needs to switch context to the exec'ing thread. I.e., if the exec event is processed at a time when the current thread is not already the exec'ing thread, then we get (with the test added by this commit): continue Continuing. Truncated register 50 in remote 'g' packet Truncated register 50 in remote 'g' packet (gdb) FAIL: gdb.multi/multi-arch-exec.exp: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture The fix is to avoid reading registers when switching context in this case. (I'd be nice to get rid of the constant stop_pc reading when switching threads, but that'd be a deeper change.) gdb/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>: Skip reading registers when switching context. gdb/testsuite/ChangeLog: 2017-10-09 Pedro Alves <palves@redhat.com> * gdb.multi/multi-arch-exec.c: Include <pthread.h> and <assert.h>. (barrier): New. (thread_start, all_started): New functions. (main): Spawn new thread and wait until it is scheduled. * gdb.multi/multi-arch-exec.exp: Build $srcfile1 with the pthreads option. (do_test): Add 'selected_thread' parameter. Run to all_started instead of main. Explicitly set the breakpoint at main. Switch to the SELECTED_THREAD thread. (top level): Test handling the exec event with either the main thread or the second thread selected.
Diffstat (limited to 'gdb/objc-lang.c')
0 files changed, 0 insertions, 0 deletions