diff options
author | Antoine Tremblay <antoine.tremblay@ericsson.com> | 2017-01-09 12:39:07 -0500 |
---|---|---|
committer | Antoine Tremblay <antoine.tremblay@ericsson.com> | 2017-01-09 12:39:07 -0500 |
commit | 694b382c67a4fc656f30acbc74776c5e9cb53622 (patch) | |
tree | a63f5ac75142be9315e6f9adc52807fa9ba4b039 /gdb/go-exp.y | |
parent | a5ec5e3fe1b8fe1395c79ff29052edad91266a76 (diff) | |
download | gdb-694b382c67a4fc656f30acbc74776c5e9cb53622.zip gdb-694b382c67a4fc656f30acbc74776c5e9cb53622.tar.gz gdb-694b382c67a4fc656f30acbc74776c5e9cb53622.tar.bz2 |
Fix inferior memory reading in GDBServer for arm/aarch32
Before this patch, some functions would read the inferior memory with
(*the_target)->read_memory, which returns the raw memory, rather than the
shadowed memory.
This is wrong since these functions do not expect to read a breakpoint
instruction and can lead to invalid behavior.
Use of raw memory in get_next_pcs_read_memory_unsigned_integer for example
could lead to get_next_pc returning an invalid pc.
Here's how this would happen:
In non-stop:
the user issues:
thread 1
step&
thread 2
step&
thread 3
step&
In a similar way as non-stop-fair-events.exp (threads are looping).
GDBServer:
linux_resume is called
GDBServer has pending events,
threads are not resumed and single-step breakpoint for thread 1 not installed.
linux_wait_1 is called with a pending event on thread 2 at pc A
GDBServer handles the event and calls proceed_all_lwps
This calls proceed_one_lwp and installs single-step breakpoints on all
the threads that need one.
Now since thread 1 needs to install a single-step breakpoint and is at pc B
(different than thread 2), a step-over is not initiated and get_next_pc
is called to figure out the next instruction from pc B.
However it may just be that thread 3 as a single step breakpoint at pc
B. And thus get_next_pc fails.
This situation is tested with non-stop-fair-events.exp.
In other words, single-step breakpoints are installed in proceed_one_lwp
for each thread. GDBserver proceeds two threads for resume_step, as
requested by GDB, and the thread proceeded later may see the single-step
breakpoints installed for the thread proceeded just now.
Tested on gdbserver-native/-m{thumb,arm} no regressions.
gdb/gdbserver/ChangeLog:
* linux-aarch32-low.c (arm_breakpoint_kind_from_pc): Use
target_read_memory.
* linux-arm-low.c (get_next_pcs_read_memory_unsigned_integer): Likewise.
(get_next_pcs_syscall_next_pc): Likewise.
Diffstat (limited to 'gdb/go-exp.y')
0 files changed, 0 insertions, 0 deletions