Open MoBaT opened 3 years ago
Maybe compare the assembly output. It could be that the optimization makes it impossible to map the exact line. So you get the end of the function?
On Wed, 23 Jun 2021, 14:29 Moe Bataineh, @.***> wrote:
I have a test project compiled on an aarch64 system (Jetson Xavier) that looks like:
int main() { bool a = false;
char *ptr2 = (char *)42; *ptr2 = 42; bool b = true; return 0;
}
With schedule-insns (Optimization flag 02+), I get this stack:
5 Object "/home/user/gazebo_dev/halo-server-remote/bin/cmake-build-remote/aarch64/release/backtrace_release/backtrace_release", at 0x555b4c0623, in
4 Object "/lib/aarch64-linux-gnu/libc.so.6", at 0x7fb791e6df, in __libc_start_main
3 Source "/home/user/gazebo_dev/halo-server-remote/src/test/backtrace/main.cxx", line 11, in int main() [0x555b4c05e7]
8: bool b = true; 9: 10: return 0; > 11: } 12: 13: // #include <unistd.h> 14: //
2 Object "linux-vdso.so.1", at 0x7fb7d6f6b0, in __kernel_rt_sigreturn
1 Source "/home/user/gazebo_dev/halo-server-remote/src/module_server/stacktrace/backward.hpp", line 4257, in backward::SignalHandling::sig_handler(int signo, siginfo_t info, void _ctx) [0x555b4ccbab]
4254: #endif 4255: static void 4256: sig_handler(int signo, siginfo_t *info, void *_ctx) { >4257: handleSignal(signo, info, _ctx); 4258: 4259: // try to forward the signal. 4260: raise(info->si_signo);
0 | Source "/home/user/gazebo_dev/halo-server-remote/src/module_server/stacktrace/backward.hpp", line 4231, in (void addr, size_t depth, void context, void *error_addr)
| 4229: #endif | 4230: if (error_addr) { | >4231: st.load_from(error_addr, 32, reinterpret_cast<void *>(uctx), | 4232: info->si_addr); | 4233: } else { Source "/home/user/gazebo_dev/halo-server-remote/src/module_server/stacktrace/backward.hpp", line 870, in backward::SignalHandling::handleSignal(int, siginfo_t *info, void *_ctx) [0x555b4cad17] 867: } 868: size_t load_from(void *addr, size_t depth = 32, void *context = nullptr, 869: void *error_addr = nullptr) { > 870: load_here(depth + 8, context, error_addr); 871: 872: for (size_t i = 0; i < _stacktrace.size(); ++i) { 873: if (_stacktrace[i] == addr) {
Segmentation fault (Address not mapped to object [0x2a])
With Optimization flags -O0 -O1, I get the proper stack where it shows the segfault happening on line *ptr2 = 42;.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bombela/backward-cpp/issues/227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUZDCLTOF44HUG5YDWBVLTUJG4XANCNFSM47GTXAFA .
I have a test project compiled on an aarch64 system (Jetson Xavier) that looks like:
With
schedule-insns
(Optimization flag 02+), I get this stack:With Optimization flags -O1, I get the proper stack only if the fault happened in another cxx file other than main.cxx.
With Optimization flags -O0, I get the proper stack where it shows the segfault happening on line
*ptr2 = 42;
on all cases.