summaryrefslogtreecommitdiff
path: root/src/coredump/_UCD_find_proc_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coredump/_UCD_find_proc_info.c')
-rw-r--r--src/coredump/_UCD_find_proc_info.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/coredump/_UCD_find_proc_info.c b/src/coredump/_UCD_find_proc_info.c
index 35e1624c..fae61d9f 100644
--- a/src/coredump/_UCD_find_proc_info.c
+++ b/src/coredump/_UCD_find_proc_info.c
@@ -53,6 +53,9 @@ get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip)
&& ip >= ui->edi.di_debug.start_ip && ip < ui->edi.di_debug.end_ip))
return 0;
+ /* The invalidate_edi call unmaps memory it doesn't own, so just null it out
+ instead. */
+ ui->edi.ei.image = NULL;
invalidate_edi (&ui->edi);
/* Used to be tdep_get_elf_image() in ptrace unwinding code */
@@ -62,17 +65,22 @@ get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip)
Debug(1, "returns error: _UCD_get_elf_image failed\n");
return -UNW_ENOINFO;
}
+
+ ucd_file_t *ucd_file = ucd_file_table_at(&ui->ucd_file_table, phdr->p_backing_file_index);
+ if (ucd_file == NULL)
+ {
+ Debug(0, "no backing file for index %d\n", phdr->p_backing_file_index);
+ return -UNW_ENOINFO;
+ }
+
/* segbase: where it is mapped in virtual memory */
- /* mapoff: offset in the file */
segbase = phdr->p_vaddr;
- /*mapoff = phdr->p_offset; WRONG! phdr->p_offset is the offset in COREDUMP file */
+ /* mapoff doesn't matter since the entire file is loaded */
mapoff = 0;
-///FIXME. text segment is USUALLY, not always, at offset 0 in the binary/.so file.
-// ensure that at initialization.
/* Here, SEGBASE is the starting-address of the (mmap'ped) segment
which covers the IP we're looking for. */
- if (tdep_find_unwind_table(&ui->edi, as, phdr->backing_filename, segbase, mapoff, ip) < 0)
+ if (tdep_find_unwind_table(&ui->edi, as, ucd_file->filename, segbase, mapoff, ip) < 0)
{
Debug(1, "returns error: tdep_find_unwind_table failed\n");
return -UNW_ENOINFO;