From e7e2524805baa267d857edf04b699c0353c7eb1d Mon Sep 17 00:00:00 2001 From: actboy168 Date: Thu, 12 Sep 2024 11:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9centos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bee/crash/stacktrace_linux.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bee/crash/stacktrace_linux.cpp b/bee/crash/stacktrace_linux.cpp index 69c0cd36..620d1fd1 100644 --- a/bee/crash/stacktrace_linux.cpp +++ b/bee/crash/stacktrace_linux.cpp @@ -4,7 +4,6 @@ #define PACKAGE "bee.lua" #define PACKAGE_VERSION 1 #include - #include #include @@ -33,12 +32,25 @@ namespace bee::crash { auto f = (address_finder *)(data); if (f->found) return; +#ifdef bfd_get_section_flags + if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) + return; +#else if ((bfd_section_flags(section) & SEC_ALLOC) == 0) return; +#endif +#ifdef bfd_get_section_vma + bfd_vma vma = bfd_get_section_vma(abfd, section); +#else bfd_vma vma = bfd_section_vma(section); +#endif if (f->pc < vma) return; +#ifdef bfd_get_section_size + bfd_size_type size = bfd_get_section_size(section); +#else bfd_size_type size = bfd_section_size(section); +#endif if (f->pc >= vma + size) return; f->found = bfd_find_nearest_line(abfd, section, f->syms, f->pc - vma, &f->filename, &f->functionname, &f->line);