Re: [PATCH] Specify a custom git merge driver for ChangeLog files

2018-03-20 Thread Mark Wielaard
On Wed, Mar 21, 2018 at 02:20:51AM +0300, Dmitry V. Levin wrote: > On Wed, Mar 21, 2018 at 12:03:53AM +0100, Mark Wielaard wrote: > > I am not against this, but it could use a bit more documentation > > in at least the commit message, so people know what they should > > set

Re: [PATCH] libdwfl: Use process_vm_readv when available.

2018-03-20 Thread Mark Wielaard
On Wed, Mar 21, 2018 at 02:28:48AM +0300, Dmitry V. Levin wrote: > On Sun, Mar 18, 2018 at 01:43:23AM +0100, Mark Wielaard wrote: > > + /* Let the ptrace fallback deal with the corner case of the address > > + possibly crossing a page boundery. */ > > + if

Re: How to associate Elf with Dwfl_Module returned by dwfl_report_module

2018-03-21 Thread Mark Wielaard
Hi Milian, On Wed, Mar 21, 2018 at 02:01:41PM +0100, Milian Wolff wrote: > Here's the code for the perf tools: > > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/ > perf/util/unwind-libdw.c?h=perf/core#n52 > > Here's the code for the perfparser: > > http://code.qt.io/

Re: How to associate Elf with Dwfl_Module returned by dwfl_report_module

2018-03-21 Thread Mark Wielaard
On Wed, Mar 21, 2018 at 03:23:51PM +0100, Milian Wolff wrote: > Here's one way to investigate where perf and dwfl disagree on the file > mappings: > > diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c > index 7bdd239c795c..739c68b73772 100644 > --- a/tools/perf/util/unw

Re: readelf ignore .debug_pubtypes

