Linker: some extra debugging / logging
authorSimon Marlow <marlowsd@gmail.com>
Wed, 29 Jun 2016 20:50:18 +0000 (21:50 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 1 Jul 2016 12:26:26 +0000 (13:26 +0100)
rts/Linker.c

index b41bc1a..894a31d 100644 (file)
@@ -1465,6 +1465,27 @@ void ghci_enquire(SymbolAddr* addr)
       }
    }
 }
+
+void ghci_find(SymbolAddr *addr);
+void ghci_find(SymbolAddr *addr)
+{
+    ObjectCode *oc;
+    uint32_t i;
+
+    for (oc = objects; oc != NULL; oc = oc->next) {
+        for (i = 0; i < (uint32_t)oc->n_sections; i++) {
+            Section *section = &oc->sections[i];
+            if (addr > section->start &&
+                (StgWord)addr < (StgWord)section->start+section->size) {
+                debugBelch("%p is in %" PATH_FMT, addr,
+                           oc->archiveMemberName ?
+                             oc->archiveMemberName : oc->fileName);
+                debugBelch(", section %d, offset %lx\n", i,
+                           (StgWord)addr - (StgWord)section->start);
+            }
+        }
+    }
+}
 #endif
 
 #if RTS_LINKER_USE_MMAP
@@ -2537,6 +2558,10 @@ int ocTryLoad (ObjectCode* oc) {
         }
     }
 
+    IF_DEBUG(linker, debugBelch("Resolving %" PATH_FMT "\n",
+                                oc->archiveMemberName ?
+                                oc->archiveMemberName : oc->fileName));
+
 #           if defined(OBJFORMAT_ELF)
         r = ocResolve_ELF ( oc );
 #           elif defined(OBJFORMAT_PEi386)