genodelabs/genode — Issue #83: GDB monitor: multi-byte breakpoint instructions do not always work on x86 (was mantis id 218)
Author: nfeske
Created: 2012-01-13 19:06:34+00:00
State: open
Labels: bug

When running the 'gdb_monitor_interactive' test from 0000217 with the following command sequence, the test application triggers a page fault:

```
...
Breakpoint 2, main () at /home/christian/projects/genode/genode-snapshot-2011-11-29/ports/src/test/gdb_monitor/main.cc:72
72 {
(gdb) b Test_thread::func3
(gdb) c
(gdb) c
```

```
[init -> gdb_monitor] genode_wait_for_signal_or_gdb_interrupt
no RM attachment (READ pf_addr=50 pf_ip=10008f1 from 1772000)
virtual void Genode::Pager_activation_base::entry(): Could not resolve pf=50 ip=10008f1
[init -> gdb_monitor -> test-gdb_monitor] void func2(): GDB monitor test is running...
[init -> gdb_monitor] received signal 0
```

The problem is that when the original instruction at the breakpoint address is a one-byte instruction and GDB reinserts the currently used two-byte 'int 0' breakpoint instruction after executing the original instruction in single-step mode, the next-to-be-executed instruction gets (partly) overwritten with the second byte of the breakpoint instruction.