Skip to content

Instantly share code, notes, and snippets.

@zhuizhuhaomeng
Created July 6, 2023 13:40
Show Gist options
  • Select an option

  • Save zhuizhuhaomeng/4777a6a7c5503af9238059ac5aa19717 to your computer and use it in GitHub Desktop.

Select an option

Save zhuizhuhaomeng/4777a6a7c5503af9238059ac5aa19717 to your computer and use it in GitHub Desktop.

Revisions

  1. zhuizhuhaomeng created this gist Jul 6, 2023.
    24 changes: 24 additions & 0 deletions d.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    commit e5fbe2fdf6376d7b064d6bdc4e8980bd7dc21052
    Author: lijunlong <[email protected]>
    Date: Thu Jul 6 21:39:30 2023 +0800

    bugfix: unwind failed because did not get unwind data from the .zdebug_frame section.

    diff --git a/translate.cxx b/translate.cxx
    index 4115650e3..60415563a 100644
    --- a/translate.cxx
    +++ b/translate.cxx
    @@ -7061,9 +7061,11 @@ static void get_unwind_data (Dwfl_Module *m,
    scn = NULL;
    while ((scn = elf_nextscn(elf, scn)))
    {
    + const char *sh_name;
    shdr = gelf_getshdr(scn, &shdr_mem);
    - if (strcmp(elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name),
    - ".debug_frame") == 0)
    + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name);
    + if (strcmp(sh_name, ".debug_frame") == 0
    + || strcmp(sh_name, ".zdebug_frame") == 0)
    {
    data = elf_rawdata(scn, NULL);
    *debug_frame = data->d_buf;