Skip to content

Commit 02b9c28

Browse files
committed
doc: expand gdb.md with supported packets and commands
1 parent fa24ea7 commit 02b9c28

1 file changed

Lines changed: 53 additions & 19 deletions

File tree

‎doc/gdb.md‎

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,66 @@ Supported Commands
3535

3636
- read registers
3737

38-
Reading registers is currently implemented through the <g> packet of the gdb protocol.
39-
It returns the whole register profile at once.
38+
Reading registers is currently implemented through the `g` packet of the gdb protocol.
39+
It returns the whole register profile at once.
4040

4141
- write registers
4242

43-
There are two ways of writing registers. The first one is through the P packet.
43+
There are two ways of writing registers. The first one is through the `P` packet.
4444
It works like this: `P<register_index>=<register_value>`
45-
The second one is the G packet, that writes the whole register Profile at once.
46-
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.
45+
The second one is the `G` packet, that writes the whole register profile at once.
46+
The implementation first tries to use the newer `P` packet and if it receives a `$00#`
47+
packet (not implemented), it falls back to the `G` packet.
4748

48-
-- stepping (but this is still the softstep mode and for an unknown reason it still does not call the gdb_write_register function)
49+
- stepping
4950

50-
Supported Packets:
51+
Single-stepping is implemented through the `vCont;s` packet when vCont is supported,
52+
falling back to the `s` packet otherwise.
5153

52-
- `g` : Reads the whole register Profile at once
53-
- `G` : Writes the whole register Profile at once
54-
- `m` : Reads memory
55-
- `M` : Writes memory
56-
- `vCont,v` : continues execution of the binary
57-
- `P` : Write one register
54+
- breakpoints
5855

59-
TODO
60-
----
56+
Software breakpoints are set and removed using the `Z0`/`z0` packets.
57+
Hardware breakpoints use `Z1`/`z1`. Watchpoints (read, write, access) use
58+
`Z2`/`z2`, `Z3`/`z3`, and `Z4`/`z4` respectively.
6159

62-
- Implement GDBserver to allow other apps use rizin debugger
63-
- Fix that uses the gdb internal stepping version
64-
- Fix softstep, that it finally recoils correct (it just have to reset the eip/rip)
65-
- Add Breakpoints (should be an easy add of the function, because its already implemented in the gdb lib)
60+
- attach/detach
6661

62+
Attaching to a running process uses the `vAttach` packet. Detaching uses the `D` packet.
63+
Multiprocess detach uses `D;<pid>`.
64+
65+
- file access
66+
67+
Remote file operations (open, read, close) are supported through the `vFile` packet,
68+
allowing rizin to read files (e.g. `/proc/<pid>/maps`) directly from the remote target.
69+
70+
- thread and process listing
71+
72+
Thread and process enumeration is supported via XML target descriptions and the
73+
`qXfer:threads:read` packet.
74+
75+
Supported Packets
76+
-----------------
77+
78+
- `?` : Query stop reason
79+
- `g` : Read all registers at once
80+
- `G` : Write all registers at once
81+
- `p` : Read a single register
82+
- `P` : Write a single register
83+
- `m` : Read memory
84+
- `M` : Write memory
85+
- `s` : Single step
86+
- `c` : Continue execution
87+
- `vCont` : Continue or step with optional signal, per-thread control
88+
- `vAttach` : Attach to a process by PID
89+
- `D` : Detach from target
90+
- `k` : Kill the remote process
91+
- `Z0`/`z0` : Set/remove software breakpoint
92+
- `Z1`/`z1` : Set/remove hardware breakpoint
93+
- `Z2`/`z2` : Set/remove write watchpoint
94+
- `Z3`/`z3` : Set/remove read watchpoint
95+
- `Z4`/`z4` : Set/remove access watchpoint
96+
- `qSupported` : Query supported features
97+
- `qRcmd` : Send a command to the remote target's interpreter
98+
- `qOffsets` : Get load offsets for sections
99+
- `vFile` : Remote file I/O operations
100+
- `qXfer:threads:read` : Read thread list via XML

0 commit comments

Comments
 (0)