Changed mini-exceptions functions to get IL offsets from seq point.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Thu, 30 Oct 2014 22:34:44 +0000 (22:34 +0000)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 17 Nov 2014 09:54:46 +0000 (17:54 +0800)
mono_walk_stack_full and ves_icall_get_trace are now using find_prev_seq_point_for_native_offset to retrieve IL offsets.

mono/mini/mini-exceptions.c

index 8c62bb704f97e3d2e0ee8429c3c470b8c935d595..02238647e9a591adb2d9f5e5ebc5ad6f563e307c 100644 (file)
@@ -52,6 +52,7 @@
 #include "mini.h"
 #include "trace.h"
 #include "debugger-agent.h"
+#include "seq-points.h"
 
 #ifndef MONO_ARCH_CONTEXT_DEF
 #define MONO_ARCH_CONTEXT_DEF
@@ -699,10 +700,15 @@ ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info
                 * operation, so we shouldn't call this method twice.
                 */
                location = mono_debug_lookup_source_location (jinfo_get_method (ji), sf->native_offset, domain);
-               if (location)
+               if (location) {
                        sf->il_offset = location->il_offset;
-               else
-                       sf->il_offset = 0;
+               } else {
+                       SeqPoint sp;
+                       if (find_prev_seq_point_for_native_offset (domain, jinfo_get_method (ji), sf->native_offset, NULL, &sp))
+                               sf->il_offset = sp.il_offset;
+                       else
+                               sf->il_offset = 0;
+               }
 
                if (need_file_info) {
                        if (location && location->source_file) {
@@ -853,7 +859,13 @@ mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain
                        MonoDebugSourceLocation *source;
 
                        source = mono_debug_lookup_source_location (jinfo_get_method (frame.ji), frame.native_offset, domain);
-                       il_offset = source ? source->il_offset : -1;
+                       if (source) {
+                               il_offset = source->il_offset;
+                       } else {
+                               SeqPoint sp;
+                               if (find_prev_seq_point_for_native_offset (domain, jinfo_get_method (frame.ji), frame.native_offset, NULL, &sp))
+                                       il_offset = sp.il_offset;
+                       }
                        mono_debug_free_source_location (source);
                } else
                        il_offset = -1;