mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-10-01 02:49:29 +02:00
Enough for now for ptrace backend
This commit is contained in:
parent
752ce15c4f
commit
9f79621a29
1 changed files with 7 additions and 6 deletions
|
@ -168,7 +168,8 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
|
||||||
char *path, unw_word_t segbase, unw_word_t mapoff)
|
char *path, unw_word_t segbase, unw_word_t mapoff)
|
||||||
{
|
{
|
||||||
Elf_W(Phdr) *phdr, *ptxt = NULL, *peh_hdr = NULL, *pdyn = NULL;
|
Elf_W(Phdr) *phdr, *ptxt = NULL, *peh_hdr = NULL, *pdyn = NULL;
|
||||||
unw_word_t addr, eh_frame_start, fde_count, load_base;
|
unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, load_base;
|
||||||
|
unw_word_t max_load_addr = 0;
|
||||||
struct dwarf_eh_frame_hdr *hdr;
|
struct dwarf_eh_frame_hdr *hdr;
|
||||||
unw_proc_info_t pi;
|
unw_proc_info_t pi;
|
||||||
unw_accessors_t *a;
|
unw_accessors_t *a;
|
||||||
|
@ -190,6 +191,8 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
|
||||||
case PT_LOAD:
|
case PT_LOAD:
|
||||||
if (phdr[i].p_offset == mapoff)
|
if (phdr[i].p_offset == mapoff)
|
||||||
ptxt = phdr + i;
|
ptxt = phdr + i;
|
||||||
|
if ((uintptr_t) ui->ei.image + phdr->p_filesz > max_load_addr)
|
||||||
|
max_load_addr = (uintptr_t) ui->ei.image + phdr->p_filesz;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PT_GNU_EH_FRAME:
|
case PT_GNU_EH_FRAME:
|
||||||
|
@ -268,11 +271,10 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
|
||||||
/* If there is no search table or it has an unsupported
|
/* If there is no search table or it has an unsupported
|
||||||
encoding, fall back on linear search. */
|
encoding, fall back on linear search. */
|
||||||
if (hdr->table_enc == DW_EH_PE_omit)
|
if (hdr->table_enc == DW_EH_PE_omit)
|
||||||
Debug (4, "table `%s' lacks search table; doing linear search\n",
|
Debug (4, "EH lacks search table; doing linear search\n");
|
||||||
info->dlpi_name);
|
|
||||||
else
|
else
|
||||||
Debug (4, "table `%s' has encoding 0x%x; doing linear search\n",
|
Debug (4, "EH table has encoding 0x%x; doing linear search\n",
|
||||||
info->dlpi_name, hdr->table_enc);
|
hdr->table_enc);
|
||||||
|
|
||||||
eh_frame_end = max_load_addr; /* XXX can we do better? */
|
eh_frame_end = max_load_addr; /* XXX can we do better? */
|
||||||
|
|
||||||
|
@ -281,7 +283,6 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
|
||||||
if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit)
|
if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
cb_data->single_fde = 1;
|
|
||||||
return linear_search (unw_local_addr_space, ip,
|
return linear_search (unw_local_addr_space, ip,
|
||||||
eh_frame_start, eh_frame_end, fde_count,
|
eh_frame_start, eh_frame_end, fde_count,
|
||||||
pi, need_unwind_info, NULL);
|
pi, need_unwind_info, NULL);
|
||||||
|
|
Loading…
Reference in a new issue