Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debugger] Fix debugging on Mac and iOS #71436

Merged
merged 1 commit into from
Jul 6, 2022

Conversation

thaystg
Copy link
Member

@thaystg thaystg commented Jun 29, 2022

We need to set this:
mini_get_debug_options ()->mdb_optimizations = TRUE;
before initialize the interpreter, otherwise the interpreter optimizations will be turned on and we will not be able to see the correct variable values.

if (mini_get_debug_options ()->mdb_optimizations)

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1558698
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1513227

@ghost
Copy link

ghost commented Jun 29, 2022

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

We need to set this:
mini_get_debug_options ()->mdb_optimizations = TRUE;
before initialize the interpreter, otherwise the interpreter optimizations will be turned on and we will not be able to see the correct variable values.

if (mini_get_debug_options ()->mdb_optimizations)

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1558698
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1513227

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@thaystg
Copy link
Member Author

thaystg commented Jun 29, 2022

@lewing @lambdageek If you approve I think we should backport it to .net6, what do you think?

@nosami
Copy link

nosami commented Jun 29, 2022

verified 🐿

@steveisok steveisok merged commit c785f36 into dotnet:main Jul 6, 2022
@steveisok
Copy link
Member

/backport to release/6.0

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2625416084

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

@steveisok backporting to release/6.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix debugging on Mac and iOS
Using index info to reconstruct a base tree...
M	src/mono/mono/component/debugger-agent.c
M	src/mono/mono/mini/mini-runtime.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/mini/mini-runtime.c
CONFLICT (content): Merge conflict in src/mono/mono/mini/mini-runtime.c
Auto-merging src/mono/mono/component/debugger-agent.c
CONFLICT (content): Merge conflict in src/mono/mono/component/debugger-agent.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix debugging on Mac and iOS
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

thaystg added a commit to thaystg/mono that referenced this pull request Jul 13, 2022
github-actions bot pushed a commit to mono/mono that referenced this pull request Jul 14, 2022
akoeplinger pushed a commit to mono/mono that referenced this pull request Jul 14, 2022
akoeplinger pushed a commit to mono/mono that referenced this pull request Jul 14, 2022
Backport dotnet/runtime#71436
Backport of #21516 to 2020-02

Co-authored-by: Thays Grazia <[email protected]>
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request Jul 15, 2022
New commits in mono/mono:

* mono/mono@2a19f878dab Backport dotnet/runtime#71436
* mono/mono@6051b710727 Bump nuget.exe to v6.2.1
* mono/mono@f354099a6b6 Set app context to null on thread detach
* mono/mono@6c7e72dd8e0 [mono] Fix a crash during stack trace construction if a this object is null.

Diff: https://github.com/mono/mono/compare/dffa5ab92245f2419238a35b7c2052e9a24036b4..2a19f878dab8d2e62123e0bf29453de553f5402a
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this pull request Jul 15, 2022
New commits in mono/mono:

* mono/mono@2a19f878dab Backport dotnet/runtime#71436
* mono/mono@6051b710727 Bump nuget.exe to v6.2.1
* mono/mono@f354099a6b6 Set app context to null on thread detach
* mono/mono@6c7e72dd8e0 [mono] Fix a crash during stack trace construction if a this object is null.

Diff: https://github.com/mono/mono/compare/dffa5ab92245f2419238a35b7c2052e9a24036b4..2a19f878dab8d2e62123e0bf29453de553f5402a
rolfbjarne added a commit to dotnet/macios that referenced this pull request Jul 15, 2022
…15451)

There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (#15507). This means that the workaround is for .NET scenarios only.

Co-authored-by: Manuel de la Pena <[email protected]>
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request Jul 15, 2022
…otnet#15451)

There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (dotnet#15507). This means that the workaround is for .NET scenarios only.

Co-authored-by: Manuel de la Pena <[email protected]>
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
rolfbjarne pushed a commit to rolfbjarne/xamarin-macios that referenced this pull request Jul 15, 2022
There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (dotnet#15507). This means that the workaround is for .NET scenarios only.

This is a backport of #dotnet#15451.
rolfbjarne pushed a commit to rolfbjarne/xamarin-macios that referenced this pull request Jul 15, 2022
There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (dotnet#15507). This means that the workaround is for .NET scenarios only.

This is a backport of #dotnet#15451.
dalexsoto pushed a commit to dotnet/macios that referenced this pull request Jul 18, 2022
…15510)

There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (#15507). This means that the workaround is for .NET scenarios only.

This is a backport of ##15451.

Co-authored-by: Thays Grazia <[email protected]>
dalexsoto pushed a commit to dotnet/macios that referenced this pull request Jul 18, 2022
…15509)

There's a bug in the Mono runtime where the interpreter does not disable optimizations when the debugger is attached, which leads to the interpreter optimizing code and the debugger ending up rather confused.

The bug is fixed in the Mono runtime (dotnet/runtime#71436), but there's no immediate way for the runtime to release this fix, so here we're implementing a workaround that disables interpreter optimizations if the debugging is enabled. It's somewhat clunky because the Mono external API wasn't designed for this, so we have to abuse the API a bit to accomplish the effect we want.

This is somewhat risky (since we're changing the startup path in a pretty big way), but there's an escape hatch via an environment variable, and also the workaround will not be in effect for release builds.

While the runtime issue exists in legacy mono/mono as well, we'll fix the Mono runtime for legacy, because we don't have to wait to consume legacy mono (#15507). This means that the workaround is for .NET scenarios only.

This is a backport of ##15451.

Co-authored-by: Thays Grazia <[email protected]>
dalexsoto pushed a commit to dotnet/macios that referenced this pull request Jul 18, 2022
New commits in mono/mono:

* mono/mono@2a19f878dab Backport dotnet/runtime#71436
* mono/mono@6051b710727 Bump nuget.exe to v6.2.1
* mono/mono@f354099a6b6 Set app context to null on thread detach
* mono/mono@6c7e72dd8e0 [mono] Fix a crash during stack trace construction if a this object is null.

Diff: https://github.com/mono/mono/compare/dffa5ab92245f2419238a35b7c2052e9a24036b4..2a19f878dab8d2e62123e0bf29453de553f5402a

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
dalexsoto pushed a commit to dotnet/macios that referenced this pull request Jul 18, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants