Ales Musil <amu...@redhat.com> writes: > Use the backtrace functions that is provided by libc, > this allows us to get backtrace that is independent of > the current memory map of the process. Which in turn can > be used for debugging/tracing purpose. The backtrace > is not 100% accurate due to various optimizations, most > notably "-fomit-frame-pointer" and LTO. This might result > that the line in source file doesn't correspond to the > real line. However, it should be able to pinpoint at least > the function where the backtrace was called. > > The usage for SIGSEGV is determined during compilation > based on available libraries. Libunwind has higher priority > if both methods are available to keep the compatibility with > current behavior. > > The backtrace is not marked as signal safe however the backtrace > manual page gives more detailed explanation why it might be the > case [0]. Load the "libgcc" or equivalent in advance within the > "fatal_signal_init" which should ensure that subsequent calls > to backtrace* do not call malloc and are signal safe. > > The typical backtrace will look similar to the one below: > /lib64/libopenvswitch-3.1.so.0(backtrace_capture+0x1e) [0x7fc5db298dfe] > /lib64/libopenvswitch-3.1.so.0(log_backtrace_at+0x57) [0x7fc5db2999e7] > /lib64/libovsdb-3.1.so.0(ovsdb_txn_complete+0x7b) [0x7fc5db56247b] > /lib64/libovsdb-3.1.so.0(ovsdb_txn_propose_commit_block+0x8d) [0x7fc5db563a8d] > ovsdb-server(+0xa661) [0x562cfce2e661] > ovsdb-server(+0x7e39) [0x562cfce2be39] > /lib64/libc.so.6(+0x27b4a) [0x7fc5db048b4a] > /lib64/libc.so.6(__libc_start_main+0x8b) [0x7fc5db048c0b] > ovsdb-server(+0x8c35) [0x562cfce2cc35] > > backtrace.h elaborates on how to effectively get the line > information associated with the addressed presented in the > backtrace. > > [0] > backtrace() and backtrace_symbols_fd() don't call malloc() > explicitly, but they are part of libgcc, which gets loaded > dynamically when first used. Dynamic loading usually triggers > a call to malloc(3). If you need certain calls to these two > functions to not allocate memory (in signal handlers, for > example), you need to make sure libgcc is loaded beforehand > > Reported-at: https://bugzilla.redhat.com/2177760 > Signed-off-by: Ales Musil <amu...@redhat.com> > ---
Acked-by: Aaron Conole <acon...@redhat.com> _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev