microsoft / microsoft/MIEngine
GDB Server stopOnEntry broken on embedded systems
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 859
- Forks
- 233
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 3
Description
GDB servers will always halt execution when the GDB Client attaches. MIEngine attempts to mask this through the EntryPointHit logic in HandleBreakModeEvent. #557 adds a heuristic to determine whether the break event is caused by this attach halt by checking whether the break event occurs inside a file:
On embedded systems, the target will always be somewhere when the client starts the GDB server, so the "file" field is virtually always populated, even if the target is just halted at the start of its reset procedure. This breaks the "file" heuristic in the snippet above, and the entry breakpoint is deleted before it's hit.
This file based heuristic appears to be an inaccurate way to determine whether the break event is related to attach.
I'd be happy to make a PR with a fix, but I think there are multiple approaches here, and I don't really know which one would be appropriate:
- Remove the file based heuristic altogether, and always skip break events without a reason field before the entry point when launching with a server.
- Add a member flag that forces the debugger to skip this first break event when launching with a GDB Server instead of looking at the file field
- Add some special handling for embedded systems, as their environment is a little different.
Related issues and PRs:
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
Read src/MIDebugEngine/Engine.Impl/DebuggedProcess.cs around lines 1148-1161 and inspect the EntryPointHit and HandleBreakModeEvent logic. Compare related issues #1108 and #1109, then determine how GDB Server attach breaks should be distinguished on embedded targets. Done means the entry breakpoint is not deleted before it is hit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools, embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100