bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.65k stars 465 forks source link

On arm signal trace error #333

Open Makmanfu opened 3 months ago

Makmanfu commented 3 months ago

compilation platform:Linux frp-OptiPlex-7050 5.4.0-173-generic #191-Ubuntu SMP Fri Feb 2 13:55:07 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux host platform:arm-linux-gnueabihf

source code:

#define BACKWARD_HAS_DW 1
#include "backward.hpp"

int func2(int * a){
    * a = 12;
    return *a;
}

int func1(){
    return func2(nullptr);
}

int main(int argc, char* argv[]) {
    backward::SignalHandling sh;

    func1();
    return 0;
}

result:

/userdata # ./untitled Stack trace (most recent call last):

5 Object "", at 0xb6c8f14f, in

4 Source "/home/frp/1-Code/example/untitled/backward.hpp", line 4296, in sig_handler [0x33b13]

3 Source "/home/frp/1-Code/example/untitled/backward.hpp", line 4270, in handleSignal [0x33a85]

2 Source "/home/frp/1-Code/example/untitled/backward.hpp", line 886, in load_from [0x31961]

1 Source "/home/frp/1-Code/example/untitled/backward.hpp", line 879, in load_here [0x318ef]

0 Source "/home/frp/1-Code/example/untitled/backward.hpp", line 861, in unwind<backward::StackTraceImpl::callback> [0x33e1d]

Segmentation fault (Address not mapped to object [(nil)]) Segmentation fault

Makmanfu commented 3 months ago

It is correct to run it locally:

Stack trace (most recent call last):
#5    Object "", at 0xffffffffffffffff, in 
#4    Object "/home/frp/1-Code/example/untitled/cmake-build-debug/untitled", at 0x556ef804d01d, in _start
#3    Source "../csu/libc-start.c", line 308, in __libc_start_main [0x7f8619676082]
#2    Source "/home/frp/1-Code/example/untitled/main.cpp", line 44, in main [0x556ef804d122]
         41: int main(int argc, char* argv[]) {
         42: 
         43: 
      >  44:     func1();
         45: 
         46: #if 0
         47:     auto * buffer = new uint8_t [1024];
#1    Source "/home/frp/1-Code/example/untitled/main.cpp", line 38, in func1 [0x556ef804d108]
         35: }
         36: 
         37: int func1(){
      >  38:     return func2(nullptr);
         39: }
         40: backward::SignalHandling sh;
         41: int main(int argc, char* argv[]) {
#0    Source "/home/frp/1-Code/example/untitled/main.cpp", line 33, in func2 [0x556ef804d0e9]
         30: #include "backward.hpp"
         31: 
         32: int func2(int * a){
      >  33:     * a = 12;
         34:     return *a;
         35: }
Segmentation fault (Address not mapped to object [(nil)])

进程已结束,退出代码139 (interrupted by signal 11: SIGSEGV)