Re: [PATCH] libebl: Don't assume ELF notes are "GNU" when unknown, recognize "Go" notes.

2016-02-14 Thread Jan Kratochvil
On Fri, 12 Feb 2016 15:10:46 +0100, Mark Wielaard wrote: > We used to assume any unknown ELF note provider name was "GNU" and didn't > recognize any of the "Go" provider types. We now check the provider name > explictly in ebl_object_note_type_name and recognize the following Go > note names: PKGLI

Re: [PATCH] Add NT_ARM_SYSTEM_CALL aarch64 syscall regset.

2016-02-14 Thread Jan Kratochvil
On Fri, 12 Feb 2016 18:05:42 +0100, Mark Wielaard wrote: > Linux kernel 3.18 added the NT_ARM_SYSTEM_CALL regset for aarch64. > Recognize and print this new core item. It works and looks OK to me FYI. Thanks, Jan

Re: [PATCH] libdwfl: Report core module segment even when NT_FILE build-id doesn't match.

2015-06-07 Thread Jan Kratochvil
On Sat, 06 Jun 2015 16:00:08 +0200, Mark Wielaard wrote: > dwfl_segment_report_module can take the NT_FILE note contents to find > the matching file for the module on the file system from the core file. > If the file exists but the build-id didn't match we would not report the > module. But we shou

[commit] [patch] libelf: Consider sh_addralign 0 as 1

2015-02-07 Thread Jan Kratochvil
On Fri, 06 Feb 2015 09:04:25 +0100, Mark Wielaard wrote: > I do think that is by accident, and actually a bug. It might be that no > alignment works here because the result isn't relinked ever and they > make sure the ELF file they write out is hand aligned. But it is at > least a little sloppy. If

[patch] libelf: Consider sh_addralign 0 as 1

2015-02-05 Thread Jan Kratochvil
ot;.rel.plt"); ELF spec says: Values 0 and 1 mean the section has no alignment constraints. and libelf/elf32_updatenull.c really parses it that way at line 204 ElfW2(LIBELFBITS,Word) sh_align = shdr->sh_addralign ?: 1; but unfortunately the later line

Re: [COMMITTED] libdwfl: Remove p_align sanity check from elf_from_memory.

2014-12-19 Thread Jan Kratochvil
On Fri, 19 Dec 2014 19:06:33 +0100, Mark Wielaard wrote: > At least aarch64 puts 0xA as p_align value in the phdrs. OK, I agree 0xa is bogus. Jan

Re: [COMMITTED] libdwfl: Remove p_align sanity check from elf_from_memory.

2014-12-19 Thread Jan Kratochvil
On Fri, 19 Dec 2014 18:13:04 +0100, Mark Wielaard wrote: > But on some architectures the kernel inserts a vdso with > a completely bogus p_align for some PT_LOAD segments. It would be better to know what is "some" and what is "bogus". Jan

Re: [PATCH] tests: Add an explicit -fasynchronous-unwind-tables for deleted-lib.so.

2014-12-13 Thread Jan Kratochvil
On Fri, 12 Dec 2014 21:55:31 +0100, Mark Wielaard wrote: > Some systems don't add a PT_GNU_EH_FRAME segment by default, but the > deleted test depends on it so that it can get at the .eh_frame_hdr table > through the phdrs from the remote memory ELF image. Request one explicitly > with -fasynchrono

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-27 Thread Jan Kratochvil
On Thu, 27 Nov 2014 12:17:39 +0100, Mark Wielaard wrote: > On Wed, 2014-11-26 at 15:44 +0100, Jan Kratochvil wrote: > > I was trying to figure out some more generic functionality than > > --core-pattern > > but given that for core_pattern one needs to: > > P

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-27 Thread Jan Kratochvil
On Thu, 27 Nov 2014 12:05:51 +0100, Mark Wielaard wrote: > We have -o,--output support in other utilities. Those are ld, strip and unstrip. That is not for text output but for the resulting ELF files which is IMO a different case. BTW I am not against it, I just find it redundant. If thiAny pro

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-27 Thread Jan Kratochvil
On Thu, 27 Nov 2014 12:04:39 +0100, Mark Wielaard wrote: > On Wed, 2014-11-26 at 15:32 +0100, Jan Kratochvil wrote: > > Therefore they are dead at the core_pattern time, they cannot be ptraced and > > therefore they cannot be unwound. One could only find them in the core file >

[patchv3] Add --core-pattern option to eu-stack

