rizin
rizin copied to clipboard
Fix parsing of GDB <reg> tags not separated by whitespace
Your checklist for this pull request
- [x] I've read the guidelines for contributing to this repository
- [x] I made sure to follow the project's coding style
- [ ] I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
- [ ] I've added tests that prove my fix is effective or that my feature works (if possible)
- [ ] I've updated the rizin book with the relevant information (if needed)
Detailed description
regstr_end + 3
would advance into the next <reg>
tag if there is no whitespace between the two tags. This would cause the latter register to be ignored by the parser. Such an XML is for example used by mGBA's GDB stub.
Test plan
In one terminal:
$ gdbserver localhost:2345 ls
In another terminal:
$ rizin -c dr -D gdb gdb://localhost:2345
Verify that the register list is complete for your architecture.
For testing with mGBA, which generates the problematic XML:
- Run the emulator and load any rom (free homebrew roms are available)
- Click Tools -> Start GDB server
- Click Start
- Run
rizin -c dr -D gdb gdb://localhost:2345
- Verify that the register list is complete:
r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, sp, lr, pc, cpsr
(currently in the dev branch, the odd-numbered registers are omitted)
this patch feels wrong. probably we should use one of the rz_str_*
methods.