2013-09-11 22:28:44 +00:00
Connecting r2 with gdb
======================
Running gdbserver
-----------------
2018-02-27 09:54:54 +00:00
$ gdbserver :2345 /bin/ls
(gdb) target remote localhost:2345
2013-09-11 22:28:44 +00:00
Connecting from r2
------------------
2018-02-27 09:54:54 +00:00
$ r2 -D gdb gdb://127.0.0.1:2345
2014-07-17 19:14:49 +00:00
2017-04-21 19:42:51 +00:00
Supported implementations
=========================
2014-07-17 19:14:49 +00:00
r2 have support for connecting to remote GDB instances:
x86-32 x86-64 arm arm64 sh
winedbg x x - - -
qemu x x ? x -
gdbserver x x ? ? ?
x = supported
? = untested
- = not supported
Supported Commands
------------------
2018-02-27 09:54:54 +00:00
2014-07-17 19:14:49 +00:00
- read/write memory
2018-02-27 09:54:54 +00:00
Writing or reading memory is implemented through the m/M packet.
2014-07-17 19:14:49 +00:00
- read registers
2018-02-27 09:54:54 +00:00
Reading registers is currently implemented through the < g > packet of the gdb protocol.
2021-12-02 16:39:59 +00:00
It returns the whole register profile at once.
2014-07-17 19:14:49 +00:00
- write registers
2018-02-27 09:54:54 +00:00
There are two ways of writing registers. The first one is through the P packet.
It works like this: `P<register_index>=<register_value>`
The second one is the G packet, that writes the whole register Profile at once.
The implementation first tries to use the newer P packet and if it receives a $00# packet (that says not implemented), it tries to write through the G packet.
2014-07-17 19:14:49 +00:00
- stepping (but this is still the softstep mode and for an unknown reason it sill does not call th gdb_write_register function)
Supported Packets:
2018-02-27 09:54:54 +00:00
- `g` : Reads the whole register Profile at once
- `G` : Writes the whole register Profile at once
2021-12-02 16:39:59 +00:00
- `m` : Reads memory
2018-02-27 09:54:54 +00:00
- `M` : Writes memory
- `vCont,v` : continues execution of the binary
- `P` : Write one register
2014-07-17 19:14:49 +00:00
TODO
----
2018-02-27 09:54:54 +00:00
2021-12-02 16:39:59 +00:00
- Implement GDBserver to allow other apps use r2 debugger
2014-07-17 19:14:49 +00:00
- Fix that usese the gdb internal stepping version
- Fix softstep, that it finally recoils correct (it just have to reset the eip/rip)
- Add Breakpoints (should be an easy add of the function, because its already implemented in the gdb lib)