1. Wez Furlong
  2. gimli

Commits

Wez Furlong  committed 07615aa

more darwin fixups; need to adjust line numbers by the object base_addr
(and probably need to apply that same offset for non-darwin too).

Similar commentary for symbols.

  • Participants
  • Parent commits 1ec32f8
  • Branches onering

Comments (0)

Files changed (5)

File configure.ac

View file
     MODULE_SUFFIX=".bundle"
     SHLIB_SUFFIX=".dylib"
     RLDPATH="-R"
-    DARWIN_DSYMUTIL="dsymutil -o .libs/wedgie.dSYM .libs/wedgie"
+    DARWIN_DSYMUTIL="dsymutil -o .libs/wedgie.dSYM .libs/wedgie ; dsymutil -o .libs/libgimli.0.dylib.dSYM .libs/libgimli.0.dylib"
     ;;
   *linux*)
     CORONER_LDFLAGS="-lthread_db -lpthread"

File darwin.c

View file
 #endif
     }
     if (want_symbol) {
-      gimli_addr_t value = nsym->n_value;
-
-      if (mhdr->filetype != MH_EXECUTE) {
-        value += file->base_addr;
-      }
-      //          printf("sym: %s %p\n", strtab + nsym->n_un.n_strx, (char*)value);
+      gimli_addr_t value = nsym->n_value + file->base_addr;
+//      printf("sym: %s " PTRFMT "\n", strtab + nsym->n_un.n_strx, value);
       gimli_add_symbol(file, strtab + nsym->n_un.n_strx, value, 0);
 
       if (sigtramp == 0 &&

File dwarf-read.c

View file
   struct gimli_line_info *linfo;
 
   m = gimli_mapping_for_addr(proc, pc);
-  if (!m) return 0;
+  if (!m) {
+    return 0;
+  }
   f = m->objfile;
 
   if (!f->elf) {
     }
   }
 
+#ifdef __MACH__
+  pc -= f->base_addr;
+#else
   if (!gimli_object_is_executable(f->elf)) {
-    pc -= m->base;
+    pc -= m->base; // FIXME: f->base_addr?
   }
+#endif
 
   linfo = bsearch(&pc, f->lines, f->linecount, sizeof(*linfo),
       search_compare_line);
   return 0;
 }
 
-int gimli_process_dwarf(gimli_mapped_object_t f)
-{
-  /* pull out additional information from dwarf debugging information.
-   * In particular, we can scan the .debug_info section to resolve
-   * function names into symbols for the back trace code */
-
-  if (f->elf) {
-    //process_line_numbers(f);
-  }
-
-  return 1;
-}
-
 static int get_sect_data(gimli_mapped_object_t f, const char *name,
   const uint8_t **startptr, const uint8_t **endptr, gimli_object_file_t *elf)
 {

File symbols.c

View file
   f->symchanged = 0;
 
   if (debug) {
-    printf("baking %" PRId64 " symbols for %s\n", f->symcount, f->objname);
+    printf("baking %" PRId64 " symbols for %s base=" PTRFMT "\n",
+        f->symcount, f->objname, f->base_addr);
   }
 
   if (f->symhash) {

File trace.c

View file
   }
 }
 
-static gimli_iter_status_t process_file(const char *k, int klen,
-    void *item, void *arg)
-{
-  gimli_mapped_object_t file = item;
-
-  gimli_process_dwarf(file);
-
-  return GIMLI_ITER_CONT;
-}
-
 int tracer_attach(int pid)
 {
   atexit(detachatexit);
   if (gimli_proc_attach(pid, &the_proc) == GIMLI_ERR_OK) {
-    gimli_mapped_object_t file;
-
-    gimli_hash_iter(the_proc->files, process_file, NULL);
     return 1;
   }
   return 0;