eggdrop icon indicating copy to clipboard operation
eggdrop copied to clipboard

Remove Context(), add libbacktrace or similar.

Open thommey opened this issue 9 years ago • 2 comments

The Context() calls have mostly been removed from the core to a point where the last context is completely useless, it is almost always tclhash.c's bind calling function. We discussed adding libunwind before to get a backtrace into the DEBUG file even when compiled without debugging symbols.

thommey avatar Feb 23 '16 14:02 thommey

I understand, Context() is no use and will be replaced. But now some years passed by without any replacement. Can we just remove Context() right now? Or is there any good reason to leave it in? It looks like a placeholder for something probably never comming. And it will still be in git, if you need to take a look at that placeholder in the future.

michaelortmann avatar Sep 12 '18 23:09 michaelortmann

from linux man page:

backtrace(), backtrace_symbols(), and backtrace_symbols_fd() are provided in glibc since version 2.1.

BUT: 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.

from freebsd man page:

The backtrace() library of functions first appeared in NetBSD 7.0 and FreeBSD 10.0.

alternative:

There is also libbacktrace, but we dont want dependencies.

conclusion

We should remove Context, not add backtrace() or libbacktrace, and have a message to our sigv handler that tells the user to create and send in a backtrace with gdb and eggdrop.core. We already have a message in our segv handler pointing the user to https://github.com/eggheads/eggdrop/blob/develop/doc/BUG-REPORT but can that doc be enhanced? it points to github and it has a gdb secion. only the whole doc is TLDR-length and i hope we could point to gdb in a faster way. also, maybe we want to add a small line that points the user towards our irc developer chan?

About debugging symbols. gcc added -Og, so we could detect -Og availability in configure and use -Og as our optimization level for release. As thommey says: eggdrop is not cpu bound.

Even without any replacement or any other enhancement to debuggung, ripping our Context would help, because it is not helping, and does mislead.

michaelortmann avatar Nov 06 '21 23:11 michaelortmann