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

[android][debugger] Implement support to debug after hot reload. #55722

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

thaystg
Copy link
Member

@thaystg thaystg commented Jul 15, 2021

  • Fix wasm test.
  • Change how seq_points were loaded after hotreload
  • Use the same infrastructure to load locals variables

Related to this PR:
mono/debugger-libs#344

@ghost
Copy link

ghost commented Jul 15, 2021

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

Issue Details
  • Fix wasm test.
  • Change how seq_points were loaded after hotreload
  • Use the same infrastructure to load locals variables
Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

Copy link
Member

@lambdageek lambdageek left a comment

Choose a reason for hiding this comment

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

lgtm, although I'm not sure about source_files[0].

Also @thaystg did you try multiple updates (ie, change a method, then apply the update, then change it again and apply update again)? This code looks like it will work for that case, but I just wanted to ask if it's something you looked at.

srcfile = sinfo->source_file;
}
PRINT_DEBUG_MSG (10, "IL%x -> %s:%d %d %d %d\n", sp->il_offset, srcfile, sp->line, sp->column, sp->end_line, sp->end_column);
buffer_add_int (buf, sp->il_offset);
buffer_add_int (buf, sp->line);
if (CHECK_PROTOCOL_VERSION (2, 13))
buffer_add_int (buf, source_files [i]);
buffer_add_int (buf, i >= n_il_offsets_original ? source_files [0] : source_files [i]);
Copy link
Member

Choose a reason for hiding this comment

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

can source_files [0] ever be -1 here? Also why is this ok?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because as I understand on EnC pdb we don't have information about source code.
And we can have more il_offsets then the original pdb, like when you add more lines, so I get the source of the first breakpoint.

Copy link
Member

Choose a reason for hiding this comment

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

So source_files[] is an array of indexes of the source documents for a particular method? And each source_files[x] says where sequence point number x comes from? So this is saying "if we got additional sequence points beyond the original ones, assume they're from the same document as the first original sequence point?

I guess that makes sense (at least until we have to deal with partial C# methods - although I'm not sure if those have sequence points in multiple files).

What if the original method body didn't have any sequence points? Can that happen? What if the method was completely empty at the start? I guess there's still a ret in there - and maybe we have a sequence point?

Will debugger-libs be ok if we send back source_files[0] and it is -1?

@lambdageek
Copy link
Member

AzDO and GitHub are out of sync - the test results for a95d832 are here: https://dev.azure.com/dnceng/public/_build/results?buildId=1239524&view=results

@thaystg
Copy link
Member Author

thaystg commented Jul 15, 2021

lgtm, although I'm not sure about source_files[0].

Also @thaystg did you try multiple updates (ie, change a method, then apply the update, then change it again and apply update again)? This code looks like it will work for that case, but I just wanted to ask if it's something you looked at.

Yes, I tested for multiple updates, I will add a video with it working here! :)

@thaystg
Copy link
Member Author

thaystg commented Jul 15, 2021

Here it is:
https://user-images.githubusercontent.com/4503299/125790551-a0a350c9-d5f6-406c-ab36-30f0ce4bd4a1.mp4

MonoDebugLocalsInfo*
mono_ppdb_lookup_locals_enc (MonoImage *image, int method_idx)
{
return mono_ppdb_lookup_locals_internal (image, method_idx + 1, TRUE);
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe it would be better to store a 1-based offset in MonoDebugInformationEnc:idx.

@thaystg thaystg merged commit 54d4f62 into dotnet:main Jul 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 14, 2021
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.

2 participants