summaryrefslogtreecommitdiffstats
path: root/tests/backtrace.c
Commit message (Collapse)AuthorAgeFilesLines
* Reduce scope of some includesPino Toscano2015-06-271-0/+2
| | | | | | | | Use some includes only according to the #ifdef block of the respective code, or matching the fact they are Linux-only. This way, includes potentially unportable are not unconditionally used. Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
* Replace assert_perror with assertMax Filippov2015-05-051-5/+5
| | | | | | | assert_perror is a GNU extension, it's not provided by uClibc and it's only used in tests. Replace it with assert. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
* tests: Use PTRACE_GETREGS/PTRACE_SETREGS to update ripH.J. Lu2015-03-131-3/+7
| | | | | | | Use PTRACE_POKEUSER to update rip is unsupported for x32. We should use PTRACE_GETREGS/PTRACE_SETREGS to update rip. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
* tests: ensure backtrace.c exec_dump sets jmpJosh Stone2015-02-111-1/+1
| | | | | | | | | | | | With CFLAGS='-Og -g', F21 gcc hits -Werror=maybe-uninitialized on jmp in the call "prepare_thread (pid2, jmp)". It's fine with -O2/-O0. The only way this could be unset is if the loop before ran to completion, and there's already an assert against this case. This patch initializes jmp anyway to convince gcc it's ok. Signed-off-by: Josh Stone <jistone@redhat.com>
* tests/backtrace.c (frame_callback): Error on seeing more than 16 frames.Mark Wielaard2014-06-171-0/+7
| | | | | | Don't fill up the test logs with obviously bogus frames. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: backtrace.c accept __libc_do_syscall as first frame symname.Mark Wielaard2014-06-171-1/+2
| | | | | | | | On some architectures (Debian armhl) system calls go through __libc_do_syscall instead of __kernel_vsyscall. Accept either of these symbol names for the first backtrace frame. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Record dwfl_attach_state error and return it on failure.Mark Wielaard2014-06-111-1/+4
| | | | | | | | | | | 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 provide unwinder support get properly detected (and the tests SKIPs) Also don't assert when trying to attach a non-core ELF file, but return an error to indicate failure. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Unwinding is only supported on LinuxKurt Roeckx2014-04-231-0/+15
| | | | Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
* tests: Don't use ptrace detach stopped trick. Raise can return.Mark Wielaard2014-01-041-12/+1
| | | | | | | | | | On older kernels the ptrace detach stop trick doesn't work reliably. Just keep the child processes attached and stopped during the tests, dwfl_linux_proc_attach will handle that fine now. Also on older kernels raise would sometimes return anyway and cause a spurious assert. Just ignore it. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Add dwfl_core_file_attach and dwfl_linux_proc_attach.Mark Wielaard2013-12-311-0/+6
| | | | | | | | | | | | | | Rewrite __libdwfl_attach_state_for_pid and __libdwfl_attach_state_for_core as public functions and don't call them from dwfl_linux_proc_report and dwfl_core_file_report anymore. This lets the user attach state explicitly independ from how the dwfl modules have been reported. Since attaching state is an explicit action now the error can be returned directly and we don't need to keep track of process_attach_error. dwfl_linux_proc_attach lets the user can tell libdwfl whether caller takes care of ptrace attaching and stopping the threads under inspection, or whether the callback needs to take care of that and detaching again. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* tests: backtrace.c only check we caught the last instruction on x86_64.Mark Wielaard2013-12-211-1/+7
| | | | | | | | | | 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 on that architectures, but in practice it doesn't and it is a nice test to have. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Tests for unwinder of x86*.Jan Kratochvil2013-12-021-0/+452
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>