Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid KarlasĖŒ <david.karlas@xamarin.com>2016-12-28 17:22:11 +0300
committerZoltan Varga <vargaz@gmail.com>2016-12-28 17:34:57 +0300
commitb61b37b192fd7a1cdb8379d8e9078f63a3b17b6a (patch)
tree91f90bec9e8576fdbab57fbc1cb412f9dc42b706
parentd9a9f4edf51931842e0bcbdd5c8286bb6ae8d456 (diff)
[Debugger] Fixed bug where we loop randomly long(+1 part) and optimised stepping in(over) non-user code
-rw-r--r--mono/mini/debugger-agent.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c
index ab39180f7b1..4758c4dcfbe 100644
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -566,6 +566,8 @@ typedef struct {
GSList *bps;
/* The number of frames at the start of a step-over */
int nframes;
+ /* If set, don't stop in methods that are not part of user assemblies */
+ MonoAssembly** user_assemblies;
} SingleStepReq;
/*
@@ -4913,6 +4915,22 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal)
return;
/*
+ * This could be in ss_update method, but mono_find_next_seq_point_for_native_offset is pretty expensive method,
+ * hence we prefer this check here.
+ */
+ if (ss_req->user_assemblies) {
+ gboolean found = FALSE;
+ for (int k = 0; ss_req->user_assemblies[k]; k++)
+ if (ss_req->user_assemblies[k] == method->klass->image->assembly) {
+ found = TRUE;
+ break;
+ }
+ if (!found)
+ return;
+ }
+
+
+ /*
* The ip points to the instruction causing the single step event, which is before
* the offset recorded in the seq point map, so find the next seq point after ip.
*/
@@ -5394,6 +5412,13 @@ ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilte
ss_req->filter = filter;
req->info = ss_req;
+ for (int i = 0; i < req->nmodifiers; i++) {
+ if (req->modifiers[i].kind == MOD_KIND_ASSEMBLY_ONLY) {
+ ss_req->user_assemblies = req->modifiers[i].data.assemblies;
+ break;
+ }
+ }
+
mono_loader_lock ();
tls = (DebuggerTlsData *)mono_g_hash_table_lookup (thread_to_tls, thread);
mono_loader_unlock ();
@@ -6486,7 +6511,8 @@ clear_assembly_from_modifier (EventRequest *req, Modifier *m, MonoAssembly *asse
}
if (match_count) {
- newassemblies = g_new0 (MonoAssembly*, count - match_count);
+ // +1 because we don't know length and we use last element to check for end
+ newassemblies = g_new0 (MonoAssembly*, count - match_count + 1);
pos = 0;
for (i = 0; i < count; ++i)
@@ -7496,7 +7522,8 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
int n = decode_int (p, &p, end);
int j;
- req->modifiers [i].data.assemblies = g_new0 (MonoAssembly*, n);
+ // +1 because we don't know length and we use last element to check for end
+ req->modifiers [i].data.assemblies = g_new0 (MonoAssembly*, n + 1);
for (j = 0; j < n; ++j) {
req->modifiers [i].data.assemblies [j] = decode_assemblyid (p, &p, end, &domain, &err);
if (err != ERR_NONE) {