Hello guys. I need your help and ideas on something I am working on porting.
I am using gcc 8 and I have managed to compile a program, which is written in c++, and having it working pretty well, except one thing, were I need your help.
The problem I am experiencing is that the app crashes when it exits. Even if I execute just the binary with no arguments, it prints out all the help information and then crashes. I tested it with one of its features and reported fine all it had to report, and then it crashed when it finished its work.
I used gstabs to get more info and understand where it crashes and that pointed to stl_list.h which can be seen at https://gcc.gnu.org/onlinedocs/gcc-4.7.2/libstdc++/api/a01472_source.html line 156.
I tried to track down until where it goes before it crashes and gets up to
return EXIT_SUCCESS;
and after that, it crashes.
At the serial I get the following:
Dump of context at 0xEF9E8000 Trap type: DSI exception Current kernel stack pointer: 0x022397B0 DSISR: 00000000 DAR: 00000008 No matching page found Machine State (raw): 0x0002F030 Machine State (verbose): [Critical Ints on] [ExtInt on] [User] [IAT on] [DAT on] Instruction pointer: 0x7DD8C5A8 Crashed process: cppcheck (0x5C8A8E40) DSI verbose error description: Access to address 0x00000008 not allowed by page protection in user state (protection violation) Access was a load operation Exception Syndrome Register: 0x00000000 0: 7DD8C6F0 54DD0C70 00000002 5EFA8820 54DD0C98 00000000 0000127F 54DD0BD8 8: FFFFFFFF 563F19C0 5EFA8870 5C8A8E40 39553935 5EFB0050 54EF4D80 00000001 16: 551FD9BC 56011BF0 568424F0 00000000 54DD0DA8 7E08BEE0 00000009 54EF4D70 24: 00000000 54EF4D60 00000000 5EFA8820 54DD0C98 5EFA8820 00000000 00000000 CR: 59553935 XER: 8000007E CTR: 0183A62C LR: 7DD8C6F0 Temporary stack trace: #0: 0x7DD8C5A8 #1: 0x7DD8C6F0 #2: 0x7DD8CE54 #3: in module newlib.library.kmod+0x0000011C (0x01A6757C) #4: in module newlib.library.kmod+0x00002564 (0x01A699C4) #5: in module newlib.library.kmod+0x00003340 (0x01A6A7A0) #6: in module newlib.library.kmod+0x00003864 (0x01A6ACC4) #7: 0x7DD6CB40 #8: in module dos.library.kmod+0x00029E18 (0x0195E378) #9: in module kernel+0x0005F21C (0x0185F21C) #10: in module kernel+0x0005F294 (0x0185F294) #11: 0x00000000"hid.usbfd" | "HID Server" | No known RootApps in device [USB] ERROR | "hid.usbfd" | "HID Server" | No known RootApps in device Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000000, pc = 0x7DD8C5B0, lr = 0x7DD8C6F0, Task 0x5C8A8E40 (Shell Process) bad access @ 0x00000008, pc = 0x7DD8C5A8, lr = 0x7DD8C6F0,
The last lines continue endlessly.
If I use gdb I get the following, although I am not sure how well gdb works on X5000:
Program received signal SIGSEGV, Segmentation fault. std::_List_iterator<Check*>::operator++ (this=0x549a0c34) at /MDH1/SDK/gcc/include/c++/8.4.0/bits/stl_list.h:219 219 /MDH1/SDK/gcc/include/c++/8.4.0/bits/stl_list.h: No such file or directory. in /MDH1/SDK/gcc/include/c++/8.4.0/bits/stl_list.h (gdb) bt #0 std::_List_iterator<Check*>::operator++ (this=0x549a0c34) at /MDH1/SDK/gcc/include/c++/8.4.0/bits/stl_list.h:219 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 #1 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #2 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #3 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #4 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #5 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #6 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #7 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #8 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #9 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #10 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #11 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #12 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #13 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 64 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 trad_frame_addr_p: 0 trad_frame_realreg_p: 1 trad_frame_value_p: 0 alt 2, regnum: 67 realreg: 67 #14 0x7ef64590 in std::__cxx11::list<Check*, std::allocator<Check*> >::remove () at /MDH1/SDK/gcc/include/c++/8.4.0/bits/list.tcc:334 Previous frame inner to this frame (corrupt stack?)
Also, I tried before run it to increase the stack of the shell even up to 1000000, but that didn't help at all.
Has anyone ever had same experience?
With the help of the original developers we found that it seems that destructors are called in wrong order which causes a segmentation fault. We applied a fix that ensures pointer remains valid and reachable until program terminates.