-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
thaystg
merged 2 commits into
dotnet:main
from
thaystg:thays_implement_android_debug_hotreload
Jul 15, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -543,19 +543,29 @@ mono_ppdb_get_seq_points_internal (const char* ptr, MonoSymSeqPoint **seq_points | |
|
||
if (n_seq_points) { | ||
*n_seq_points = sps->len; | ||
g_assert (seq_points); | ||
*seq_points = g_new (MonoSymSeqPoint, sps->len); | ||
memcpy (*seq_points, sps->data, sps->len * sizeof (MonoSymSeqPoint)); | ||
if (seq_points) { | ||
*seq_points = g_new (MonoSymSeqPoint, sps->len); | ||
memcpy (*seq_points, sps->data, sps->len * sizeof (MonoSymSeqPoint)); | ||
} | ||
} | ||
int sps_len = sps->len; | ||
g_array_free (sps, TRUE); | ||
return sps_len; | ||
} | ||
|
||
void | ||
mono_ppdb_get_seq_points_enc (const char* ptr, MonoSymSeqPoint **seq_points, int *n_seq_points) | ||
gboolean | ||
mono_ppdb_get_seq_points_enc (MonoImage *image, int idx, MonoSymSeqPoint **seq_points, int *n_seq_points) | ||
{ | ||
guint32 cols [MONO_METHODBODY_SIZE]; | ||
MonoTableInfo *tables = image->tables; | ||
MonoTableInfo *methodbody_table = &tables [MONO_TABLE_METHODBODY]; | ||
mono_metadata_decode_row (methodbody_table, idx, cols, MONO_METHODBODY_SIZE); | ||
if (!cols [MONO_METHODBODY_SEQ_POINTS]) | ||
return FALSE; | ||
|
||
const char *ptr = mono_metadata_blob_heap (image, cols [MONO_METHODBODY_SEQ_POINTS]); | ||
mono_ppdb_get_seq_points_internal (ptr, seq_points, n_seq_points, 0, NULL, NULL, NULL, NULL, NULL, NULL, FALSE); | ||
return TRUE; | ||
} | ||
|
||
void | ||
|
@@ -619,27 +629,16 @@ mono_ppdb_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrAr | |
|
||
} | ||
|
||
MonoDebugLocalsInfo* | ||
mono_ppdb_lookup_locals (MonoDebugMethodInfo *minfo) | ||
static MonoDebugLocalsInfo* | ||
mono_ppdb_lookup_locals_internal (MonoImage *image, int method_idx, gboolean is_enc) | ||
{ | ||
MonoPPDBFile *ppdb = minfo->handle->ppdb; | ||
MonoImage *image = ppdb->image; | ||
MonoDebugLocalsInfo *res; | ||
MonoTableInfo *tables = image->tables; | ||
MonoMethod *method = minfo->method; | ||
|
||
guint32 cols [MONO_LOCALSCOPE_SIZE]; | ||
guint32 locals_cols [MONO_LOCALVARIABLE_SIZE]; | ||
int i, lindex, sindex, method_idx, start_scope_idx, scope_idx, locals_idx, locals_end_idx, nscopes; | ||
MonoDebugLocalsInfo *res; | ||
MonoMethodSignature *sig; | ||
|
||
if (!method->token) | ||
return NULL; | ||
|
||
sig = mono_method_signature_internal (method); | ||
if (!sig) | ||
return NULL; | ||
|
||
method_idx = mono_metadata_token_index (method->token); | ||
|
||
int i, lindex, sindex, locals_idx, locals_end_idx, nscopes, start_scope_idx, scope_idx; | ||
|
||
start_scope_idx = mono_metadata_localscope_from_methoddef (image, method_idx); | ||
|
||
|
@@ -725,6 +724,34 @@ mono_ppdb_lookup_locals (MonoDebugMethodInfo *minfo) | |
return res; | ||
} | ||
|
||
MonoDebugLocalsInfo* | ||
mono_ppdb_lookup_locals_enc (MonoImage *image, int method_idx) | ||
{ | ||
return mono_ppdb_lookup_locals_internal (image, method_idx + 1, TRUE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
} | ||
|
||
MonoDebugLocalsInfo* | ||
mono_ppdb_lookup_locals (MonoDebugMethodInfo *minfo) | ||
{ | ||
MonoPPDBFile *ppdb = minfo->handle->ppdb; | ||
MonoImage *image = ppdb->image; | ||
MonoMethod *method = minfo->method; | ||
int method_idx; | ||
MonoMethodSignature *sig; | ||
|
||
if (!method->token) | ||
return NULL; | ||
|
||
sig = mono_method_signature_internal (method); | ||
if (!sig) | ||
return NULL; | ||
|
||
method_idx = mono_metadata_token_index (method->token); | ||
|
||
|
||
return mono_ppdb_lookup_locals_internal (image, method_idx, FALSE); | ||
} | ||
|
||
/* | ||
* We use this to pass context information to the row locator | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 eachsource_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
?