[mono/mono] 56fa4762: [sdb] Implement support for DebuggerStepThrough attribute. Fixes #15139.
"Zoltan Varga (
[email protected])" <
[email protected]>
Sat, 2 Nov 2013 19:43:52 +0000
| Newsgroups |
gmane.comp.gnome.mono.patches |
| Message-ID |
<000001421a57d114-f866c72f-317d-45a0-98fc-c12ec2748bfd-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/54ecc9c6a18c...56fa47629fd8
Commit: 56fa47629fd8617286ad340bdb4850e589cb7282
Author: Zoltan Varga <[email protected]> (vargaz)
Date: 2013-11-02 19:42:59 GMT
URL: https://github.com/mono/mono/commit/56fa47629fd8617286ad340bdb4850e589cb7282
[sdb] Implement support for DebuggerStepThrough attribute. Fixes #15139.
Changed paths:
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
M mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
M mcs/class/Mono.Debugger.Soft/Test/dtest.cs
M mono/metadata/domain-internals.h
M mono/mini/debugger-agent.c
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
===================================================================
@@ -398,7 +398,7 @@ public abstract class Connection
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
- internal const int MINOR_VERSION = 25;
+ internal const int MINOR_VERSION = 26;
enum WPSuspendPolicy {
NONE = 0,
Modified: mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs
===================================================================
@@ -23,7 +23,11 @@ public enum StepFilter {
StaticCtor = 1,
/* Since protocol version 2.20 */
/* Methods which have the [DebuggerHidden] attribute */
+ /* Before protocol version 2.26, this includes [DebuggerStepThrough] as well */
DebuggerHidden = 2,
+ /* Since protocol version 2.26 */
+ /* Methods which have the [DebuggerStepThrough] attribute */
+ DebuggerStepThrough = 4,
}
public sealed class StepEventRequest : EventRequest {
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
===================================================================
@@ -359,6 +359,7 @@ public static void wait_one ()
ss7 ();
ss_nested ();
ss_regress_654694 ();
+ ss_step_through ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
@@ -453,6 +454,30 @@ public static void wait_one ()
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void ss_step_through () {
+ step_through_1 ();
+ StepThroughClass.step_through_2 ();
+ step_through_3 ();
+ }
+
+ [DebuggerStepThrough]
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void step_through_1 () {
+ }
+
+ [DebuggerStepThrough]
+ class StepThroughClass {
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void step_through_2 () {
+ }
+ }
+
+ [DebuggerStepThrough]
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void step_through_3 () {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
public static bool is_even (int i) {
return i % 2 == 0;
}
Modified: mcs/class/Mono.Debugger.Soft/Test/dtest.cs
===================================================================
@@ -517,13 +517,30 @@ public class DebuggerTests
e = step_into ();
assert_location (e, "ss_nested_1");
e = step_out ();
- Console.WriteLine ("A: " + e.Thread.GetFrames ()[0].Location);
assert_location (e, "ss_nested");
// Check that step over steps over nested calls
e = step_over ();
assert_location (e, "ss_nested");
e = step_into ();
assert_location (e, "ss_nested_3");
+ req.Disable ();
+
+ // Check DebuggerStepThrough support
+ e = run_until ("ss_step_through");
+ req = create_step (e);
+ req.Filter = StepFilter.DebuggerStepThrough;
+ e = step_into ();
+ // Step through step_through_1 ()
+ e = step_into ();
+ assert_location (e, "ss_step_through");
+ // Step through StepThroughClass.step_through_2 ()
+ e = step_into ();
+ assert_location (e, "ss_step_through");
+ req.Disable ();
+ req.Filter = StepFilter.None;
+ e = step_into ();
+ assert_location (e, "step_through_3");
+ req.Disable ();
}
[Test]
Modified: mono/metadata/domain-internals.h
===================================================================
@@ -213,6 +213,8 @@ struct _MonoJitInfo {
gboolean dbg_hidden:1;
/* Whenever this jit info was loaded in async context */
gboolean async:1;
+ gboolean dbg_step_through_inited:1;
+ gboolean dbg_step_through:1;
/* FIXME: Embed this after the structure later*/
gpointer gc_info; /* Currently only used by SGen */
Modified: mono/mini/debugger-agent.c
===================================================================
@@ -283,7 +283,7 @@ struct _InvokeData
#define HEADER_LENGTH 11
#define MAJOR_VERSION 2
-#define MINOR_VERSION 25
+#define MINOR_VERSION 26
typedef enum {
CMD_SET_VM = 1,
@@ -367,7 +367,8 @@ struct _InvokeData
typedef enum {
STEP_FILTER_NONE = 0,
STEP_FILTER_STATIC_CTOR = 1,
- STEP_FILTER_DEBUGGER_HIDDEN = 2
+ STEP_FILTER_DEBUGGER_HIDDEN = 2,
+ STEP_FILTER_DEBUGGER_STEP_THROUGH = 4
} StepFilter;
typedef enum {
@@ -3454,6 +3455,32 @@ static void CALLBACK notify_thread_apc (ULONG_PTR param)
if (ji->dbg_hidden)
filtered = TRUE;
}
+ if ((mod->data.filter & STEP_FILTER_DEBUGGER_STEP_THROUGH) && ji) {
+ MonoCustomAttrInfo *ainfo;
+ static MonoClass *klass;
+
+ if (!klass) {
+ klass = mono_class_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerStepThroughAttribute");
+ g_assert (klass);
+ }
+ if (!ji->dbg_step_through_inited) {
+ ainfo = mono_custom_attrs_from_method (jinfo_get_method (ji));
+ if (ainfo) {
+ if (mono_custom_attrs_has_attr (ainfo, klass))
+ ji->dbg_step_through = TRUE;
+ mono_custom_attrs_free (ainfo);
+ }
+ ainfo = mono_custom_attrs_from_class (jinfo_get_method (ji)->klass);
+ if (ainfo) {
+ if (mono_custom_attrs_has_attr (ainfo, klass))
+ ji->dbg_step_through = TRUE;
+ mono_custom_attrs_free (ainfo);
+ }
+ ji->dbg_step_through_inited = TRUE;
+ }
+ if (ji->dbg_step_through)
+ filtered = TRUE;
+ }
}
}
@@ -6976,6 +7003,9 @@ static void CALLBACK notify_thread_apc (ULONG_PTR param)
if (CHECK_PROTOCOL_VERSION (2, 16))
filter = decode_int (p, &p, end);
req->modifiers [i].data.filter = filter;
+ if (!CHECK_PROTOCOL_VERSION (2, 26) && (req->modifiers [i].data.filter & STEP_FILTER_DEBUGGER_HIDDEN))
+ /* Treat STEP_THOUGH the same as HIDDEN */
+ req->modifiers [i].data.filter |= STEP_FILTER_DEBUGGER_STEP_THROUGH;
} else if (mod == MOD_KIND_THREAD_ONLY) {
int id = decode_id (p, &p, end);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches