Skip to content

Add stopAtConnect option and improve entrypoint breakpoint handling - #1109

Merged
Andrew Wang (WardenGnaw) merged 3 commits into
microsoft:mainfrom
benmcmorran:dev/bemcmorr/fix-stopatentry
Mar 18, 2021
Merged

Add stopAtConnect option and improve entrypoint breakpoint handling#1109
Andrew Wang (WardenGnaw) merged 3 commits into
microsoft:mainfrom
benmcmorran:dev/bemcmorr/fix-stopatentry

Conversation

@benmcmorran

@benmcmorran Ben McMorran (benmcmorran) commented Mar 1, 2021

Copy link
Copy Markdown
Member

I was running into issues debugging an embedded device with OpenOCD where the stopAtEntry setting in launch.json was ignored and the debugger always threw an exception with "Unknown breakpoint" when entering main.

The problem was that _callback.OnEntryPoint(thread) wasn't called after setting EntrypointHit, so none of the stopAtEntry logic in OpenDebugAD7 had a chance to run, and that the entrypoint breakpoint inserted on main by MIEngine was never removed by this.OnEntrypointHit(). However, even with that added, there was another problem because CmdContinueAsync() runs unconditionally.

The fix adds a new option, stopAtConnect that will always treat unexpected stopped events when connecting as if an entrypoint has been hit and stop. The fix also makes sure that the entrypoint breakpoint inserted on main is always cleaned up to avoid "Unknown breakpoint" exceptions.

With these changes, an embedded device debugging session will correctly respond to stopAtEntry and stopAtConnect, and will no longer throw spurious exceptions.

cc Alan Leung (@aleun)

@benmcmorran

Copy link
Copy Markdown
Member Author

FYI this will have (easily resolved) merge conflicts after #1108 goes in.

Comment thread src/MICore/JsonLaunchOptions.cs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Comment thread src/MICore/JsonLaunchOptions.cs Outdated
@gregg-miskelly

Copy link
Copy Markdown
Member

Ben McMorran (@benmcmorran) Can you update the description to match what your PR does now?
paulmaybee Andrew Wang (@WardenGnaw) Do either of you want to have a look before this is merged?

@benmcmorran Ben McMorran (benmcmorran) changed the title Fix stopAtEntry for embedded debugging Add stopAtConnect option and improve entrypoint breakpoint handling Mar 12, 2021
@benmcmorran

Copy link
Copy Markdown
Member Author

Updated title and description.

@WardenGnaw
Andrew Wang (WardenGnaw) merged commit 2ae2fe3 into microsoft:main Mar 18, 2021
@benmcmorran
Ben McMorran (benmcmorran) deleted the dev/bemcmorr/fix-stopatentry branch March 18, 2021 18:50
Hedges (Hedges) added a commit to Hedges/MIEngine that referenced this pull request Jul 2, 2021
Hedges (Hedges) added a commit to Hedges/MIEngine that referenced this pull request Sep 2, 2024
Hedges (Hedges) added a commit to Hedges/MIEngine that referenced this pull request Jul 5, 2026
Hedges (Hedges) added a commit to Hedges/MIEngine that referenced this pull request Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants