public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: Mark Wielaard <mark@klomp.org>
Cc: libabigail@sourceware.org, dodji@seketeli.org,
	gprocida@google.com, kernel-team@android.com,
	Dan Albert <danalbert@google.com>
Subject: Re: [PATCH 3/3] dwarf-reader: Ignore zero length location expressions from DW_AT_location
Date: Thu, 29 Oct 2020 14:29:33 +0000	[thread overview]
Message-ID: <20201029142933.GB787461@google.com> (raw)
In-Reply-To: <96ce118ec34004439e7e83360e6b08b47117cd93.camel@klomp.org>

Hi Mark!

On Thu, Oct 29, 2020 at 03:00:20PM +0100, Mark Wielaard wrote:
>Hi,
>
>On Thu, 2020-10-29 at 12:30 +0000, Matthias Maennich wrote:
>> On Thu, Oct 29, 2020 at 12:21:00PM +0000, Matthias Maennich wrote:
>> > Location expressions might occasionally be of length 0. E.g. a reason
>> > for that are thread local variables that do not exactly have a location
>> > to refer to. Compilers/Linkers may choose an odd representation. E.g.
>> > see the dwarfdump output for the added testcase based on libandroid.so
>> > (from AOSP).
>
>I don't think it is "odd", it is simply an empty location expression,
>which is defined as no location known.

You are right. I will use the 'empty location expression' terminology
instead.

>
>> > The DW_AT_location is properly read by elfutils' dwarf_location(), but
>> > is not useful for us to proceed with. Hence early exit on this.
>> >
>> > 	* src/abg-dwarf-reader.cc (die_location_expr): Ignore zero
>> > 	  length location expressions.
>> > 	* tests/data/Makefile.am: Add new test files.
>> > 	* tests/data/test-read-dwarf/test-libandroid.so: New test file.
>> > 	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
>> > 	* tests/test-read-dwarf.cc: Add new test case.
>> >
>> > Reported-by: Dan Albert <danalbert@google.com>
>> > Reviewed-by: Giuliano Procida <gprocida@google.com>
>> > Cc: Mark Wielaard <mark@klomp.org>
>> > Signed-off-by: Matthias Maennich <maennich@google.com>
>
>> [...]
>
>>   // Ignore invalid location expressions where reading them succeeded but their
>>   // length is 0.
>>   result &= len > 0;
>
>The actual code change looks correct, but I would like the comment to
>not say they are invalid (if they were dwarf_getlocation would have
>returned an error), but that an empty location expression represents an
>unknown location (and so it is indeed not very useful).
>
>See also DWARFv5 2.6.1.1.1 Empty Location Descriptions
>
>   An empty location description consists of a DWARF expression
>   containing no operations. It represents a piece or all of an object
>   that is present in the source but not in the object code (perhaps
>   due to optimization).
>

I dropped the "invalid" wording everywhere after your last comment, but
forgot to change this very line :-/

I updated code change and commit message and pushed a new version to
Github:
https://github.com/metti/libabigail/commit/eb8c694cbc1e8a8c3d08872930af1a30df9f6d05

Cheers,
Matthias

>Cheers,
>
>Mark

  reply	other threads:[~2020-10-29 14:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 12:20 [PATCH 1/3] Improve and stabilise sort of member functions Matthias Maennich
2020-10-29 12:20 ` [PATCH 2/3] Improve enum synthetic type names Matthias Maennich
2020-11-02 16:46   ` Dodji Seketeli
2020-10-29 12:21 ` [PATCH 3/3] dwarf-reader: Ignore zero length location expressions from DW_AT_location Matthias Maennich
2020-10-29 12:30   ` Matthias Maennich
2020-10-29 14:00     ` Mark Wielaard
2020-10-29 14:29       ` Matthias Maennich [this message]
2020-11-02 17:08         ` Dodji Seketeli
2020-11-02 16:48     ` Dodji Seketeli
2020-11-02 15:34 ` [PATCH 1/3] Improve and stabilise sort of member functions Dodji Seketeli

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=20201029142933.GB787461@google.com \
    --to=maennich@google.com \
    --cc=danalbert@google.com \
    --cc=dodji@seketeli.org \
    --cc=gprocida@google.com \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    --cc=mark@klomp.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).