From: Tom de Vries <tdevries@suse.de>
To: Ian Lance Taylor <iant@golang.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/9] [libbacktrace] Add altlink field to struct dwarf_data
Date: Wed, 16 Jan 2019 22:20:00 -0000 [thread overview]
Message-ID: <b4ef11b4-b194-c655-1a81-cc9c63dcbe33@suse.de> (raw)
In-Reply-To: <e11dbf93-2f56-b173-6ed6-5514b98e55e3@suse.de>
[-- Attachment #1: Type: text/plain, Size: 2911 bytes --]
On 16-01-19 17:34, Tom de Vries wrote:
> On 16-01-19 17:33, Tom de Vries wrote:
>> On 16-01-19 02:02, Ian Lance Taylor wrote:
>>> On Tue, Dec 11, 2018 at 2:14 AM Tom de Vries <tdevries@suse.de> wrote:
>>>>
>>>> Add an altlink field to struct dwarf_data, and initialize it with the pointer
>>>> to the struct dwarf_data for the .gnu_debugaltlink.
>>>>
>>>> 2018-11-11 Tom de Vries <tdevries@suse.de>
>>>>
>>>> * dwarf.c (struct dwarf_data): Add altlink field.
>>>> (backtrace_dwarf_add): Add and handle fileline_entry and
>>>> fileline_altlink parameters.
>>>> * elf.c (elf_add): Add and handle fileline_entry parameter. Add args to
>>>> backtrace_dwarf_add call.
>>>> (phdr_callback, backtrace_initialize): Add arguments to elf_add calls.
>>>> * internal.h (backtrace_dwarf_add): Add fileline_entry and
>>>> fileline_altlink parameters.
>>>> * pecoff.c (coff_add): Add args to backtrace_dwarf_add call.
>>>> * xcoff.c (xcoff_add): Same.
>>>
>>>
>>>> @@ -2968,7 +2970,7 @@ build_dwarf_data (struct backtrace_state *state,
>>>> size_t dwarf_str_size,
>>>> int is_bigendian,
>>>> backtrace_error_callback error_callback,
>>>> - void *data)
>>>> + void *data, struct dwarf_data *altlink)
>>>> {
>>>
>>> error_callback and data should remain the last two parameters, as they
>>> are for many of the functions in this file.
>>>
>>>
>>
>> Done.
>>
>>>> @@ -3031,7 +3034,8 @@ backtrace_dwarf_add (struct backtrace_state *state,
>>>> size_t dwarf_str_size,
>>>> int is_bigendian,
>>>> backtrace_error_callback error_callback,
>>>> - void *data, fileline *fileline_fn)
>>>> + void *data, fileline *fileline_fn, void **fileline_entry,
>>>> + void *fileline_altlink)
>>>
>>> The new fileline_altlink parameter should come before error_callback,
>>> as it is not error_callback/data and is not a result parameter.
>>>
>>
>> Done.
>>
>>> What is fileline_entry for?
>>
>> There are two bits to this patch:
>> - add fileline_entry parameter to elf_add. This allows the callers of
>> elf_add access to the struct dwarf_data pointer corresponding to the
>> added elf.
>> - add an altlink field to struct dwarf_data, and initialize it with the
>> pointer to the struct dwarf_data for the .gnu_debugaltlink.
>>
>> I've split the patch up this way now, hoping it will make things clearer
>> and/or easier to review.
>>
>>> Why is it void**?
>>
>> It's really struct dwarf_data *, but struct dwarf_data is a type
>> declared in dwarf.c, so it's not known in other files.
>>
>> Thanks,
>> - Tom
>>
>> Here's the first part.
>>
>
> And here's the second part.
Updated to use 'struct dwarf_data' instead of 'void'.
Thanks,
- Tom
>
[-- Attachment #2: 0004-libbacktrace-Add-altlink-field-to-struct-dwarf_data.patch --]
[-- Type: text/x-patch, Size: 4996 bytes --]
[libbacktrace] Add altlink field to struct dwarf_data
Add an altlink field to struct dwarf_data, and initialize it with the pointer
to the struct dwarf_data for the .gnu_debugaltlink.
2018-11-11 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.
---
libbacktrace/dwarf.c | 7 ++++++-
libbacktrace/elf.c | 4 +++-
libbacktrace/internal.h | 1 +
libbacktrace/pecoff.c | 1 +
libbacktrace/xcoff.c | 1 +
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
index 190c6fc131f..83cdb52ef26 100644
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -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;
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 2841c06cdb2..36b20cba149 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -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,
@@ -3272,6 +3273,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;
diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h
index d9ab401ce41..e8389779322 100644
--- a/libbacktrace/internal.h
+++ b/libbacktrace/internal.h
@@ -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);
diff --git a/libbacktrace/pecoff.c b/libbacktrace/pecoff.c
index cd20cbe17a7..da1982fd3ca 100644
--- a/libbacktrace/pecoff.c
+++ b/libbacktrace/pecoff.c
@@ -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;
diff --git a/libbacktrace/xcoff.c b/libbacktrace/xcoff.c
index 095800b4f71..d50b5bc517e 100644
--- a/libbacktrace/xcoff.c
+++ b/libbacktrace/xcoff.c
@@ -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;
next prev parent reply other threads:[~2019-01-16 22:20 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 10:14 [PATCH 0/9] [libbacktrace] Handle .gnu_debugaltlink Tom de Vries
2018-12-11 10:14 ` [PATCH 8/9] [libbacktrace] Add btest_dwz test-case Tom de Vries
2019-01-16 1:19 ` Ian Lance Taylor
2019-01-16 16:39 ` Tom de Vries
2019-01-16 18:30 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 7/9] [libbacktrace] Handle DW_FORM_GNU_ref_alt Tom de Vries
2019-01-17 0:17 ` Tom de Vries
2019-01-17 0:36 ` Ian Lance Taylor
2019-01-17 14:14 ` Tom de Vries
2019-01-17 14:16 ` Tom de Vries
2019-01-18 14:26 ` Ian Lance Taylor
2019-01-22 22:17 ` [libbacktrace] Use size_t for low_offset/high_offset fields of struct unit Tom de Vries
2019-01-22 23:05 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 3/9] [libbacktrace] Handle alt FORMS without .gnu_debugaltlink Tom de Vries
2019-01-16 1:06 ` Ian Lance Taylor
2019-01-16 16:34 ` Tom de Vries
2019-01-16 18:24 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 6/9] [libbacktrace] Factor out read_referenced_name_1 Tom de Vries
2019-01-16 1:15 ` Ian Lance Taylor via gcc-patches
2019-01-16 16:37 ` Tom de Vries
2019-01-16 18:26 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 1/9] [libbacktrace] Read .gnu_debugaltlink Tom de Vries
2019-01-16 0:56 ` Ian Lance Taylor via gcc-patches
2019-01-16 16:26 ` Tom de Vries
2019-01-16 17:15 ` Ian Lance Taylor via gcc-patches
2019-01-16 22:48 ` Tom de Vries
2019-01-16 23:21 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 5/9] [libbacktrace] Unify function name preference handling Tom de Vries
2019-01-16 1:10 ` Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 2/9] [libbacktrace] Add altlink field to struct dwarf_data Tom de Vries
2019-01-16 1:02 ` Ian Lance Taylor
2019-01-16 16:33 ` Tom de Vries
2019-01-16 16:34 ` Tom de Vries
2019-01-16 22:20 ` Tom de Vries [this message]
2019-01-16 22:25 ` Ian Lance Taylor
2019-01-16 17:17 ` Ian Lance Taylor
2019-01-16 22:18 ` Tom de Vries
2019-01-16 22:40 ` Ian Lance Taylor
2018-12-11 10:14 ` [PATCH 4/9] [libbacktrace] Handle DW_FORM_GNU_strp_alt Tom de Vries
2019-01-16 1:07 ` Ian Lance Taylor via gcc-patches
2018-12-11 10:14 ` [PATCH 9/9] [libbacktrace] Add printdwarftest_dwz_cmp.sh test-case Tom de Vries
2019-01-17 13:58 ` Tom de Vries
2019-01-18 14:24 ` Ian Lance Taylor via gcc-patches
2019-01-19 0:45 ` Tom de Vries
2019-01-19 0:54 ` Ian Lance Taylor via gcc-patches
2019-01-22 22:03 ` Tom de Vries
2019-01-29 15:31 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4ef11b4-b194-c655-1a81-cc9c63dcbe33@suse.de \
--to=tdevries@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=iant@golang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).