This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libdw: Search for the last matching address with dwarf_getsrc_die.


On Sat, 2014-12-27 at 16:49 +0100, Mark Wielaard wrote:
> I think you are right and those tests, addrscopes and funcscopes, are
> wrong. They use dwfl_module_getsrc to find the line associated with start
> and end of the scope. But for the end they use the value of the high_pc
> attribute. The high_pc attributes indicates the first address beyond
> the current scope of the associated DIE. So the tests should use
> highpc - 1 as end of scope.
> 
> I created a patch to change dwfl_module_getsrc to not match against
> a line with end_sequence set, changed the tests to use highpc -1.
> And adjusted this patch for dwarf_getsrc_die. to match the new
> behavior. Do those changes look correct to you?

Those are the following 2 commits on the mjw/pending branch:

commit f5ea852c13d94fc04cdbd1d49c9185246d78fc62
Author: Mark Wielaard <mjw@redhat.com>
Date:   Wed Dec 24 13:17:23 2014 +0100

    libdw: Search for the last matching address with dwarf_getsrc_die.
    
    In commit 7d9b5a dwfl_module_getsrc was changed so that it returns the last
    line record <= addr, rather than returning immediately on a match. This
    changes dwarf_getsrc_die to do the same. And it adds a new test that checks
    this by comparing against the same results from eu-addr2line (which uses
    dwfl_module_getsrc) using dwarf_addrdie and dwarf_getsrc_die instead.
    
    Signed-off-by: Mark Wielaard <mjw@redhat.com>

commit bc000d1b457dfec65c20d43abd0dcc634f2e43cb
Author: Mark Wielaard <mjw@redhat.com>
Date:   Sat Dec 27 16:16:29 2014 +0100

    libdwfl: dwfl_module_getsrc should never match end_sequence line.
    
    The line with end_sequence set has an address outside the current line
    sequence. An end_sequence line has no other useful information except
    marking the address as out of range.
    
    Two tests, addrscopes and funcscopes, depended on matching the end_sequence
    line. But that was because they included the high_pc address in the scope.
    However the high_pc attributes has as address the first location past the
    range associated with a given DIE. Adjust the tests to use high_pc - 1 as
    end of the scope.
    
    Signed-off-by: Mark Wielaard <mjw@redhat.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]