Last active
July 7, 2023 00:08
-
-
Save zhuizhuhaomeng/f7d9d45c956346091c48313bccdfdbfd to your computer and use it in GitHub Desktop.
Revisions
-
zhuizhuhaomeng revised this gist
Jul 7, 2023 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ commit b322f8820f0a965bd95315d73bfecd377fe82231 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..568b50c3c 100644 --- a/translate.cxx +++ b/translate.cxx @@ -7061,9 +7061,13 @@ static void get_unwind_data (Dwfl_Module *m, @@ -18,7 +18,7 @@ index 4115650e3..24c490c63 100644 - ".debug_frame") == 0) + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress_gnu.c + if (strcmp(sh_name, ".debug_frame") == 0 + || strcmp(sh_name, ".zdebug_frame") == 0) { @@ -34,7 +34,7 @@ index 4115650e3..24c490c63 100644 - ".debug_frame") == 0) + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress_gnu.c + if (strcmp(sh_name, ".debug_frame") == 0 + || strcmp(sh_name, ".zdebug_frame") == 0) { @@ -50,7 +50,7 @@ index 4115650e3..24c490c63 100644 - ".debug_line") == 0) + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress_gnu.c + if (strcmp(sh_name, ".debug_line") == 0 + || strcmp(sh_name, ".zdebug_line") == 0) { -
zhuizhuhaomeng revised this gist
Jul 6, 2023 . 1 changed file with 24 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,36 +1,46 @@ commit 00a262bd01232575d86136814c60a2f786b29bf7 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..24c490c63 100644 --- a/translate.cxx +++ b/translate.cxx @@ -7061,9 +7061,13 @@ 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); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress.c + if (strcmp(sh_name, ".debug_frame") == 0 + || strcmp(sh_name, ".zdebug_frame") == 0) { data = elf_rawdata(scn, NULL); *debug_frame = data->d_buf; @@ -7230,9 +7234,13 @@ static void find_debug_frame_offset (Dwfl_Module *m, 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); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress.c + if (strcmp(sh_name, ".debug_frame") == 0 + || strcmp(sh_name, ".zdebug_frame") == 0) { data = elf_rawdata(scn, NULL); break; @@ -7372,9 +7380,13 @@ dump_line_tables (Dwfl_Module *m, unwindsym_dump_context *c, ehdr = gelf_getehdr(elf, &ehdr_mem); while ((scn = elf_nextscn(elf, scn))) { @@ -39,6 +49,8 @@ index 4115650e3..2a94efe4b 100644 - if (strcmp(elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name), - ".debug_line") == 0) + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); + // decompression is done via dwarf_begin_elf / global_read / check_section + // / elf_compress_gnu / __libelf_decompress in libelf/elf_compress.c + if (strcmp(sh_name, ".debug_line") == 0 + || strcmp(sh_name, ".zdebug_line") == 0) { -
zhuizhuhaomeng revised this gist
Jul 6, 2023 . 1 changed file with 34 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,46 @@ diff --git a/translate.cxx b/translate.cxx index 4115650e3..2a94efe4b 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; @@ -7230,9 +7232,11 @@ static void find_debug_frame_offset (Dwfl_Module *m, 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); break; @@ -7372,9 +7376,11 @@ dump_line_tables (Dwfl_Module *m, unwindsym_dump_context *c, ehdr = gelf_getehdr(elf, &ehdr_mem); 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_line") == 0) + sh_name = elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name); + if (strcmp(sh_name, ".debug_line") == 0 + || strcmp(sh_name, ".zdebug_line") == 0) { data = elf_rawdata(scn, NULL); if (dump_line_tables_check(data->d_buf, data->d_size) == DWARF_CB_ABORT) -
zhuizhuhaomeng created this gist
Jul 6, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ diff --git a/translate.cxx b/translate.cxx index 5bdda0dd0..9b4b0800b 100644 --- a/translate.cxx +++ b/translate.cxx @@ -6810,9 +6810,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;