1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-05-11 08:55:18 +02:00

ptrace: check for NULL arg.

tdep_get_func_addr in ppc64 passes NULL for the last argument of
as->access_mem.  tdep_get_func_addr is called by elf_w(lookup_symbol),
which in turn is called by elf_w(get_proc_name_in_image).

elf_w(get_proc_name_in_image) is part of the API, and is only passed an
unw_addr_space_t, not a unw_cursor_t, meaning that we cannot recover the
UPT_info on the PPC64 platform.

This could be fixed by giving libunwind the knowledge to perform
relocations itself, thus not needing to look at the running image to
determine function addresses.
This commit is contained in:
Cody P Schafer 2012-09-14 17:12:01 -07:00 committed by Arun Sharma
parent 10abb25af4
commit 3d6f7479b0

View file

@ -32,6 +32,9 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
int write, void *arg)
{
struct UPT_info *ui = arg;
if (!ui)
return -UNW_EINVAL;
pid_t pid = ui->pid;
errno = 0;
@ -65,6 +68,8 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
int write, void *arg)
{
struct UPT_info *ui = arg;
if (!ui)
return -UNW_EINVAL;
pid_t pid = ui->pid;
struct ptrace_io_desc iod;