Crash when connecting to the gdbserver from Renode
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 331
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
A user reported that binja crashes right after connecting to the gdbserver in https://github.com/renode/renode
I checked and the reason is that:
- Upon launching of the gdbserver, renode immediately sends packet, which binja's debugger is not expecting
-
Binja debugger sends a Hg0 packet (https://github.com/Vector35/debugger/blob/3174676019f47e1b3dd05f68968a720673e541e9/core/adapters/gdbadapter.cpp#L237)
-
Renode believes binja debugger plans to use the non-ack mode, and responds without sending an ack. The packet starts with "$" directly
-
Binja debugger is unware of Renode's decision to go no-ack mode, and it is still expecting an ack (which should be "+"). The expectation is not met, and an exception is throw: https://github.com/Vector35/debugger/blob/d204a7cb204a2ed45c93213e8ed9047cc6326e33/core/adapters/rspconnector.cpp#L161
I tested that GDB can talk to Renode just fine. But I somehow believe Renode actually violates the protocol -- it should not have switched to no-ack mode without explicit instruction from the gdbserver. GDB is probably just tolerating that
I will see if I can find a way to fix it. I feel this is already a lost fight -- since various gdbserver can all have their own small variations, and it is impossible to handle all of them. The possible route towards better gdbserver support lies in #170
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked core/adapters/gdbadapter.cpp and core/adapters/rspconnector.cpp references, then reproduce the connection to Renode's gdbserver while tracing the initial packet exchange. Done means the debugger no longer crashes and the handshake remains compatible with Renode without relying on GDB's apparent tolerance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools, reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100