Skip to content

Commit

Permalink
兼容centos
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Sep 12, 2024
1 parent 6e438d3 commit e7e2524
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bee/crash/stacktrace_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define PACKAGE "bee.lua"
#define PACKAGE_VERSION 1
#include <bfd.h>

#include <link.h>

#include <cstdio>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e7e2524

Please sign in to comment.