2002-10-15 Martin Baulig <martin@gnome.org>
authorMartin Baulig <martin@novell.com>
Tue, 15 Oct 2002 12:08:18 +0000 (12:08 -0000)
committerMartin Baulig <martin@novell.com>
Tue, 15 Oct 2002 12:08:18 +0000 (12:08 -0000)
* jit.cs (PUSH_TREE): Always set t->cli_addr here.

* debug.c (generate_line_number): Small fix to make this actually
work for more complex things.

svn path=/trunk/mono/; revision=8282

mono/jit/ChangeLog
mono/jit/debug.c
mono/jit/jit.c

index bca3f24fd43de727f883a7f195c534e382775691..edbd8906575c1b0e017a9e8905a0828735b8b17f 100644 (file)
@@ -1,3 +1,10 @@
+2002-10-15  Martin Baulig  <martin@gnome.org>
+
+       * jit.cs (PUSH_TREE): Always set t->cli_addr here.
+
+       * debug.c (generate_line_number): Small fix to make this actually
+       work for more complex things.
+
 2002-10-11  Dietmar Maurer  <dietmar@ximian.com>
 
        * x86.brg (freg): use fprem instead of fprem1
index 7e314d07d8c3890946a75d4e0f624396ad3a946e..c6a20bf708772828ea91aa452b61da24f7826d84 100644 (file)
@@ -539,25 +539,45 @@ debug_generate_method_lines (AssemblyDebugInfo *info, MonoDebugMethodInfo *minfo
 }
 
 static void
-generate_line_number (MonoDebugMethodInfo *minfo, guint32 address, guint32 offset)
+generate_line_number (MonoDebugMethodInfo *minfo, guint32 address, guint32 offset, int debug)
 {
        int i;
 
+       if (debug)
+               g_message (G_STRLOC ": searching IL offset %x", offset);
+
        for (i = minfo->num_il_offsets - 1; i >= 0; i--) {
                MonoDebugLineNumberEntry *lne;
 
                if (minfo->il_offsets [i].offset > offset)
                        continue;
 
+               if (debug)
+                       g_message (G_STRLOC ": found entry %d: offset = %x, row = %d",
+                                  i, minfo->il_offsets [i].offset, minfo->il_offsets [i].row);
+
                if (minfo->jit->line_numbers->len) {
                        MonoDebugLineNumberEntry last = g_array_index (
                                minfo->jit->line_numbers, MonoDebugLineNumberEntry,
                                minfo->jit->line_numbers->len - 1);
 
-                       if (minfo->il_offsets [i].row <= last.line)
-                               continue;
+                       /* Avoid writing more than one entry for the same line. */
+                       if (minfo->il_offsets [i].row == last.line) {
+                               if (debug)
+                                       g_message (G_STRLOC ": skipping line: line = %d, last line = %d, "
+                                                  "last address = %x, address = %x, "
+                                                  "last offset = %x, offset = %x",
+                                                  last.line, minfo->il_offsets [i].row,
+                                                  last.address, address, last.offset, offset);
+
+                               return;
+                       }
                }
 
+               if (debug)
+                       g_message (G_STRLOC ": writing entry: line = %d, offfset = %x, address = %x",
+                                  minfo->il_offsets [i].row, offset, address);
+
                lne = g_new0 (MonoDebugLineNumberEntry, 1);
                lne->address = address;
                lne->offset = offset;
@@ -590,7 +610,7 @@ debug_update_il_offsets (AssemblyDebugInfo *info, MonoDebugMethodInfo *minfo, Mo
        header = ((MonoMethodNormal*)minfo->method)->header;
 
 #if 0
-       if (!strcmp (minfo->method->name, "Main")) {
+       if (!strcmp (minfo->method->name, "Test") || !strcmp (minfo->method->name, "Main")) {
                MonoMethodHeader *header = ((MonoMethodNormal*)minfo->method)->header;
 
                debug = 1;
@@ -603,7 +623,7 @@ debug_update_il_offsets (AssemblyDebugInfo *info, MonoDebugMethodInfo *minfo, Mo
        }
 #endif
 
-       generate_line_number (minfo, address, offset);
+       generate_line_number (minfo, address, offset, debug);
 
        /* start lines of basic blocks */
        for (i = 0; i < cfg->block_count; ++i) {
@@ -618,11 +638,11 @@ debug_update_il_offsets (AssemblyDebugInfo *info, MonoDebugMethodInfo *minfo, Mo
                        offset = t->cli_addr;
                        address = t->addr;
 
-                       generate_line_number (minfo, address, offset);
+                       generate_line_number (minfo, address, offset, debug);
                }
        }
 
-       generate_line_number (minfo, minfo->jit->epilogue_begin, header->code_size);
+       generate_line_number (minfo, minfo->jit->epilogue_begin, header->code_size, debug);
 
        if (debug) {
                for (i = 0; i < minfo->jit->line_numbers->len; i++) {
index 0ce5e9ec7c3b6c0f1187b37ac62f1d4e34754c4e..e43c1930acc2f8a87e5fef0d0896e4a8df41a643 100644 (file)
@@ -876,7 +876,7 @@ mono_array_new_va (MonoMethod *cm, ...)
 }
 
 #define ADD_TREE(t,a)   do { t->cli_addr = a; g_ptr_array_add (forest, (t)); } while (0)
-#define PUSH_TREE(t,k)  do { int tt = k; *sp = t; t->svt = tt; sp++; } while (0)
+#define PUSH_TREE(t,k)  do { int tt = k; *sp = t; t->svt = tt; t->cli_addr = cli_addr; sp++; } while (0)
 
 #define LOCAL_POS(n)    (1 + n)
 
@@ -2148,7 +2148,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
                                            (ii->arg_map [0]->op != MB_TERM_CHECKTHIS)) {
                                                ii->arg_map [0] = mono_ctree_new (mp, MB_TERM_CHECKTHIS, 
                                                                                  ii->arg_map [0], NULL);
-                                               ADD_TREE (ii->arg_map [0], cli_addr);
+                                               ADD_TREE (ii->arg_map [0], ii->arg_map [0]->cli_addr);
                                        }
                                
                                        if (cm->inline_count) {
@@ -2189,7 +2189,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
                        for (k = nargs - 1; k >= 0; k--) {
                                t1 = mono_ctree_new (mp, mono_map_arg_type (csig->params [k]), arg_sp [k], NULL);
                                t1->data.arg_info = arg_info [k + 1];
-                               ADD_TREE (t1, cli_addr);
+                               ADD_TREE (t1, arg_sp [k]->cli_addr);
                        }
 
                        if (csig->hasthis) 
@@ -2198,7 +2198,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
                                this = mono_ctree_new_leaf (mp, MB_TERM_NOP);
                        
 
-                       if (MONO_TYPE_ISSTRUCT (csig->ret) && !array_rank) {
+                       if (MONO_TYPE_ISSTRUCT (csig->ret)) {
                                int size, align;
                                if (csig->pinvoke)
                                        size = mono_class_native_size (csig->ret->data.klass, &align);