dqlite icon indicating copy to clipboard operation
dqlite copied to clipboard

Use execinfo.h instead of libbacktrace

Open cole-miller opened this issue 11 months ago • 2 comments

@just-now suggested this

https://man7.org/linux/man-pages/man3/backtrace.3.html

cole-miller avatar Mar 05 '24 15:03 cole-miller

what will be involved in this:

  • get rid of the --enable-backtrace switch in configure.ac, don't try to link libbacktrace
  • in configure.ac, check for the execinfo.h header and use that to set DQLITE_ASSERT_WITH_BACKTRACE
  • get rid of src/raft/assert.h and use src/assert.h everywhere
  • rewrite the code in src/assert.h to use the execinfo.h functions instead of the libbacktrace API
  • test to make sure a backtrace is generated as expected when using glibc + gcc and glibc + clang. Bonus: see what happens with musl
  • remove --enable-backtrace and libbacktrace installation from our CI

cole-miller avatar Mar 05 '24 16:03 cole-miller

I can't assign the issue to him but @letFunny is working on this

cole-miller avatar Mar 08 '24 21:03 cole-miller

Closing because the execinfo.h API doesn't read DWARF info, hence you can't get a helpful backtrace unless you postprocess it with addr2line, which makes this feature less convenient for quick debugging -- and quick debugging is really what it's good for.

cole-miller avatar Apr 05 '24 10:04 cole-miller