2014-11-26 Thread Jan Kratochvil
implemented as a demo in eu-stack's core_pattern function invoked by eu-stack's --core-pattern option. The code of core_pattern function has been suggested by Oleg Nesterov. src/ 2014-11-26 Jan Kratochvil * stack.c: Include sys/ptrace.h and sys/wait.h. (OPT_CO

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-26 Thread Jan Kratochvil
On Wed, 26 Nov 2014 21:08:22 +0100, Oleg Nesterov wrote: > Yes. I guess PTRACE_ATTACH should work but it is pointless, this > thread can't report an event and other ptrace requests won't work. > > In fact I think PTRACE_ATTACH should fail in this case... I have used PTRACE_SEIZE instead: ptrace(

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-26 Thread Jan Kratochvil
On Mon, 03 Nov 2014 14:22:23 +0100, Mark Wielaard wrote: > For reference. Attached is the cleaned up -o support patch I added. As I wrote I find that unrelated to --core-pattern which should IMO use a shell script (or other language) wrapper. Additionally the eu-stack patch may be also considered

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-26 Thread Jan Kratochvil
done. This is implemented as a demo in eu-stack's core_pattern function invoked by eu-stack's --core-pattern option. The code of core_pattern function has been suggested by Oleg Nesterov. src/ 2014-11-26 Jan Kratochvil * stack.c: Include sys/ptrace.h and sys/wait.h. (O

Re: [PATCH] Add --core-pattern option to eu-stack

2014-11-26 Thread Jan Kratochvil
On Thu, 30 Oct 2014 22:55:41 +0100, Mark Wielaard wrote: > On Thu, 2014-10-09 at 23:25 +0200, Jan Kratochvil wrote: > > + if (opt_core_pattern == true && show_one_tid == false) > > + argp_error (state, > > + N_("--core-pattern requires -1&quo

[patchv2] eu-stack: Add --core-pattern

2014-10-12 Thread Jan Kratochvil
On Thu, 09 Oct 2014 23:32:47 +0200, Jan Kratochvil wrote: > jankratochvil/corepattern just a very minor simplification of the code. Jan --- Begin Message --- To backtrace crashed thread from Linux core_pattern handler a special operation similar to PTRACE_ATTACH needs to be done. This

[patch] eu-stack: Add --core-pattern

2014-10-09 Thread Jan Kratochvil
ttern handler a special operation similar to PTRACE_ATTACH needs to be done. This is implemented as a demo in eu-stack's core_pattern function invoked by eu-stack's --core-pattern option. The code of core_pattern function has been suggested by Oleg Nesterov. src/ 2014-10-09 Jan Kratoc

[commit] [PATCH 2/2] Support note NT_FILE for locating files.

2014-09-26 Thread Jan Kratochvil
On Tue, 23 Sep 2014 16:04:58 +0200, Mark Wielaard wrote: > On Tue, 2014-09-09 at 23:00 +0200, Jan Kratochvil wrote: > > tests/test-core.core.bz2 had to have its NT_FILE disabled as > > run-unstrip-n.sh > > otherwise FAILs: > > FAIL: 0x7f67f2aaf000+0x202000 - . -

Re: Small code cleanup in dwfl_segment_report_module.c (Was: [commit] [PATCHv2 1/2] Add is_executable to Dwfl_Module.)

2014-09-23 Thread Jan Kratochvil
On Tue, 23 Sep 2014 17:18:05 +0200, Mark Wielaard wrote: > Sure, that avoids one cast, which is always nice. Patch updated. That looks more OK with me to keep ctags working. Thanks, Jan

Re: Small code cleanup in dwfl_segment_report_module.c (Was: [commit] [PATCHv2 1/2] Add is_executable to Dwfl_Module.)

2014-09-23 Thread Jan Kratochvil
On Tue, 23 Sep 2014 14:50:13 +0200, Mark Wielaard wrote: > Updated cleanup based on current master attached. FYI I find that patch rather hiding what the code really does, in summary it has done: -if (ehdr.e32.e_ident[EI_DATA] == MY_ELFDATA) + ei_data = ((const unsigned char *) buffer)[EI_DA

[commit] [PATCHv2 1/2] Add is_executable to Dwfl_Module.

2014-09-18 Thread Jan Kratochvil
On Wed, 10 Sep 2014 22:33:50 +0200, Mark Wielaard wrote: > On Wed, 2014-09-10 at 21:22 +0200, Jan Kratochvil wrote: > > libdwfl/ > > 2014-09-10 Jan Kratochvil > > > > * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Use IS_EXECUTABLE. > >

Re: [PATCH 1/2] Add is_executable to Dwfl_Module.

2014-09-18 Thread Jan Kratochvil
On Thu, 18 Sep 2014 16:56:59 +0200, Mark Wielaard wrote: > Also we shouldn't add such a partial type struct to the public gelf.h > header since that is kind of a shared standard type, so if other > libelf/gelf implementations don't support it we shouldn't export it > IMHO. BTW there could be #ifde

ping: [PATCH 1/2] Add is_executable to Dwfl_Module.

2014-09-17 Thread Jan Kratochvil
ping, so that the patchset can move forward On Thu, 11 Sep 2014 21:00:49 +0200, Jan Kratochvil wrote: > On Wed, 10 Sep 2014 22:15:42 +0200, Mark Wielaard wrote: > > So I propose a cleanup like the attached first. > > While I find that as an improvement in general IMO on top of

Re: [PATCH 1/2] Add is_executable to Dwfl_Module.

2014-09-11 Thread Jan Kratochvil
On Wed, 10 Sep 2014 22:15:42 +0200, Mark Wielaard wrote: > So I propose a cleanup like the attached first. While I find that as an improvement in general IMO on top of your patch the changes could be done a bit differently. Patricularly I at least miss there that 'e_ident'. Jan diff --git a/lib

[PATCHv2 1/2] Add is_executable to Dwfl_Module.

2014-09-10 Thread Jan Kratochvil
t;[exe]" or "[pie]". -e|--executable still should be able to override such module. libdwfl/ 2014-09-10 Jan Kratochvil * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Use IS_EXECUTABLE. * dwfl_segment_report_module.c (dwfl_segment_report_module): Set

Re: [PATCH 1/2] Add is_executable to Dwfl_Module.

2014-09-10 Thread Jan Kratochvil
On Tue, 09 Sep 2014 23:55:34 +0200, Roland McGrath wrote: > >int segment; /* Index of first segment table entry. > > */ > >bool gc; /* Mark/sweep flag. */ > > + bool is_executable : 1; /* Use Dwfl::executable_for_core? */ > > If you're going to use

[PATCH 2/2] Support note NT_FILE for locating files

2014-09-09 Thread Jan Kratochvil
nd on the disk). Updating the expected text would be also sufficient. libdwfl/ 2014-09-09 Jan Kratochvil Support NT_FILE for locating files. * core-file.c (dwfl_core_file_report): New variables note_file and note_file_size, set them and pass them to dwfl_segment_report_m

[PATCH 1/2] Add is_executable to Dwfl_Module.

2014-09-09 Thread Jan Kratochvil
--- Begin Message --- Next patch will find module names from NT_FILE note so that main executable will no longer necessarily have the name "[exe]" or "[pie]". -e|--executable still should be able to override such module. libdwfl/ 2014-09-09 Jan Kratochvil * dwfl

[commit] [patch] Fix resolving ELF symbols for live PIDs with deleted files

2014-08-29 Thread Jan Kratochvil
On Fri, 29 Aug 2014 23:00:37 +0200, Mark Wielaard wrote: > Yes, please push. Checked in. Thanks, Jan

Re: [patch] Fix resolving ELF symbols for live PIDs with deleted files

2014-08-29 Thread Jan Kratochvil
On Fri, 29 Aug 2014 22:15:50 +0200, Jan Kratochvil wrote: > When I remove the check on 2.6.32 (tested on kernel-2.6.32-431.el6.x86_64) the > testcase really FAILs: > .../elfutils/src/stack: dwfl_thread_getframes tid 26376 at 0x4006c8 in > .../elfutils/tests/deleted: no matc

Re: [patch] Fix resolving ELF symbols for live PIDs with deleted files

2014-08-29 Thread Jan Kratochvil
On Fri, 29 Aug 2014 11:55:32 +0200, Mark Wielaard wrote: > On Thu, 2014-08-28 at 22:12 +0200, Jan Kratochvil wrote: > > +# Older Linux (such as 2.6.32) required PTRACE_ATTACH to read > > /proc/PID/mem. > > +sleep 60 & p=$!; sleep 0.1 > > +addr=0x$(cat /proc/$p/maps

[patch] Fix resolving ELF symbols for live PIDs with deleted files

2014-08-28 Thread Jan Kratochvil
produce: #2 0x7f61094876d6 libfunc #3 0x00400938 main Signed-off-by: Jan Kratochvil --- libdwfl/ChangeLog | 6 + libdwfl/dwfl_module_getdwarf.c | 11 +- tests/ChangeLog| 9 tests/Makefile.am | 10

Re: prevernt -m32 testing in configure

2014-08-09 Thread Jan Kratochvil
On Thu, 07 Aug 2014 18:10:40 +0200, daggs wrote: > Greetings, > > I'm trying to compile elfutils-0.159 on a 64 bit system. > in the configure stage I'm getting to this situation: > checking whether gcc -m32 makes executables we can run.. and it fails. > > I assume that this is because I don't hav

[commit] [patch] Fix report_r_debug for prelinked libraries

2014-07-28 Thread Jan Kratochvil
On Sun, 27 Jul 2014 22:53:58 +0200, Mark Wielaard wrote: > Just one nitpick with the following comment: > > > > - GElf_Addr l_addr = addrs[0]; > > + // unused: > > + // GElf_Addr l_addr = addrs[0]; > >GElf_Addr l_name = addrs[1]; > >GElf_Addr l_ld = addrs[2]; > > C

[patch] Fix report_r_debug for prelinked libraries

2014-07-24 Thread Jan Kratochvil
right positions. Trying to exploit failure of the add-on code of mine always ended up on the former code placing it right on its own. Thanks, Jan --- Begin Message --- Signed-off-by: Jan Kratochvil --- libdwfl/ChangeLog | 6 ++ libdwfl/link_map.c | 10 +++--- 2 files changed, 13 i

Re: [PATCH] libdwfl: Record dwfl_attach_state error and return it on failure.

2014-06-11 Thread Jan Kratochvil
On Wed, 11 Jun 2014 15:33:28 +0200, Mark Wielaard wrote: > When dwfl_attach_state fails functions that need the process state should > return the error that caused the attach to fail. Use this in the backtrace > test to signal any attach failure. This makes sure that architectures that > don't prov

ping: [patch] Detect infinite backtraces

2014-03-21 Thread Jan Kratochvil
On Tue, 21 Jan 2014 17:26:51 +0100, Jan Kratochvil wrote: > To make a summary what can remain from this patch to get it accepted: > * "__morestack" check is forbidden > * frames ordering by $sp0 < $sp1 is forbidden > * dynamicsizehash.[ch] is forbidden > * only $sp

Re: [PATCH 2/2] libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.

2014-03-16 Thread Jan Kratochvil
On Wed, 12 Mar 2014 11:46:29 +0100, Mark Wielaard wrote: > The test whether the shdrs are included in the mapped in segments is > contents_size >= shdrs_end. And contents_size depends on segments_end > (the last actual mapped file contents of the segment). segments_end is > rounded up based on the

Re: [PATCH 2/2] libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.

2014-03-16 Thread Jan Kratochvil
On Mon, 03 Mar 2014 15:31:28 +0100, Mark Wielaard wrote: [...] > --- a/libdwfl/elf-from-memory.c > +++ b/libdwfl/elf-from-memory.c > @@ -196,12 +196,14 @@ elf_from_remote_memory (GElf_Addr ehdr_vma, >/* Scan for PT_LOAD segments to find the total size of the file image. */ >size_t contents

Re: [PATCH 2/2] libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.

2014-03-11 Thread Jan Kratochvil
On Mon, 10 Mar 2014 21:27:54 +0100, Mark Wielaard wrote: > Normally we either get all of the shdrs or can easily detect that the > end of the ELF file (where the shdrs are normally located) doesn't fall > completely in the last segment mapped in. The exception is needed only > in some corner cases

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-10 Thread Jan Kratochvil
On Mon, 10 Mar 2014 21:38:31 +0100, Mark Wielaard wrote: > On Thu, 2014-03-06 at 20:55 +0100, Jan Kratochvil wrote: > > In general I believe reading /proc/PID/maps is safer than the guessing by > > elf_from_remote_memory(), for example because the image may come from mmap() > >

Re: [PATCH 2/2] libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.

2014-03-06 Thread Jan Kratochvil
On Mon, 03 Mar 2014 15:31:28 +0100, Mark Wielaard wrote: > If the last PT_LOAD segment that contains the whole shdrs also extends > the segment in memory beyond the end of file the program might be reusing > the memory space that we expect the shdrs to be in. Don't trust the shdrs > are valid in th

Re: [PATCH 1/2] libdwfl: elf_from_remote_memory should use pagesize, not p_align.

2014-03-06 Thread Jan Kratochvil
On Mon, 03 Mar 2014 15:31:27 +0100, Mark Wielaard wrote: > --- a/libdwfl/elf-from-memory.c > +++ b/libdwfl/elf-from-memory.c [...] > @@ -195,21 +200,28 @@ elf_from_remote_memory (GElf_Addr ehdr_vma, >bool found_base = false; >switch (ehdr.e32.e_ident[EI_CLASS]) > { The return value co

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-06 Thread Jan Kratochvil
On Tue, 04 Mar 2014 11:40:21 +0100, Mark Wielaard wrote: [...] > --- a/libdwfl/libdwflP.h > +++ b/libdwfl/libdwflP.h [...] > @@ -387,6 +388,39 @@ struct dwfl_arange > }; > > > +/* Structure used for keeping track of ptrace attaching a thread. > + Shared by linux-pid-attach and linux-proc-map

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-06 Thread Jan Kratochvil
On Tue, 04 Mar 2014 11:51:36 +0100, Mark Wielaard wrote: > On Mon, 2014-03-03 at 23:55 +0100, Jan Kratochvil wrote: > > On Mon, 03 Mar 2014 15:28:22 +0100, Mark Wielaard wrote: > > > First the elf_from_remote_memory used the p_align value to see calculate > > > the f

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-06 Thread Jan Kratochvil
On Tue, 04 Mar 2014 11:40:21 +0100, Mark Wielaard wrote: > Attached is a patch that does this. I'll push it to the mjw/pending > branch. It would be more readable if the " (deleted)" part was separated from the code move/refactorization. Jan

[commit] [patch 2/3] Fix abort() on missing section headers

2014-03-03 Thread Jan Kratochvil
On Mon, 03 Mar 2014 17:05:39 +0100, Mark Wielaard wrote: > On Sun, 2014-03-02 at 22:35 +0100, Jan Kratochvil wrote: > > 2014-03-02 Jan Kratochvil > > > > Fix abort() on missing section headers. > > * dwarf_begin_elf.c (check_section): Replace abort call by

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-03 Thread Jan Kratochvil
On Mon, 03 Mar 2014 16:48:27 +0100, Mark Wielaard wrote: > I didn't know BFD does something similar. Is that just for ELF or does > BFD handle multiple formats from memory? The only BFD implementation of that method is for ELF - in bfd/elfcode.h: NAME(_bfd_elf,bfd_from_remote_memory) Jan

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-03 Thread Jan Kratochvil
On Mon, 03 Mar 2014 15:28:22 +0100, Mark Wielaard wrote: > First the elf_from_remote_memory used the p_align value to see calculate > the file offset and sizes of the segments in memory. But the dynamic > loader doesn't p_align, it uses the actual pagesize, The elfutils code really seems incorrect

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-03-02 Thread Jan Kratochvil
On Tue, 25 Feb 2014 23:03:43 +0100, Mark Wielaard wrote: > On Sat, 2014-02-22 at 22:08 +0100, Jan Kratochvil wrote: > > jankratochvil/devmem > > The name, the subject and some of the comments talks about /dev. > But I assume this is really about /proc? Right, there isn't a

Re: [patch 3/3] Access deleted files by /dev/PID/mem

2014-03-02 Thread Jan Kratochvil
On Tue, 25 Feb 2014 23:56:23 +0100, Mark Wielaard wrote: > - Could we reuse dwfl_pid () instead of adding another pid concept to > struct Dwfl_Module? Then a user could just use dwfl_linux_proc_attach > which might also help us get into the ptrace attach state if needed > for reading /proc/PI

Re: [patch 2/3] Fix abort() on missing section headers

2014-03-02 Thread Jan Kratochvil
nk it makes sense to cleanup > and return NULL; instead. > > See how we cleanup and return NULL just below this code when elf_strptr > fails. Yes, I agree. Thanks, Jan libdw/ 2014-03-02 Jan Kratochvil Fix abort() on missing section headers. * dwarf_begin_elf.c (check

Re: [patch 1/3] Extend __libdw_open_file and elf_begin as *_at_offset

2014-03-02 Thread Jan Kratochvil
On Tue, 25 Feb 2014 23:12:04 +0100, Mark Wielaard wrote: > I rather not extend the libelf interface if possible. The various libelf > implementations are already a little diverged. Lets not unnecessarily > make the divergence even bigger. I was aware of this issue but I had no other idea. > If p

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-02-26 Thread Jan Kratochvil
On Wed, 26 Feb 2014 17:42:26 +0100, Mark Wielaard wrote: > I'll try and understand what I was trying to do, > clean it up and post it, if it looks useful/sane. OK, I think we can talk about it even in abstract. The primary problem of bfd_from_remote_memory (bfd/elfcode.h) always IMO was that it d

Re: [patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-02-26 Thread Jan Kratochvil
On Wed, 26 Feb 2014 17:29:38 +0100, Mark Wielaard wrote: > I got something somewhat working some time back, but I don't understand my > own patches... (most are really just lots of extra debug output). And are those patches posted somewhere? Jan

Re: elfutils/libdw ARM compilation (native and cross compile)

2014-02-26 Thread Jan Kratochvil
On Wed, 26 Feb 2014 09:18:44 +0100, Jean Pihet wrote: > While at it, I have a concern about the compat mode: profiling an > ARMv7 binary on an ARMv8 system. > Is this supported by libdw? elfutils target support is always independent of the host. And every build of elfutils always contains all the

Re: elfutils/libdw ARM compilation (native and cross compile)

2014-02-25 Thread Jan Kratochvil
On Tue, 25 Feb 2014 18:17:24 +0100, Jean Pihet wrote: > I am trying to compile libdw for ARM, There is no need/possibility to specify ARM target or any other target, every build of elfutils will always handle all the supported targets. > *** missing i386_dis.h; configure with --enable-maintainer

[patch 3/3] Access deleted files by /dev/PID/mem

2014-02-22 Thread Jan Kratochvil
Hi, the core. The testcase mostly comes from the former patch. Thanks, Jan --- Begin Message --- libdwfl/ 2014-02-22 Jan Kratochvil Access deleted files by /dev/PID/mem. * dwfl_module.c (dwfl_report_module_pid): New function. * dwfl_module_getdwarf.c (open_elf

[patch 2/3] Fix abort() on missing section headers

2014-02-22 Thread Jan Kratochvil
Hi, probably obvious, easy to debug with [patch 3/3] applied. Thanks, Jan --- Begin Message --- libdw/ 2014-02-22 Jan Kratochvil Fix abort() on missing section headers. * dwarf_begin_elf.c (check_section): Replace abort call by a return; Signed-off-by: Jan Kratochvil

[patch 0/3] Live PIDs with deleted files by /dev/PID/mem

2014-02-22 Thread Jan Kratochvil
Hi, jankratochvil/devmem this is a different approach to: [patch] Support live PIDs with deleted files https://lists.fedorahosted.org/pipermail/elfutils-devel/2013-December/003637.html Message-ID: <20131218191326.ga8...@host2.jankratochvil.net> The patch above required /

[patch 1/3] Extend __libdw_open_file and elf_begin as *_at_offset

2014-02-22 Thread Jan Kratochvil
Hi, small refactorization / extension, no functionality change. Thanks, Jan --- Begin Message --- ./ 2014-02-22 Jan Kratochvil Extend __libdw_open_file and elf_begin as *_at_offset. * NEWS (libelf): New, with elf_begin_at_offset. libdwfl/ 2014-02-22 Jan Kratochvil

Re: [patch] Detect infinite backtraces

2014-01-21 Thread Jan Kratochvil
On Tue, 21 Jan 2014 17:04:32 +0100, Mark Wielaard wrote: > Sorry I thought that was obvious. It disables consistency checking > completely when a magic symbol can be found. As on the real world supported platforms this magic symbol is the only way when ebl-defined arch frames ordering can be viola

Re: [patch] Detect infinite backtraces

2014-01-20 Thread Jan Kratochvil
On Mon, 20 Jan 2014 11:08:45 +0100, Mark Wielaard wrote: > On Sat, 2014-01-18 at 21:53 +0100, Jan Kratochvil wrote: > > OK, so the patch can also already implement the GDB logic: > > > > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=ebedcab50d2c7699ced

Re: Some stuff for 0.159+

2014-01-20 Thread Jan Kratochvil
On Mon, 20 Jan 2014 10:55:25 +0100, Mark Wielaard wrote: > it uses dl_iterate_phdr and only works for the current executable. OK, I did not notice this one. I agree now making libbacktrace usable for other / non-self programs may not be so easy. Jan

Re: [PATCH] tests: run-backtrace-demangle.sh check exitcode and max number of frames.

2014-01-18 Thread Jan Kratochvil
On Sat, 18 Jan 2014 21:29:40 +0100, Mark Wielaard wrote: > On Sat, Jan 18, 2014 at 07:27:50PM +0100, Jan Kratochvil wrote: > > I agree there should be something like ' || true' but which system cannot > > unwind 'main'? IIUC the 2 frames (and not 3 frames). >

[commit] [patchv2] Fix false FAILs on testsuite with ulimit -c unlimited.

2014-01-18 Thread Jan Kratochvil
On Sat, 18 Jan 2014 21:34:41 +0100, Mark Wielaard wrote: > On Sat, Jan 18, 2014 at 09:01:57PM +0100, Jan Kratochvil wrote: > > tests/ > > 2014-01-18 Jan Kratochvil > > > > Fix false FAILs on testsuite with ulimit -c unlimited. > > * backtrace-chi

Re: [patch] Detect infinite backtraces

2014-01-18 Thread Jan Kratochvil
On Sat, 18 Jan 2014 21:25:51 +0100, Mark Wielaard wrote: > I don't think it is coincidence that split-stack would work. I believe we > don't assume anything about the stack values and so it should work as > expected since DWARF is expressive enough to describe it. > http://gcc.gnu.org/wiki/SplitSta

Re: Some stuff for 0.159+

2014-01-18 Thread Jan Kratochvil
On Wed, 15 Jan 2014 22:55:27 +0100, Mark Wielaard wrote: > I forgot about that one. It is completely different from what we provide > since it was designed to be used in-process and doesn't actually do > unwinding (it just uses the system/libgcc _Unwind_Backtrace to get the > raw call stack). Since

[patchv2] Fix false FAILs on testsuite with ulimit -c unlimited.

2014-01-18 Thread Jan Kratochvil
ust let the child exit > normally after raise () returns. The stack is corrupt at this point but OK, it can be done. Thanks, Jan --- Begin Message --- tests/ 2014-01-18 Jan Kratochvil Fix false FAILs on testsuite with ulimit -c unlimited. * backtrace-child.c (si

Re: [PATCH] tests: run-backtrace-demangle.sh check exitcode and max number of frames.

2014-01-18 Thread Jan Kratochvil
On Thu, 16 Jan 2014 09:45:51 +0100, Mark Wielaard wrote: > There can be more than 3 frames, but depending on the system/installed > glibc we might not be able to unwind fully till the end. > cxxfunc -> f -> main > Expect to see the top two and a warning that there are more frames > (exit code 1) I

Re: Some stuff for 0.159+

2014-01-15 Thread Jan Kratochvil
On Wed, 15 Jan 2014 16:16:34 +0100, Mark Wielaard wrote: > - Maybe tweak the defaults for eu-stack based on feedback. > Maybe use more debug information than just the line numbers if > available (e.g. use the subprogram or inlined_subroutine names for the > addresses found). There is also li

[commit] [patchv2] Fix corruption of non-C++ symbols by the demangler

2014-01-15 Thread Jan Kratochvil
On Wed, 15 Jan 2014 17:39:09 +0100, Mark Wielaard wrote: > Looks good. Checked in: 7c6e785e6eca774080a64801f950bd61785c469e Thanks, Jan

Fix false FAILs on testsuite with ulimit -c unlimited.

2014-01-15 Thread Jan Kratochvil
abort (); 223 } Probably obvious. Thanks, Jan >From 9909d959fe48b08682760ba8a615ccc87423f638 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 15 Jan 2014 14:16:13 +0100 Subject: [PATCH] Fix false FAILs on testsuite with ulimit -c unlimited. tests/ 2014-01-15 Jan Kratochvil

Re: [patch] Fix corruption of non-C++ symbols by the demangler

2014-01-14 Thread Jan Kratochvil
On Tue, 14 Jan 2014 10:00:59 +0100, Mark Wielaard wrote: > The __GLOBAL__.[ID]_xxx functions are wrappers generated when a module > xxx contains constructors and destructors of static objects, which will > call the actual static initialization and destruction functions for all > globals in the modu

[patch] Fix corruption of non-C++ symbols by the demangler

2014-01-13 Thread Jan Kratochvil
GLOBAL_DTORS but I could not find a compliant symbol without leading _Z for it. DCT_TYPE is apparently inappropriate for the unwinder. Thanks, Jan commit e1b6b9d3131f32ef54932388c814adc02ca6a329 Author: Jan Kratochvil Date: Mon Jan 13 23:04:03 2014 +0100 Fix corruption of non-C++ symbo

Re: [PATCH] stack: Add new '-n MAXFRAMES' option. Resolve addresses after unwind.

2014-01-07 Thread Jan Kratochvil
Hi Mark, On Tue, 07 Jan 2014 10:03:26 +0100, Mark Wielaard wrote: > Defaulting to infinite backtraces for all threads in a process will just > flood console or log files. That isn't useful. Not printing the reason for the crash is also not useful. Jan

Re: [PATCH] stack: Add new '-n MAXFRAMES' option. Resolve addresses after unwind.

2014-01-06 Thread Jan Kratochvil
On Mon, 06 Jan 2014 15:52:08 +0100, Mark Wielaard wrote: > The default output should be useful as is. Which it is not. As for the common case of stack overflow by infinite loop it does not show the reason. > Of course they can tweak if however they want. > eu-stack has many options to tailor th

Re: [PATCH] stack: Add new '-n MAXFRAMES' option. Resolve addresses after unwind.

2014-01-03 Thread Jan Kratochvil
On Thu, 02 Jan 2014 23:52:05 +0100, Mark Wielaard wrote: > On Thu, Jan 02, 2014 at 08:45:47PM +0100, Jan Kratochvil wrote: > > On Mon, 23 Dec 2013 11:21:19 +0100, Mark Wielaard wrote: > > > Limit the number of frames printed per thread (defaults to 64) > > > > The

[patch] Detect infinite backtraces

2014-01-03 Thread Jan Kratochvil
. Thanks, Jan --- Begin Message --- libdwfl/ 2014-01-03 Jan Kratochvil Detect infinite backtraces. * dwfl_frame.c (state_alloc): Initialize CFA. * frame_unwind.c (expr_eval): Remove parameter frame, add parameter elfclass. Move elfclass to handle_cfi. Replace

Re: Preparing for elfutils 0.158

2014-01-03 Thread Jan Kratochvil
On Thu, 02 Jan 2014 10:40:38 +0100, Mark Wielaard wrote: > After that I would like to push for a 0.158 release on Monday after > testing it on various setups this weekend. Unless any critical > regressions are found. I did not expect you would release elfutils as is. According to our very long pp

Re: [PATCH] stack: -b, --build-id shows module build-id, load address and pc offset.

2014-01-03 Thread Jan Kratochvil
On Fri, 03 Jan 2014 00:01:13 +0100, Mark Wielaard wrote: > --- a/src/stack.c > +++ b/src/stack.c > @@ -255,7 +255,8 @@ print_frames (struct frames *frames, pid_t tid, int > dwflerr, const char *what) > do > printf ("%02" PRIx8, *id++); > while (--id_len > 0);

Re: [PATCH] stack: Add --quiet to not resolve addresses, add --raw to not demangle.

2014-01-03 Thread Jan Kratochvil
On Fri, 03 Jan 2014 00:09:04 +0100, Mark Wielaard wrote: > --- a/src/stack.c > +++ b/src/stack.c > @@ -47,9 +47,7 @@ static bool show_build_id = false; > static bool show_source = false; > static bool show_one_tid = false; > static bool show_quiet = false; > -#ifdef USE_DEMANGLE > static bool s

Re: [PATCH] libdwfl: Fix build_id memory leak in dwfl_segment_report_module.

2014-01-02 Thread Jan Kratochvil
On Mon, 23 Dec 2013 23:28:21 +0100, Mark Wielaard wrote: > We might already have allocated memory to hold the build_id early in > consider_notes when we called consider_phdr for the program headers > we've read from the image. We would leak that memory when we don't use > it then because we return

Re: [PATCH] stack: Improve error checking and exit code handling.

2014-01-02 Thread Jan Kratochvil
On Fri, 27 Dec 2013 22:37:52 +0100, Mark Wielaard wrote: > Check up front whether we attached correctly, if not error out. Make sure > callbacks report -1 only on real errors and DWARF_CB_ABORT if exiting early > (but not in error). Handle all errors from frame callback in print_frames > after prin

Re: [PATCH] stack: Add --quiet to not resolve addresses, add --raw to not demangle.

2014-01-02 Thread Jan Kratochvil
On Mon, 23 Dec 2013 21:35:41 +0100, Mark Wielaard wrote: > +#ifdef USE_DEMANGLE > +case 'r': > + show_raw = true; > + break; > +#endif It is more a nitpick but I do not find too great that a build without demangling support will fail "eu-stack -r ..." with: eu-stack: invalid

Re: [PATCH] stack: -b, --build-id shows module build-id, load address and pc offset.

2014-01-02 Thread Jan Kratochvil
On Mon, 23 Dec 2013 11:21:52 +0100, Mark Wielaard wrote: [...] > + { > + printf ("\n["); > + do > + printf ("%02" PRIx8, *id++); > + while (--id_len > 0); > + printf ("]@0x%0" PRIx64 "+%" PRIx64, start, pc_adjusted - start); why not:

Re: [PATCH] stack: Add new '-n MAXFRAMES' option. Resolve addresses after unwind.

2014-01-02 Thread Jan Kratochvil
On Mon, 23 Dec 2013 11:21:19 +0100, Mark Wielaard wrote: > Limit the number of frames printed per thread (defaults to 64) The new option is sure OK but any non-infinite default is not right: * Normal applications have deeper stack than 64. When I broke into my GTK running app it has 103 fram

Re: [PATCH] libdwfl: linux-pid-attach.c: Report actual PID (Tgid) to dwfl_attach_state.

2014-01-02 Thread Jan Kratochvil
On Wed, 25 Dec 2013 23:10:50 +0100, Mark Wielaard wrote: > On Wed, Dec 25, 2013 at 08:23:25PM +0100, Jan Kratochvil wrote: > > On Mon, 23 Dec 2013 14:22:24 +0100, Mark Wielaard wrote: > > > + { > > > +pid = atoi (&buffer[5]); > > > +

Re: [patch] Support live PIDs with deleted files

2014-01-02 Thread Jan Kratochvil
On Thu, 19 Dec 2013 14:01:26 +0100, Mark Wielaard wrote: > Do you have a reference to do documentation of /proc/PID/map_files? [...] > But it would be good to see the "official" documentation if there is any > to make sure we are using the kernel interface/contract as intended. There is nothing in

Re: [PATCH] libdwfl: linux-pid-attach.c: Report actual PID (Tgid) to dwfl_attach_state.

2013-12-25 Thread Jan Kratochvil
On Mon, 23 Dec 2013 14:22:24 +0100, Mark Wielaard wrote: [...] > --- a/libdwfl/linux-pid-attach.c > +++ b/libdwfl/linux-pid-attach.c > @@ -301,6 +301,27 @@ bool > internal_function > __libdwfl_attach_state_for_pid (Dwfl *dwfl, pid_t pid) > { > + char buffer[36]; > + FILE *procfile; > + > + /*

Re: [PATCH] libdwfl: Make sure to set the CFI return register only once (for ppc64).

2013-12-25 Thread Jan Kratochvil
On Sat, 21 Dec 2013 21:56:35 +0100, Mark Wielaard wrote: > On PPC64 there are two DWARF registers numbers that can represent the > same register. If that register is the CIE return register then we only > want to set it once. The second setting will confuse the unwinder. OK with the patch. It is

Re: [PATCH] libdwfl: Add dwfl_getthread and dwfl_getthread_frames.

2013-12-23 Thread Jan Kratochvil
On Mon, 23 Dec 2013 13:54:19 +0100, Mark Wielaard wrote: > On Sun, 2013-12-22 at 16:51 +0100, Jan Kratochvil wrote: > > If I have PID=12000 and I do 'eu-stack -p 12001' (its thread TID) then for > > elfutils in fact PID is 12001. So if Dwfl_Thread_Callbacks.next_thread &

Re: [PATCH] libdwfl: Make sure to set the CFI return register only once (for ppc64).

2013-12-23 Thread Jan Kratochvil
On Sat, 21 Dec 2013 21:56:35 +0100, Mark Wielaard wrote: > On PPC64 there are two DWARF registers numbers that can represent the > same register. If that register is the CIE return register then we only > want to set it once. The second setting will confuse the unwinder. Could you provide reproduc

Re: [PATCH] libdwfl: linux-pid-attach.c: Report actual PID (Tgid) to dwfl_attach_state.

2013-12-23 Thread Jan Kratochvil
On Mon, 23 Dec 2013 14:22:24 +0100, Mark Wielaard wrote: > --- a/src/ChangeLog > +++ b/src/ChangeLog > @@ -1,5 +1,9 @@ > 2013-12-23 Mark Wielaard > > + * stack.c (main): Print pid of process or core. > + > +2013-12-23 Mark Wielaard > + > * stack.c (OPT_DEBUGINFO): New define. >

Re: [PATCH] libdwfl: Add dwfl_getthread and dwfl_getthread_frames.

2013-12-22 Thread Jan Kratochvil
Hi Mark, this whole discussion is difficult without seeing how you want to use it. I am considering only the eu-stack case as you supplied patch for it. On Sun, 22 Dec 2013 00:51:39 +0100, Mark Wielaard wrote: > On Sat, 2013-12-21 at 22:33 +0100, Jan Kratochvil wrote: > > [...] &g

Re: [PATCH] libdwfl: Add dwfl_getthread and dwfl_getthread_frames.

2013-12-21 Thread Jan Kratochvil
On Fri, 20 Dec 2013 15:23:54 +0100, Mark Wielaard wrote: > While playing with the new unwinder interfaces I noticed that I was > writing the same extra wrapper callbacks every time. Glad you agree the callbacks without lambda functions are a pain. :-) [...] > --- a/libdwfl/libdwfl.h > +++ b/libd

Re: [COMMITTED] tests: backtrace.c only check we caught the last instruction on x86_64.

2013-12-21 Thread Jan Kratochvil
On Sat, 21 Dec 2013 19:44:28 +0100, Mark Wielaard wrote: > On some architectures gcc might introduce some "padding instructions" > at the end of the function (like on ppc64). So only assert we are at the > last instruction of backtracegen if on x86_64 native. In theory the assert > could even fail

Re: [patch] Support live PIDs with deleted files

2013-12-18 Thread Jan Kratochvil
Hi Mark, I forgot the demo: # cd tests;make deleted deleted-lib.so;./deleted&p=$!;sleep 0.1;rm deleted deleted-lib.so;../src/stack -m -p $p [...] TID 7712: #0 0x0033472bd360 __nanosleep - /usr/lib64/libc-2.17.so #1 0x0033472bd214 sleep - /usr/lib64/libc-2.17.so #2 0x7f9aa725b6d6 l

[patch] Support live PIDs with deleted files

2013-12-18 Thread Jan Kratochvil
is skipped when /proc/PID/map_files/ gives permission error. OK for check-in? I am not completely sure setting just mod->main.name is right but it looks so. Thanks, Jan --- Begin Message --- libdwfl/ 2013-12-18 Jan Kratochvil Support live PIDs with deleted files. * linux-p

  1   2   3   4   5   >