2018-03-23 Thread Mark Wielaard
Hi Phi, On Fri, 2018-03-23 at 15:57 +0100, Phi Debian wrote: > DL$ ~/elfutils/src/readelf --debug=pubtypes ./vmlinux  | more > Unknown DWARF debug section `pubtypes'. > > Is that expected ? Unfortunately there is no support for .debug_pubtypes at all in elfutils at the moment. Note that in DWAR

Re: Read .debug_line without .debug_info

2018-03-26 Thread Mark Wielaard
Hi Sasha, On Mon, Mar 26, 2018 at 04:41:06PM +, Sasha Da Rocha Pinheiro wrote: > is it possible to read contents of .debug_line section without the > presence of a .debug_info section? No, because .debug_line sections need some information from the CU which comes from the .debug_info. In part

Re: Relative path X full path

2018-03-26 Thread Mark Wielaard
Hi Sasha, On Mon, Mar 26, 2018 at 04:45:13PM +, Sasha Da Rocha Pinheiro wrote: > I have noticed that when we compile out-of-source, the paths returned > from libdw are gonna be relative. Otherwise, they show up as full path. > Have you noticed it? This might be related to your last question.

Re: Read .debug_line without .debug_info

2018-03-27 Thread Mark Wielaard
On Mon, 2018-03-26 at 21:24 +0200, Torsten Polle wrote: > > > > Am 26.03.2018 um 21:12 schrieb Mark Wielaard : > > On Mon, Mar 26, 2018 at 04:41:06PM +, Sasha Da Rocha Pinheiro wrote: > > > is it possible to read contents of .debug_line section without the >

Re: [PATCH] readelf: Report error when decl_file or call_file attribute is invalid.

2018-03-27 Thread Mark Wielaard
On Tue, 2018-03-20 at 13:33 +0100, Mark Wielaard wrote: > Report an error for why the DW_AT_decl_file or DW_AT_call_file cannot > be resolved to a file name. This is likely invalid DWARF, a missing > DW_AT_stmt_list attribute on the CU or a missing .debug_line section. I pushed this

Re: [PATCH] readelf: Report error when decl_file or call_file attribute is invalid.

2018-03-27 Thread Mark Wielaard
On Tue, 2018-03-27 at 15:42 +0200, Mark Wielaard wrote: > On Tue, 2018-03-20 at 13:33 +0100, Mark Wielaard wrote: > > Report an error for why the DW_AT_decl_file or DW_AT_call_file > > cannot > > be resolved to a file name. This is likely invalid DWARF, a missing > > D

Re: [PATCH] libdwfl: Use process_vm_readv when available.

2018-03-28 Thread Mark Wielaard
On Tue, 2018-03-20 at 23:32 +0100, Mark Wielaard wrote: > On Sun, Mar 18, 2018 at 01:43:23AM +0100, Mark Wielaard wrote: > > If possible use process_vm_readv to read 4K blocks instead of fetching > > each word individually with ptrace. For unwinding this often means we > >

[PATCH] readelf: Break sysv[64] symbol hash bucket chain loops.

2018-03-28 Thread Mark Wielaard
=23011 Signed-off-by: Mark Wielaard --- src/ChangeLog | 6 ++ src/readelf.c | 8 2 files changed, 14 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 1ad6b3d..e8bd6bf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2018-03-28 Mark Wielaard

Re: Relative path X full path

2018-03-29 Thread Mark Wielaard
ed come up more often, and it is a little confusing. So I am proposing the following documentation update to hopefully explain better how to get the absolute path for a file (decl). Hopefully this helps. Cheers, MarkFrom e87cfeb2290bff320c7f0a45f93ba571ffe3c58d Mon Sep 17 00:00:00 2001 From: Mark Wie

[PATCH] libdw: Add support for reading DW_FORM_addrx[1234] in .debug_addr.

2018-03-30 Thread Mark Wielaard
-bit value depending on endianness of the underlying file. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 14 ++ libdw/dwarf_begin_elf.c | 1 + libdw/dwarf_error.c | 3 +- libdw/dwarf_formaddr.c | 113 libdw

[PATCH] libdw: Add support for reading DW_FORM_strx[1234] in .debug_str_offsets.

2018-03-30 Thread Mark Wielaard
Recognize the new .debug_str_offsets section. The CU will now hold a new str_off_base offset in that section for that CU. dwarf_form_string will decode DW_FORM_strx[1234] and return strings using that str_off_base from the .debug_addr. Signed-off-by: Mark Wielaard --- libdw/ChangeLog

Re: Relative path X full path

2018-04-03 Thread Mark Wielaard
On Thu, 2018-03-29 at 14:10 +0200, Mark Wielaard wrote: > It does indeed come up more often, and it is a little confusing. > So I am proposing the following documentation update to hopefully > explain better how to get the absolute path for a file (decl). I did discuss this offlist a

Re: [PATCH] libdw: Add support for reading DW_FORM_addrx[1234] in .debug_addr.

2018-04-03 Thread Mark Wielaard
On Fri, 2018-03-30 at 17:56 +0200, Mark Wielaard wrote: > Recognize the new .debug_addr section. The CU will now hold a new > address base offset in that section for that CU. dwarf_form_addr will > decode DW_FORM_addrx[1234] and return addresses using that address > base from the .d

Re: [PATCH] libdw: Add support for reading DW_FORM_strx[1234] in .debug_str_offsets.

2018-04-03 Thread Mark Wielaard
On Fri, 2018-03-30 at 17:57 +0200, Mark Wielaard wrote: > Recognize the new .debug_str_offsets section. The CU will now hold a new > str_off_base offset in that section for that CU. dwarf_form_string will > decode DW_FORM_strx[1234] and return strings using that str_off_base > from the

[COMMITTED] libdw: Make sure to initialize Dwarf_CU addr_base and str_off_base.

2018-04-04 Thread Mark Wielaard
et up. Shows up as a valgrind warning. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/libdw_findcu.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ee6a1eb..ad62771 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3

[PATCH] libdw: Restructure address range reading for .debug_loc and .debug_ranges.

2018-04-06 Thread Mark Wielaard
This caches the CU base address, makes error checking slight more relaxed and restructures the code so it will be easier to add different forms of ranges. Adds a new test for the new CU base address code. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 30 + libdw

[PATCH] libdwfl: Handle unwind frame when the return address register isn't set.

2018-04-10 Thread Mark Wielaard
s at the end of unwinding the frame that means that either the return address register is bogus (error), or that the return address is undefined (end of the call stack). This fixes the run-backtrace-native-biarch.sh testcase for me on an i386 on x86_64 setup with gcc 7.2.1 and glibc 2.17. Signed-off-by

[PATCH] aarch64: Add default cfi rule to restore SP from CFA address.

2018-04-11 Thread Mark Wielaard
The CFA is set by default to the stack pointer of the previous frame. So that is also how we can always restore the SP. This default aarch64 CFI rule is necessary on Fedora 28 with GCC8 to make the run-deleted.sh and run-backtrace-dwarf.sh testcases work. Signed-off-by: Mark Wielaard

Re: [PATCH] libdw: Restructure address range reading for .debug_loc and .debug_ranges.

2018-04-13 Thread Mark Wielaard
On Fri, 2018-04-06 at 14:27 +0200, Mark Wielaard wrote: > This caches the CU base address, makes error checking slight more relaxed > and restructures the code so it will be easier to add different forms > of ranges. Adds a new test for the new CU base address code. Pushed to master.

Re: [PATCH] aarch64: Add default cfi rule to restore SP from CFA address.

2018-04-13 Thread Mark Wielaard
On Wed, 2018-04-11 at 10:47 +0200, Mark Wielaard wrote: > The CFA is set by default to the stack pointer of the previous frame. > So that is also how we can always restore the SP. This default aarch64 > CFI rule is necessary on Fedora 28 with GCC8 to make the run-deleted.sh > and r

Re: [PATCH] libdwfl: Handle unwind frame when the return address register isn't set.

2018-04-13 Thread Mark Wielaard
On Tue, 2018-04-10 at 16:23 +0200, Mark Wielaard wrote: > When we have unwound the frame and then cannot set the return address > we wouldn't set any error. That meant that a dwfl_thread_getframes () > call could end in an error, but without any dwfl_errno set, producing > the

[COMMITTED] readelf: Only lookup files and show errors in attr_callback when not silent.

2018-04-13 Thread Mark Wielaard
information about the CUs containing pointers into other sections) we don't need to lookup the file names, nor print the errors/warnings. Signed-off-by: Mark Wielaard --- src/ChangeLog | 4 src/readelf.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog

[COMMITTED] readelf: Fix advance_pc to use op_addr_advance, not just op_advance.

2018-04-16 Thread Mark Wielaard
op_advance Completely masking the bug. The libdw dwarf_getsrclines.c implementation does get this right. Because it doesn't care about the data representation and so does the calculation directly. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 2 +- 2 files changed, 6 i

[COMMITTED] tests: Test readelf --debug-dump=[decoded]line with min_inst_len > 1.

2018-04-16 Thread Mark Wielaard
irst fails without the bug fix. The second was already correct. Signed-off-by: Mark Wielaard --- tests/ChangeLog| 6 +++ tests/Makefile.am | 1 + tests/run-readelf-line.sh | 89 + tests/testfile-ppc64-min-instr

Re: [PATCH] libelf: Sync elf.h from glibc

2018-04-23 Thread Mark Wielaard
On Thu, 2018-04-19 at 17:47 +0200, Andreas Schwab wrote: > +2018-04-19  Andreas Schwab   > + > + * elf.h: Update from glibc. Thanks. Pushed to master.

Re: [PATCH] Add support for RISC-V

2018-04-23 Thread Mark Wielaard
Hi Andreas, On Thu, Apr 19, 2018 at 05:47:52PM +0200, Andreas Schwab wrote: > This implements initial support for the RISC-V architecture. It has > been tested with qemu linux-user emulation > , >

[PATCH] readelf: Use raw section data if nothing is available through libdw.

2018-04-24 Thread Mark Wielaard
se we want to try to parse the "raw" section data. Signed-off-by: Mark Wielaard --- src/ChangeLog | 13 + src/readelf.c | 33 + 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3df62a0..55c5e

[PATCH] libdw: Handle DW_FORM_line_strp.

2018-04-25 Thread Mark Wielaard
DW_FORM_line_strp strings come from a separate .debug_line_str section. Make error messages more distinct (no .debug_str, no .debug_line_str or not a string form). Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 10 ++ libdw/dwarf_begin_elf.c | 1 + libdw/dwarf_error.c

[PATCH] readelf: Handle .debug_line_str section.

2018-04-25 Thread Mark Wielaard
It is just a .debug_str section with another name. Signed-off-by: Mark Wielaard --- src/ChangeLog | 7 +++ src/readelf.c | 21 + 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7764482..4b55bbc 100644 --- a/src

[PATCH] libebl: Add new DWARF5 debug section names to default_debugscn_p.

2018-04-25 Thread Mark Wielaard
x and .debug_tu_index, nor the .debug_sup section for supplemental DWARF files. Signed-off-by: Mark Wielaard --- libebl/ChangeLog| 6 ++ libebl/eblopenbackend.c | 7 +++ 2 files changed, 13 insertions(+) diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 66e8aa3..aa82e3a 100644

Re: [PATCH] libdw: Handle DW_FORM_line_strp.

2018-05-06 Thread Mark Wielaard
On Wed, Apr 25, 2018 at 01:23:27PM +0200, Mark Wielaard wrote: > DW_FORM_line_strp strings come from a separate .debug_line_str section. > Make error messages more distinct (no .debug_str, no .debug_line_str or > not a string form). Pushed to master.

Re: [PATCH] readelf: Handle .debug_line_str section.

2018-05-06 Thread Mark Wielaard
On Wed, Apr 25, 2018 at 01:24:18PM +0200, Mark Wielaard wrote: > It is just a .debug_str section with another name. Pushed to master.

Re: [PATCH] libebl: Add new DWARF5 debug section names to default_debugscn_p.

2018-05-06 Thread Mark Wielaard
On Wed, Apr 25, 2018 at 01:24:37PM +0200, Mark Wielaard wrote: > This adds the new DWARF5 debug section names .debug_addr, .debug_line_str, > .debug_loclists, .debug_names, .debug_rnglists and .debug_str_offsets. This > makes sure eu-strip knows to strip them away. > > Note that

[PATCH] libdw: Handle DWARF5 line tables in dwarf_getsrclines.

2018-05-07 Thread Mark Wielaard
ments. But the original old DWARF code path didn't really change. Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 8 + libdw/dwarf.h | 11 ++ libdw/dwarf_getsrclines.c | 437 +++-- libdw/libdwP.h

[PATCH] libdw: Handle DW_FORM_[ref|strp]_sup[48] as DW_FORM_GNU_[ref|strp]_alt.

2018-05-08 Thread Mark Wielaard
Although we don't yet handle DWARF5 supplemental files, they are like mostly like GNU alt files. This way using any of the supplemental files will at least generate an appropriate error message. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 9 + libdw/dwarf_form

[PATCH] readelf: Handle .debug_info first if any other debug section needs it.

2018-05-08 Thread Mark Wielaard
section. Signed-off-by: Mark Wielaard --- src/ChangeLog | 7 +++ src/readelf.c | 39 ++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index b1041a8..a6ee30b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog

[PATCH] libdw: Fix crashing on illegal/zero Dwarf_Die.

2018-05-11 Thread Mark Wielaard
might use the cu before realizing the Dwarf_Die is invalid. Fix this with an explicit NULL check and add a testcase. Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 6 +++ libdw/dwarf_siblingof.c| 5 ++- libdw/libdwP.h | 2 + tests/ChangeLog

[PATCH] readelf: Add DWARF5 .debug_line support.

2018-05-11 Thread Mark Wielaard
format is also cleaned up a bit so that it better lines out. Testcases adjusted and new ones added. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 7 + libdw/dwarf_formstring.c| 17 -- libdw/libdwP.h | 107 ++- src/ChangeLog | 11 + src

[PATCH] readelf, libdw: Handle DWARF5 .debug_macro.

2018-05-11 Thread Mark Wielaard
through DW_MACRO_import_sup. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 8 ++ libdw/dwarf_formudata.c | 1 + libdw/dwarf_getmacros.c | 42 + src/ChangeLog | 5 src/readelf.c | 70

Re: [PATCH] libdw: Handle DWARF5 line tables in dwarf_getsrclines.

2018-05-11 Thread Mark Wielaard
On Tue, 2018-05-08 at 00:06 +0200, Mark Wielaard wrote: > In DWARF5 the actual line number table format doesn't change, except for > not allowing DW_LNE_define_file (but we still just accept it). The > changes are the header having new fields for address and segment > select

Re: [PATCH] libdw: Handle DW_FORM_[ref|strp]_sup[48] as DW_FORM_GNU_[ref|strp]_alt.

2018-05-11 Thread Mark Wielaard
On Tue, 2018-05-08 at 15:42 +0200, Mark Wielaard wrote: > Although we don't yet handle DWARF5 supplemental files, they are like > mostly like GNU alt files.  This way using any of the supplemental files > will at least generate an appropriate error message. Pushed to master.

Re: [PATCH] readelf: Handle .debug_info first if any other debug section needs it.

2018-05-11 Thread Mark Wielaard
On Tue, 2018-05-08 at 16:49 +0200, Mark Wielaard wrote: > Some debug sections need information from the CU DIEs to properly > parse the data. Normally the .debug_info section is one of the first. > But some DWARF producers reorder the sections and put it after some > other debug se

Re: [PATCH] readelf: Use raw section data if nothing is available through libdw.

2018-05-11 Thread Mark Wielaard
On Tue, 2018-04-24 at 16:17 +0200, Mark Wielaard wrote: > For various debug data sections readelf has its own parsers that don't > rely on libdw data structures or functions. But we still like to get the > data through libdw since that will be uncompressed and/or relocated. >

[PATCH] addr2line: Add explicit fflush for stdout when reading from stdin.

2018-05-12 Thread Mark Wielaard
To make it possible to use eu-addr2line interactively through a pipe we need to explicitly flush stdout after handling each line from stdin. https://sourceware.org/bugzilla/show_bug.cgi?id=23173 Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/addr2line.c | 1 + 2 files changed

Re: [PATCH] libdw: Fix crashing on illegal/zero Dwarf_Die.

2018-05-15 Thread Mark Wielaard
On Fri, 2018-05-11 at 12:49 +0200, Mark Wielaard wrote: > In some cases we create an illegal Dwarf_Die by clearing all fields. > The idea is that dwarf_tag () on such a Dwarf_Die will return > DW_TAG_invalid, to indicate that the Dwarf_Die is unusable (and other > functions will also r

Re: [PATCH] readelf: Add DWARF5 .debug_line support.

2018-05-15 Thread Mark Wielaard
On Fri, 2018-05-11 at 14:28 +0200, Mark Wielaard wrote: > This only changes the parsing of the directory and file name tables. > It does this by sharing the printing of (non-CU based) from data from > the .debug_macro code. Adding support for printing strx[1234] form > data > by s

Re: [PATCH] readelf, libdw: Handle DWARF5 .debug_macro.

2018-05-15 Thread Mark Wielaard
On Fri, 2018-05-11 at 15:38 +0200, Mark Wielaard wrote: > Almost identical to GNU .debug_macro extension. Just accept and use > DW_AT_macros where we accept or use DW_AT_GNU_macros. And be a little > stricter in which FORMs we accept (this could have caused problems > with the GNU

[COMMITTED] readelf: Fix 32bit compile issues.

2018-05-15 Thread Mark Wielaard
The buildbot flagged a couple of issues on debian-i686. Fixes pushed to master. Signed-off-by: Mark Wielaard --- src/ChangeLog | 6 ++ src/readelf.c | 10 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4e6887e..419fa20 100644

[PATCH] libdw, readelf: Handle .debug_*.dwo section name variants.

2018-05-15 Thread Mark Wielaard
dwarf with their skeleton (or the other way around). It also doesn't yet handle any special split-dwarf attributes or tags. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/dwarf_begin_elf.c | 31 +-- src/ChangeLog | 4 src

[PATCH] libdw: Add GNU DebugFission attributes, tags, forms and operands.

2018-05-15 Thread Mark Wielaard
Most are handled just like their DWARF5 counterparts. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 20 libdw/dwarf.h | 16 libdw/dwarf_formaddr.c| 4 +++- libdw/dwarf_formstring.c | 3 ++- libdw/dwarf_formudata.c | 2

[PATCH] libdw: Recognize GNU DebugFission split units.

2018-05-15 Thread Mark Wielaard
The split dwarf dwo unit id and type are not in the CU header itself, but can be found in the CU DIE DW_AT_GNU_dwo attributes. Use this to set the correct unit_type and id for GNU DebugFission split units. Also show this information in eu-readelf when printing units. Signed-off-by: Mark Wielaard

Re: [PATCH] backends: add checks for _GLOBAL_OFFSET_TABLE_ and __global_pointer$ on riscv

2018-05-15 Thread Mark Wielaard
On Tue, 2018-05-15 at 13:47 +0200, Andreas Schwab wrote: > + > + * riscv_init.c (riscv_init): Hook check_special_symbol. > + * riscv_symbol.c (riscv_check_special_symbol): New function. Looks good. Pushed. I assume this solves some of the self-tests in make check on riscv. Is there an EL

Re: [PATCH] elflint: fix typo in error diagnostics

2018-05-15 Thread Mark Wielaard
Hi Dmitry, On Tue, May 15, 2018 at 06:34:57PM +0300, Dmitry V. Levin wrote: > +2018-05-15 Dmitry V. Levin > + > + * elflint.c (check_elf_header): Fix typo in error diagnostics. Thanks for spotting this. Looks good. But all contributions need an explicit Signed-off-by line. Could you take a

Re: [PATCH v2] elflint: fix typo in error diagnostics

2018-05-15 Thread Mark Wielaard
On Tue, May 15, 2018 at 11:18:43PM +0300, Dmitry V. Levin wrote: > Signed-off-by: Dmitry V. Levin Great. Pushed. Thanks, Mark

[PATCH] libdw: dwarf_get_units find split units from .dwo.

2018-05-16 Thread Mark Wielaard
str_offsets_base_off which is tested in the new testcase (by getting the name of the split CU DIE). Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 15 + libdw/Makefile.am | 3 +- libdw/dwarf_end.c | 5 ++ libdw/dwarf_get_units.c

[PATCH] libdw: Search skeleton DIE for split compile unit DIE attributes.

2018-05-17 Thread Mark Wielaard
dwarf_attr_integrate and dwarf_hasattr_integrate should also search for attributes from the skeleton DIE in case the given DIE is a split compile unit DIE. Split compile unit DIEs inherit various attributes from their skeleton unit DIE in DWARF5. Signed-off-by: Mark Wielaard --- libdw/ChangeLog

[PATCH] libdw: Cache ELF directory early. Explicitly set it in dwfl.

2018-05-17 Thread Mark Wielaard
set it if it has recorded it. Which it will do now before closing a file descriptor for the main Dwfl_Module file. Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 15 ++ libdw/dwarf_begin_elf.c| 24 +++ libdw/dwarf_end.c | 3

[PATCH] libdw: Handle split dwarf debuglines.

2018-05-18 Thread Mark Wielaard
n (at offset zero). To get the full line table use the skeleton DIE (which does have a DW_AT_stmt_list). Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 9 +++ libdw/dwarf_getsrcfiles.c | 50 --- libdw/dwarf_getsrclines.c | 25 ++

Re: [PATCH] libdw, readelf: Handle .debug_*.dwo section name variants.

2018-05-19 Thread Mark Wielaard
On Tue, May 15, 2018 at 12:33:33PM +0200, Mark Wielaard wrote: > The .debug_*.dwo section names are handled just like their none .dwo > variants. The section contents is the same as sections without the .dwo > name, but they are only found in split-dwarf files. This patch allows >

Re: [PATCH] libdw: Add GNU DebugFission attributes, tags, forms and operands.

2018-05-19 Thread Mark Wielaard
On Tue, May 15, 2018 at 01:27:00PM +0200, Mark Wielaard wrote: > Most are handled just like their DWARF5 counterparts. Pushed to master.

Re: [PATCH] libdw: Recognize GNU DebugFission split units.

2018-05-19 Thread Mark Wielaard
On Tue, May 15, 2018 at 02:04:31PM +0200, Mark Wielaard wrote: > The split dwarf dwo unit id and type are not in the CU header itself, but > can be found in the CU DIE DW_AT_GNU_dwo attributes. Use this to set the > correct unit_type and id for GNU DebugFission split units. Also

[PATCH] libdw: Handle GNU DebugFission split ranges.

2018-05-19 Thread Mark Wielaard
split unit DIE from the skeleton. A new testcase is added to iterate over all ranges in a split GNU DebugFission file. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 12 libdw/dwarf_formudata.c | 50 +-- libdw/dwarf_highpc.c

Re: [PATCH] libdw: dwarf_get_units find split units from .dwo.

2018-05-19 Thread Mark Wielaard
On Wed, May 16, 2018 at 09:15:01PM +0200, Mark Wielaard wrote: > For a skeleton DIE dwarf_get_units should provide the split DIE as subdie. > This implements that by trying to find the (named) .dwo file and finding > the matching CU in it. The .dwo file is search relative to the current &

[COMMITTED] Mark __libdw_find_split_unit mark as internal_function.

2018-05-19 Thread Mark Wielaard
As pointed out by the i386-debian buildbot. The prototype and definition should match. On i386 this is important because it changes the calling convention. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 4 libdw/libdwP.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff

Re: [PATCH] libdw: Search skeleton DIE for split compile unit DIE attributes.

2018-05-20 Thread Mark Wielaard
On Thu, May 17, 2018 at 01:28:25PM +0200, Mark Wielaard wrote: > dwarf_attr_integrate and dwarf_hasattr_integrate should also search > for attributes from the skeleton DIE in case the given DIE is a split > compile unit DIE. Split compile unit DIEs inherit various attributes > from th

[PATCH] libdw: Add new dwarf_cu_info function.

2018-05-20 Thread Mark Wielaard
through some other way. Add a new testcase to make sure the results of calling dwarf_cu_info and dwarf_get_units are consistent. Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 7 + libdw/Makefile.am | 2 +- libdw/dwarf_cu_info.c | 103 + libdw/libdw.h | 14

[PATCH] readelf: print split CUs when given --debug-dump=info+

2018-05-20 Thread Mark Wielaard
_all_call_sites (flag_present) yes {2b}base_typeabbrev: 3 byte_size(data1) 4 encoding (data1) signed (5) name (string) "int" Signed-off-by: Mark Wielaard --- src/ChangeLog | 12 ++ src/readelf.c | 107

Re: [PATCH] libdw: Cache ELF directory early. Explicitly set it in dwfl.

2018-05-20 Thread Mark Wielaard
On Thu, May 17, 2018 at 07:43:42PM +0200, Mark Wielaard wrote: > The logic that finds alt files and dwo files relies on having an open > file descriptor. But after all needed ELF data has been read the > underlying Elf file descriptor can be closed. libdwfl in particular > closes fil

[PATCH] libdw: Support DW_OP_addrx/constx and split DWARF addrx/constx support.

2018-05-22 Thread Mark Wielaard
ibute pair) to run-all-dwarf-ranges.sh. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 19 libdw/dwarf_begin_elf.c | 27 + libdw/dwarf_end.c | 12 ++- libdw/dwarf_formaddr.c| 18 libdw/dwarf_formudata.c

[PATCH] libdw: Handle all address FORMs for dwarf_highpc, handle errors better.

2018-05-22 Thread Mark Wielaard
he same as the attribute not being there. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 7 +++ libdw/dwarf_getlocation.c | 17 - libdw/dwarf_highpc.c | 10 ++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libdw/ChangeLog b/libdw

Re: [PATCH] libdw: Handle split dwarf debuglines.

2018-05-22 Thread Mark Wielaard
On Fri, 2018-05-18 at 12:58 +0200, Mark Wielaard wrote: > Split DWARF .dwo files do contain a .debug_line section, but only with > the file table, there is no actual line program. Also split DWARF CU DIEs > don't have a DW_AT_stmt_list attribute. To get at the file (and dir) table

Re: get backtrace of KVM VM from host

2018-05-22 Thread Mark Wielaard
Hi, On Mon, 2018-05-21 at 10:26 +0200, Justin Cinkelj wrote: > Is it possible to get stack backtrace into KVM VM from the host side? > So  > if I run './stack -p PID' (stack from elfutilfs  > https://sourceware.org/elfutils/), I get backtrace of some process. I  > would like to do the same for VM.

Re: [PATCH] libdw: Handle GNU DebugFission split ranges.

2018-05-22 Thread Mark Wielaard
On Sat, May 19, 2018 at 04:03:51PM +0200, Mark Wielaard wrote: > GNU DebugFission split dwarf handles DW_FORM_sec_offset specially for > attributes that point to ranges. The .debug_ranges section is not in > the .dwo file, but in the main/skeleton object file. The sec_offset is > not r

[PATCH] readelf: Add .debug_rnglists support.

2018-05-23 Thread Mark Wielaard
Parse the .debug_rnglists section for DWARF5 --debug-dump=ranges. Add testcase to show both "normal" and "split" DWARF variants are handled for DWARF4 and DWARF5. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 11 + libdw/dwarf.h | 13 ++ lib

Re: [PATCH] libdw: Handle GNU DebugFission split ranges.

2018-05-24 Thread Mark Wielaard
On Sat, 2018-05-19 at 16:03 +0200, Mark Wielaard wrote: > GNU DebugFission split dwarf handles DW_FORM_sec_offset specially for > attributes that point to ranges. The .debug_ranges section is not in > the .dwo file, but in the main/skeleton object file. The sec_offset is > not reloc

Re: [PATCH] libdw: Add new dwarf_cu_info function.

2018-05-24 Thread Mark Wielaard
On Sun, 2018-05-20 at 15:21 +0200, Mark Wielaard wrote: > This allows getting a (split) subdie lazily, only when needed. > All arguments to dwarf_get_units are optional. When not given > then unit DIE and sub DIE are not looked up. This new function > allows them to be looked

Re: [PATCH] readelf: print split CUs when given --debug-dump=info+

2018-05-24 Thread Mark Wielaard
On Sun, 2018-05-20 at 21:28 +0200, Mark Wielaard wrote: > To show the difference between "regular" CUs and split CUs print > offsets and references between { and } instead of [ and ]. > > When --debug-dump=info+ is given (implied by -w) instead of > --debug-dump=info

Re: dwarf_begin_elf() won't create handle without .debug_* sections

2018-05-24 Thread Mark Wielaard
On Wed, 2018-05-23 at 20:09 +, Sasha Da Rocha Pinheiro wrote: > Hi all,  > > I have some binaries that do not have .debug_* sections but have > .eh_frame and .gcc_except_table. > Looking at: > https://sourceware.org/git/?p=elfutils.git;a=blob;f=libdw/dwarf_b > egin_elf.c;hb=144b73c49acf3ed

[PATCH] libdw: Handle .debug_rnglists in dwarf_ranges.

2018-05-24 Thread Mark Wielaard
Handle all new DW_RLE opcodes in .debug_rnglists in dwarf_ranges. Extract code for reading .debug_addr indexes from dwarf_formaddr as __libdw_addrx to reuse in __libdw_read_begin_end_pair_inc. And add new testcase. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 15

[PATCH] readelf: Find skeleton units when inspecting split .dwo (--dwarf-skeleton).

2018-05-25 Thread Mark Wielaard
ons(+), 43 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index b19ebe9..0f835e2 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,9 @@ +2018-05-25 Mark Wielaard + + * libdw_find_split_unit.c (__libdw_find_split_unit): Extract linking + skeleton and split compile

Re: [PATCH] libdw: Support DW_OP_addrx/constx and split DWARF addrx/constx support.

2018-05-25 Thread Mark Wielaard
On Tue, 2018-05-22 at 13:10 +0200, Mark Wielaard wrote: > DW_OP_addrx/constx and GNU DebugFission DW_OP_GNU_addr/const_index take > as argument an index into the .debug_addr section for the associated CU. > This index gets resolved through dwarf_getlocation_attr. A new fake addr > C

Re: [PATCH] libdw: Handle all address FORMs for dwarf_highpc, handle errors better.

2018-05-25 Thread Mark Wielaard
On Tue, 2018-05-22 at 14:44 +0200, Mark Wielaard wrote: > dwarf_highpc can use any address FORM, not just DW_FORM_addr. Just try > whether the address can be resolved as address. Always set error when > attribute couldn't be found or resolved. When calculating the base > address f

[COMMITTED] __libdw_cu_addr_base: Cast offset to uintptr_t before returning as pointer.

2018-05-25 Thread Mark Wielaard
: all warnings being treated as errors Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 5 + libdw/dwarf_getlocation_attr.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 526c91f..fd59a24 100644 --- a/libdw

[PATCH] libdwfl: Allow partial relocations also for debug files.

2018-05-27 Thread Mark Wielaard
files. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 + libdwfl/relocate.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index d69fe0c..34aa07d 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2018

[PATCH] readelf: Handle .debug_loclists.

2018-05-27 Thread Mark Wielaard
The new DWARF5 .debug_loclists sections are like .debug_rnglists, but plus locations. For Split Dwarf GCC generates the .debug_loclists fully in the split .dwo file. Any references to addresses need to be resolved through the skeleton .debug_addr section. Signed-off-by: Mark Wielaard --- libdw

Re: [PATCH] readelf: Add .debug_rnglists support.

2018-05-27 Thread Mark Wielaard
On Wed, May 23, 2018 at 04:29:56PM +0200, Mark Wielaard wrote: > Parse the .debug_rnglists section for DWARF5 --debug-dump=ranges. > Add testcase to show both "normal" and "split" DWARF variants are > handled for DWARF4 and DWARF5. Pushed to master.

[PATCH] libdw: Handle .debug_loclists in dwarf_getlocation.

2018-05-28 Thread Mark Wielaard
/ml/gcc-patches/2018-05/msg01562.html Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 17 libdw/dwarf_begin_elf.c | 27 +++ libdw/dwarf_end.c| 5 ++ libdw/dwarf_getlocation.c| 99 --- libdw

Re: [PATCH] libdw: Handle .debug_rnglists in dwarf_ranges.

2018-05-28 Thread Mark Wielaard
On Thu, 2018-05-24 at 21:08 +0200, Mark Wielaard wrote: > Handle all new DW_RLE opcodes in .debug_rnglists in dwarf_ranges. Extract > code for reading .debug_addr indexes from dwarf_formaddr as __libdw_addrx > to reuse in __libdw_read_begin_end_pair_inc. And add new testcase. Pushe

[PATCH] readelf handle .debug_addr section.

2018-05-28 Thread Mark Wielaard
[GNU_]_addr_base offsets. Signed-off-by: Mark Wielaard --- src/ChangeLog | 12 ++ src/readelf.c | 267 +++- tests/ChangeLog | 7 ++ tests/Makefile.am | 2 + tests/run-readelf-addr.sh

[PATCH] readelf: Handle .debug_str_offsets.

2018-05-28 Thread Mark Wielaard
) file, never in the main (skeleton) file. For DWARF5 the (non-split) unit DIE will have a DW_AT_str_offsets_base attribute pointing at the actual index (after the header). The split unit will never have this attribute (and use the table at offset zero). Signed-off-by: Mark Wielaard --- src

Re: [PATCH] readelf: Find skeleton units when inspecting split .dwo (--dwarf-skeleton).

2018-05-28 Thread Mark Wielaard
On Fri, 2018-05-25 at 14:43 +0200, Mark Wielaard wrote: > To get the right context (especially addresses) when looking at a .dwo file > we really need the skeleton file.  If we can find it (simply replace .dwo > with .o) then use that to get to the split DWARF units so that libdw sets

[PATCH] libdw: Fix memory corruption in libdw_find_split_unit.

2018-05-28 Thread Mark Wielaard
make distcheck) before the fix. Signed-off-by: Mark Wielaard --- libdw/ChangeLog| 5 + libdw/libdw_find_split_unit.c | 11 +-- src/ChangeLog | 5 + src/readelf.c | 2 +- tests/ChangeLog| 6 ++ tests/Makefi

[PATCH] readelf: Fix regression with multiple files and implicit debug_info reading.

2018-05-29 Thread Mark Wielaard
needed. Fix by resetting the implicit and explicit section printing flags. Add a testcase that prints the .debug_loc section for two files and check that the CUs are resolved. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 10 +-

[PATCH] readelf, libdw: Add GNU DebugFission .debug_loc support.

2018-05-29 Thread Mark Wielaard
GNU DebugFission .debug_loc location lists uses the .debug_loc section in the split dwarf .dwo file. The encoding is a mix of old style DWARF .debug_loc and new style .debug_loclists. Add two testcases for the readelf and libdw decoders. Signed-off-by: Mark Wielaard --- libdw/ChangeLog

Re: [PATCH] libdwfl: Allow partial relocations also for debug files.

2018-05-29 Thread Mark Wielaard
On Sun, 2018-05-27 at 14:13 +0200, Mark Wielaard wrote: > __libdwfl_relocate is called for get_dwarf and get_elf. We allow not all > relocations to be resolved for Elf files, but required all relocations > (in the debug sections) to be fully resoled in Dwarf files. This used to > mos

Re: [PATCH] readelf: Handle .debug_loclists.

2018-05-29 Thread Mark Wielaard
On Sun, 2018-05-27 at 14:25 +0200, Mark Wielaard wrote: > The new DWARF5 .debug_loclists sections are like .debug_rnglists, but > plus locations. For Split Dwarf GCC generates the .debug_loclists fully > in the split .dwo file. Any references to addresses need to be resolved > through

<    5   6   7   8   9   10   11   12   13   14   >