[libbacktrace] Add altlink field to struct dwarf_data
authorTom de Vries <tdevries@suse.de>
Thu, 17 Jan 2019 00:07:43 +0000 (00:07 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 17 Jan 2019 00:07:43 +0000 (00:07 +0000)
Add an altlink field to struct dwarf_data, and initialize it with the pointer
to the struct dwarf_data for the .gnu_debugaltlink.

2019-01-17  Tom de Vries  <tdevries@suse.de>

* dwarf.c (struct dwarf_data): Add altlink field.
(backtrace_dwarf_add): Add and handle fileline_altlink parameter.
* elf.c (elf_add): Add argument to backtrace_dwarf_add call.
(phdr_callback, backtrace_initialize): Add argument to elf_add calls.
* internal.h (backtrace_dwarf_add): Add fileline_altlink parameter.
* pecoff.c (coff_add): Add argument to backtrace_dwarf_add call.
* xcoff.c (xcoff_add): Same.

From-SVN: r267994

libbacktrace/ChangeLog
libbacktrace/dwarf.c
libbacktrace/elf.c
libbacktrace/internal.h
libbacktrace/pecoff.c
libbacktrace/xcoff.c

index f2d2954b1c6adbb42975a2da5ef2aada0a89b80c..dfb17f5905ef4b74b97a4e5882ccb01fb775cc6d 100644 (file)
@@ -1,3 +1,13 @@
+2019-01-17  Tom de Vries  <tdevries@suse.de>
+
+       * dwarf.c (struct dwarf_data): Add altlink field.
+       (backtrace_dwarf_add): Add and handle fileline_altlink parameter.
+       * elf.c (elf_add): Add argument to backtrace_dwarf_add call.
+       (phdr_callback, backtrace_initialize): Add argument to elf_add calls.
+       * internal.h (backtrace_dwarf_add): Add fileline_altlink parameter.
+       * pecoff.c (coff_add): Add argument to backtrace_dwarf_add call.
+       * xcoff.c (xcoff_add): Same.
+
 2019-01-17  Tom de Vries  <tdevries@suse.de>
 
        * internal.h (backtrace_dwarf_add): Add fileline_entry parameter.
index 190c6fc131f9f28bece08b6d2438f7484d8a0e04..83cdb52ef2615917764d09506dbb47a4b686ee60 100644 (file)
@@ -343,6 +343,8 @@ struct dwarf_data
 {
   /* The data for the next file we know about.  */
   struct dwarf_data *next;
+  /* The data for .gnu_debugaltlink.  */
+  struct dwarf_data *altlink;
   /* The base address for this file.  */
   uintptr_t base_address;
   /* A sorted list of address ranges.  */
@@ -3000,6 +3002,7 @@ build_dwarf_data (struct backtrace_state *state,
                  const unsigned char *dwarf_str,
                  size_t dwarf_str_size,
                  int is_bigendian,
+                 struct dwarf_data *altlink,
                  backtrace_error_callback error_callback,
                  void *data)
 {
@@ -3028,6 +3031,7 @@ build_dwarf_data (struct backtrace_state *state,
     return NULL;
 
   fdata->next = NULL;
+  fdata->altlink = altlink;
   fdata->base_address = base_address;
   fdata->addrs = addrs;
   fdata->addrs_count = addrs_count;
@@ -3063,6 +3067,7 @@ backtrace_dwarf_add (struct backtrace_state *state,
                     const unsigned char *dwarf_str,
                     size_t dwarf_str_size,
                     int is_bigendian,
+                    struct dwarf_data *fileline_altlink,
                     backtrace_error_callback error_callback,
                     void *data, fileline *fileline_fn,
                     struct dwarf_data **fileline_entry)
@@ -3073,7 +3078,7 @@ backtrace_dwarf_add (struct backtrace_state *state,
                            dwarf_line, dwarf_line_size, dwarf_abbrev,
                            dwarf_abbrev_size, dwarf_ranges, dwarf_ranges_size,
                            dwarf_str, dwarf_str_size, is_bigendian,
-                           error_callback, data);
+                           fileline_altlink, error_callback, data);
   if (fdata == NULL)
     return 0;
 
index a863327df10824f153e8e4148713e16158b8d817..87e7b0d361d5414bfa68c1608178ee22cf5ed756 100644 (file)
@@ -3097,6 +3097,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
       debuglink_view_valid = 0;
     }
 
+  struct dwarf_data *fileline_altlink = NULL;
   if (debugaltlink_name != NULL)
     {
       int d;
@@ -3108,7 +3109,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
          int ret;
 
          ret = elf_add (state, filename, d, base_address, error_callback, data,
-                        fileline_fn, found_sym, found_dwarf, NULL,
+                        fileline_fn, found_sym, found_dwarf, &fileline_altlink,
                         0, 1, debugaltlink_buildid_data,
                         debugaltlink_buildid_size);
          backtrace_release_view (state, &debugaltlink_view, error_callback,
@@ -3265,6 +3266,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
                            sections[DEBUG_STR].data,
                            sections[DEBUG_STR].size,
                            ehdr.e_ident[EI_DATA] == ELFDATA2MSB,
+                           fileline_altlink,
                            error_callback, data, fileline_fn,
                            fileline_entry))
     goto fail;
index d9ab401ce416b9f42b29a1045edac6dff644f786..e8389779322bfcf0eb96dfcdd91762233def7df2 100644 (file)
@@ -303,6 +303,7 @@ extern int backtrace_dwarf_add (struct backtrace_state *state,
                                const unsigned char *dwarf_str,
                                size_t dwarf_str_size,
                                int is_bigendian,
+                               struct dwarf_data *fileline_altlink,
                                backtrace_error_callback error_callback,
                                void *data, fileline *fileline_fn,
                                struct dwarf_data **fileline_entry);
index cd20cbe17a740182902cce2e67f637cdfc2b100a..da1982fd3ca7c1624d93d80ffd919822b2de4223 100644 (file)
@@ -867,6 +867,7 @@ coff_add (struct backtrace_state *state, int descriptor,
                            sections[DEBUG_STR].data,
                            sections[DEBUG_STR].size,
                            0, /* FIXME */
+                           NULL,
                            error_callback, data, fileline_fn,
                            NULL))
     goto fail;
index 095800b4f717d9e7602727c0691a3cfd3b889ebe..d50b5bc517e6ec836e2f8d84de5ff5161d1d5d5d 100644 (file)
@@ -1315,6 +1315,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
                                dwsect[DWSECT_STR].data,
                                dwsect[DWSECT_STR].size,
                                1, /* big endian */
+                               NULL,
                                error_callback, data, fileline_fn,
                                NULL))
        goto fail;