New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mlpack::backtrace utility. #535
Conversation
Add find_package LibBfd.cmake / LibDL.cmake and inc. dirs.
Add note about printing a backtrace.
Include header file.
Include header & source files for backtrace.
Printing backtrace for Log::Assert.
Prints backtrace for Log::Fatal.
Add linking to libraries for backtrace.
Test the RMSprop optimizer with logistic regression and a feedforward…
Update from master
Sweet! I will look through this and test it tomorrow. |
Why it doesn't build correctly? I didn't change anything in tests... Maybe I just merge my branch with master which has some bug and then make my PR or my changes has conflicts with test no. 4 on which travis is crushing? |
merge from mlpack
The travis build was a random test failure, it has nothing to do with your PR, so don't worry about it. Probabilistic tests can be difficult to deal with for this reason... |
Ohh, that's the thing! |
if(LIBBFD_FOUND AND LIBDL_FOUND) | ||
include_directories(${LIBBFD_INCLUDE_DIRS}) | ||
include_directories(${LIBDL_INCLUDE_DIRS}) | ||
add_definitions(-DHAS_BFD_DL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
here; if I didn't do this, then if an assert or fatal error was thrown in any of the mlpack programs (like mlpack_allknn
), it wouldn't give a backtrace but would tell me that I needed to compile with -rdynamic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I tested this on Linux, it works great when I make the necessary change to CMakeLists.txt. I tried to compile on OS X and I get this:
I think that this has been tested on OS X and is known to not work, so maybe we disable HAS_BFD_DL in the CMake configuration if we are on OS X? Either way we should be sure that compilation works out-of-the-box on OS X. Also there is the warning from clang that -rdynamic is unsupported; maybe different handling is necessary there? I haven't been able to actually test with clang because of a Debian bug that affects the system I was testing on: It would also be cool to test this on FreeBSD but my FreeBSD box is not running right now... :( |
I should add, I'm very excited about this, I think this backtrace is a really nice improvement. 👍 |
Part You pointed in code is done. Second thing:
Disabling
So my next step is to prevent building |
Awesome, this sounds like a good approach. I'm fine with this only working on Linux for now (because I think what we have implemented only works on Linux, and it doesn't work very well), and we can extend support later. We just have to make sure that it still compiles correctly on other platforms before we merge it in. :) |
I agree. I forget that |
Use CreateNVP from the data namespace.
Okay, I tested the code on FreeBSD, and ended up with the same error as for OSX: there is no '/proc/self/exe'. I changed the CMakeLists.txt file so that it doesn't look for the libdl library. libdl is is part of libc so FindLibDL always returns "libdl not found". Anyway, everything builds fine, without changing the CMakeLists.txt file. |
Find and compile libbfd & libdl only when OS is Linux.
...find and compile libbfd & libdl only when OS is Linux.
...compile backtrace.hpp only when OS is Linux
Since, we tested this on FreeBSD, OSX and windows, yes right Microsoft Windows. I'll go and merge this in. Thanks for the contribution! |
Thanks again, this is great! :) |
When build:
cmake -DDEBUG=ON ../
,Log::Assert()
&Log::Fatal
prints backtrace.ONLY FOR LINUX