summaryrefslogtreecommitdiffstats
path: root/libdwfl/linux-pid-attach.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up linux-specific system includesUlf Hermann2017-04-211-2/+3
| | | | | | | We only include them where we actually need them and only on linux. Change-Id: Ic3065ffab67ba1177f63204fb91a92c5f4336dbb Reviewed-by: Christian Kandeler <[email protected]>
* lib: Provide MAX and MIN in system.hAkihiko Odaki2016-10-121-4/+0
| | | | | | | | | | This change also creates a new header file libeu.h to provide the prototypes for the function of libeu. That hides the definition of function crc32, which can conflict with zlib, from libelf. It also prevents mistakes to refer those functions from a component which doesn't link with libeu, such as libelf. Signed-off-by: Akihiko Odaki <[email protected]>
* libdwfl: clean up non-Linux GNU platforms codeSteven Chamberlain2016-03-021-63/+0
| | | | | | | | | | | | | | | | | | | For non-Linux GNU platforms (like kFreeBSD, Hurd), linux-pid-attach.c had some stub functions that are not used or exported. Since gcc-6, having these caused compiler errors due to -Wall -Werror: linux-pid-attach.c:479:36: error: 'pid_thread_callbacks' defined but not used [-Werror=unused-const-variable=] linux-pid-attach.c:474:1: error: 'pid_thread_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:461:1: error: 'pid_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:452:1: error: 'pid_set_initial_registers' defined but not used [-Werror=unused-function] linux-pid-attach.c:441:1: error: 'pid_memory_read' defined but not used [-Werror=unused-function] linux-pid-attach.c:420:1: error: 'pid_getthread' defined but not used [-Werror=unused-function] linux-pid-attach.c:410:1: error: 'pid_next_thread' defined but not used [-Werror=unused-function] This part of the source file is guarded by #ifndef __linux__ Signed-off-by: Steven Chamberlain <[email protected]>
* libdwfl: Make dwfl_linux_proc_attach work even without any Dwfl_Modules.Mark Wielaard2015-09-141-6/+37
| | | | | | | | | dwfl_linux_proc_attach depended on a Dwfl_Module with the correct ELF header already being available. That isn't really necessary since when we attach we have the main exe ELF file available. Just use that to make dwfl_linux_proc_attach always work. Signed-off-by: Mark Wielaard <[email protected]>
* Make the attach code build again on non-Linux hosts.Kurt Roeckx2014-06-251-0/+17
| | | | Signed-off-by: Kurt Roeckx <[email protected]>
* libdwfl: Record dwfl_attach_state error and return it on failure.Mark Wielaard2014-06-111-4/+21
| | | | | | | | | | | 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 <[email protected]>
* Unwinding is only supported on LinuxKurt Roeckx2014-04-231-0/+85
| | | | Signed-off-by: Kurt Roeckx <[email protected]>
* libdwfl: dwfl_linux_proc_find_elf use elf_from_remote_memory for (deleted).Mark Wielaard2014-03-101-29/+36
| | | | | | | | If a module has a "(deleted)" main ELF file, then try to read it from remote memory if the Dwfl has process state attached by reusing the ptrace mechanism from linux-pid-attach. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: linux-pid-attach.c (dwfl_linux_proc_attach): Use and check strtolMark Wielaard2014-01-021-2/+9
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Add dwfl_core_file_attach and dwfl_linux_proc_attach.Mark Wielaard2013-12-311-20/+24
| | | | | | | | | | | | | | 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 <[email protected]>
* libdwfl: linux-pid-attach.c: Report actual PID (Tgid) to dwfl_attach_state.Mark Wielaard2013-12-251-0/+24
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Add dwfl_getthread_frames.Mark Wielaard2013-12-231-0/+15
| | | | | | | | | | | | | | | | dwfl_getthread_frames is a convenience function for when the user is only interested in one specific thread id of a process. It can be implemented by a simple wrapper function that removes an extra callback layer just to filter on thread id. But it also provides an optimized path to getting access to just one particular Dwfl_Thread of the Dwfl process by providing and (optional) new callback for the state provider. The pid_thread_callbacks now provide an (optional) pid_getthread that doesn't need to travers all threads anymore. Which is implemented for the linux-pid-attach provider. stack now uses this to implement a new '-1' option that shows just one specific thread of a process. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: linux-pid-attach.c (pid_next_thread): Use rewinddir on first call.Mark Wielaard2013-12-171-0/+3
| | | | | | | | dwfl_getthreads would otherwise fail to report any threads after it was called once. Reported-by: Masatake YAMATO <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* unwinder: ppc and ppc64Jan Kratochvil2013-12-151-0/+8
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* Compatibility with older kernels such as RHEL-6.Jan Kratochvil2013-11-191-4/+12
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* Code cleanup: Remove const in prototypeJan Kratochvil2013-11-141-4/+2
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* Fix dwfl_attach_state machine->elfJan Kratochvil2013-11-141-1/+1
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* Unwinder for x86*.Jan Kratochvil2013-11-071-0/+282
Signed-off-by: Jan Kratochvil <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>