public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, Ian Lance Taylor <ian@airs.com>
Subject: Re: [PATCH 9/9] [libbacktrace] Add printdwarftest_dwz_cmp.sh test-case
Date: Tue, 22 Jan 2019 22:03:00 -0000	[thread overview]
Message-ID: <bc287552-0a2a-ac9f-ad68-f4e12e2f5ff2@suse.de> (raw)
In-Reply-To: <CAKOQZ8wEDDVRyn1v4ap97nFG2Uw+gRgN7dzFAQf0AFZOcv9eXw@mail.gmail.com>

On 19-01-19 01:54, Ian Lance Taylor wrote:
> On Fri, Jan 18, 2019 at 4:45 PM Tom de Vries <tdevries@suse.de> wrote:
>>
>> On 18-01-19 15:23, Ian Lance Taylor wrote:
>>> On Thu, Jan 17, 2019 at 5:59 AM Tom de Vries <tdevries@suse.de> wrote:
>>>>
>>>> now that the rest of the patch series has been committed, here's an
>>>> updated version of this patch that applies to trunk.
>>>
>>> I would much rather put dwarf_data into internal.h than to #include
>>> "dwarf.c" from a different file.  Using #include with a .c file is
>>> just a bad path to walk down.
>>
>> This version avoids the include of dwarf.c.
>>
>> Does that look better?
> 
>> +printdwarftest_SOURCES =
>> +printdwarftest_LDADD = libbacktrace.la printdwarftest.lo testlib.lo
> 
> Seems like you could write
> 
> printdwarftest_SOURCES = printdwarftest.c testlib.c
> printdwarftest_LDADD = libbacktrace.la
> 

That's what I had initially, but I realized that that makes it harder to
keep dependencies correct.  That is, now I've added the dependencies:
...
+printdwarftest.lo: config.h backtrace.h internal.h testlib.h
+testlib.lo: $(INCDIR)/filenames.h backtrace.h testlib.h
...
and that works for "printdwarftest_LDADD = ... printdwarftest.lo
testlib.lo".

When doing this instead:
...
printdwarftest_SOURCES = printdwarftest.c testlib.c
printdwarftest_LDADD = libbacktrace.la
...
no printdwarftest.lo or testlib.lo is generated.

So, I could rewrite the dependencies to:
...
+printdwarftest.o: config.h backtrace.h internal.h testlib.h
+printdwarftest.obj: config.h backtrace.h internal.h testlib.h
+testlib.o: $(INCDIR)/filenames.h backtrace.h testlib.h
+testlib.obj: $(INCDIR)/filenames.h backtrace.h testlib.h
...
but that looks somewhat fragile, because when adding:
...
+printdwarftest_CFLAGS = -fno-tree-tail-merge
...
we need to rewrite the dependencies to:
...
+printdwarftest-printdwarftest.o: config.h backtrace.h internal.h testlib.h
+printdwarftest-printdwarftest.obj: config.h backtrace.h internal.h
testlib.h
+printdwarftest-testlib.o: $(INCDIR)/filenames.h backtrace.h testlib.h
+printdwarftest-testlib.obj: $(INCDIR)/filenames.h backtrace.h testlib.h
...

>> -static int
>> +int
>>  dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
> 
> Ah, I didn't consider this.  We can't do this.  It will break code
> like libsanitizer/libbacktrace/backtrace-rename.h.
> 
> Is there a way that we could run a similar test looking at the output
> of readelf --debug?

No, not really. We're not interested in the contents of the debug
information as such. We're interested in the representation of that
information that libbacktrace builds from it, and the test compares that
representation with and without dwz, to make sure no information got
lost (which could indicate a dwz bug, or a lacking feature in libbacktrace).

With a normal backtrace test, you just ask for information about a
couple of locations.  With this test, you ask for all the information,
giving libbacktrace a probing you just can't get with a normal test, so
I think it's a good idea to have it.

What is an acceptable way to proceed here? I could add a
libbacktrace_nodwarf.la, and have the test-case add a -DFOR_TESTING or
some such when compiling dwarf.c, and add the necessary handling in
dwarf.c conditional on FOR_TESTING. WDYT?

Thanks,
- Tom

  reply	other threads:[~2019-01-22 21:43 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 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 [this message]
2019-01-29 15:31             ` 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 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
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 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 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 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 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 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 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

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=bc287552-0a2a-ac9f-ad68-f4e12e2f5ff2@suse.de \
    --to=tdevries@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ian@airs.com \
    --cc=iant@google.com \
    /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).