-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e671aa8
Add mlpack::backtrace for Ubuntu (C++, Clang).
Kirizaki c827d59
Commit mlpack::backtrace.
Kirizaki e9ee6bd
Update for mlpack::backtrace
Kirizaki bce8a34
Delete old backtrace depend.
Kirizaki aa35528
Add mlpack::backtrace info.
Kirizaki 5f430cd
Add mlpack::backtrace header.
Kirizaki 8cbd0d5
Add mlpack::backtrace
Kirizaki 1404c1d
Add mlpack::backtrace
Kirizaki 5e2f445
Add mlpack::backtrace
Kirizaki 6257fad
Add mlpack::backtrace
Kirizaki 322d384
Merge pull request #1 from mlpack/master
Kirizaki 876de9c
Update log.cpp
Kirizaki 95b9320
Dummy constructor
Kirizaki 0a0d68b
Dummy constructor
Kirizaki dc0e553
Include backtrace.hpp only when libs are found
Kirizaki 171c35b
Work with mlpack::backtrace only when HAS_BFD_DL..
Kirizaki 170c3a2
Merge pull request #2 from mlpack/master
Kirizaki 76e48a5
Update prefixedoutstream_impl.hpp
Kirizaki f987048
Merge pull request #3 from mlpack/master
Kirizaki 6c4eb24
Add -rdynamic if BFD or DL found.
Kirizaki 0bc16ea
Change Ubuntu on Linux
Kirizaki e664f3d
Change order in printing backtrace
Kirizaki f8228a5
Change order in printing backtrace
Kirizaki 78c60a7
Merge pull request #4 from mlpack/master
Kirizaki cdb5ac3
Linux specific dependencies
Kirizaki a0472e4
Platform specific dependencies
Kirizaki 0aad1ee
Linux specific dependencies
Kirizaki 38c6d82
Update CMakeLists.txt
Kirizaki 7ae1355
Update CMakeLists.txt
Kirizaki File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# - Try to find libbfd | ||
# Once done this will define | ||
# | ||
# LIBBFD_FOUND - system has libbfd | ||
# LIBBFD_INCLUDE_DIRS - the libbfd include directory | ||
# LIBBFD_LIBRARIES - Link these to use libbfd | ||
# LIBBFD_DEFINITIONS - Compiler switches required for using libbfd | ||
# | ||
# Based on: | ||
# | ||
# Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de> | ||
# | ||
# Redistribution and use is allowed according to the terms of the New | ||
# BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
# | ||
|
||
|
||
if (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS) | ||
set (LIBBFD_FIND_QUIETLY TRUE) | ||
endif (LIBBFD_LIBRARIES AND LIBBFD_INCLUDE_DIRS) | ||
|
||
find_path (LIBBFD_INCLUDE_DIRS | ||
NAMES | ||
bfd.h | ||
dis-asm.h | ||
PATHS | ||
/usr/include | ||
/usr/local/include | ||
/opt/local/include | ||
/opt/include | ||
ENV CPATH) | ||
|
||
# Ugly, yes ugly... | ||
find_library (LIBBFD_BFD_LIBRARY | ||
NAMES | ||
bfd | ||
PATHS | ||
/usr/lib | ||
/usr/lib64 | ||
/usr/local/lib | ||
/usr/local/lib64 | ||
/usr/include | ||
/opt/local/lib | ||
/opt/usr/lib64 | ||
ENV LIBRARY_PATH | ||
ENV LD_LIBRARY_PATH) | ||
|
||
#find_library (LIBBFD_IBERTY_LIBRARY | ||
# NAMES | ||
# iberty | ||
# PATHS | ||
# /usr/lib | ||
# /usr/lib64 | ||
# /usr/local/lib | ||
# /usr/local/lib64 | ||
# /usr/include | ||
# /opt/local/lib | ||
# /opt/usr/lib64 | ||
# ENV LIBRARY_PATH | ||
# ENV LD_LIBRARY_PATH) | ||
|
||
#find_library (LIBBFD_OPCODES_LIBRARY | ||
# NAMES | ||
# opcodes | ||
# PATHS | ||
# /usr/lib | ||
# /usr/lib64 | ||
# /usr/local/lib | ||
# /usr/local/lib64 | ||
# /usr/include | ||
# /opt/local/lib | ||
# /opt/usr/lib64 | ||
# ENV LIBRARY_PATH | ||
# ENV LD_LIBRARY_PATH) | ||
|
||
|
||
include (FindPackageHandleStandardArgs) | ||
|
||
|
||
# handle the QUIETLY and REQUIRED arguments and set LIBBFD_FOUND to TRUE if all listed variables are TRUE | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBBFD DEFAULT_MSG | ||
LIBBFD_BFD_LIBRARY | ||
# LIBBFD_IBERTY_LIBRARY | ||
# LIBBFD_OPCODES_LIBRARY | ||
LIBBFD_INCLUDE_DIRS) | ||
|
||
set(LIBBFD_LIBRARIES "${LIBBFD_BFD_LIBRARY}") | ||
mark_as_advanced(LIBBFD_INCLUDE_DIRS LIBBFD_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# - Try to find libdl | ||
# Once done this will define | ||
# | ||
# LIBDL_FOUND - system has libdl | ||
# LIBDL_INCLUDE_DIRS - the libdl include directory | ||
# LIBDL_LIBRARIES - Link these to use libdl | ||
# LIBDL_NEEDS_UNDERSCORE - If extern "C" symbols are prefixed (BSD/Apple) | ||
# | ||
|
||
find_path (LIBDL_INCLUDE_DIRS NAMES dlfcn.h) | ||
find_library (LIBDL_LIBRARIES NAMES dl) | ||
include (FindPackageHandleStandardArgs) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG | ||
LIBDL_LIBRARIES | ||
LIBDL_INCLUDE_DIRS) | ||
|
||
SET(CMAKE_REQUIRED_LIBRARIES dl) | ||
INCLUDE(CheckCSourceRuns) | ||
CHECK_C_SOURCE_RUNS("#include <dlfcn.h> | ||
#include <stdlib.h> | ||
void testfunc() {} | ||
int main() { | ||
testfunc(); | ||
if (dlsym(0, \"_testfunc\") != (void*)0) { | ||
return EXIT_SUCCESS; | ||
} else { | ||
return EXIT_FAILURE; | ||
} | ||
}" LIBDL_NEEDS_UNDERSCORE) | ||
|
||
mark_as_advanced(LIBDL_INCLUDE_DIRS LIBDL_LIBRARIES LIBDL_NEEDS_UNDERSCORE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,11 +41,11 @@ if(UNIX AND NOT APPLE) | |
target_link_libraries(mlpack rt) | ||
endif(UNIX AND NOT APPLE) | ||
|
||
# Log::Assert may require linking against whatever provides backtrace | ||
# functionality. | ||
if(Backtrace_FOUND) | ||
target_link_libraries(mlpack ${Backtrace_LIBRARIES}) | ||
endif(Backtrace_FOUND) | ||
# Backtrace for Ubuntu need those libs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd change Ubuntu to just "Linux" here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
if(LIBBFD_FOUND AND LIBDL_FOUND AND DEBUG) | ||
target_link_libraries(mlpack ${LIBBFD_LIBRARIES}) | ||
target_link_libraries(mlpack ${LIBDL_LIBRARIES}) | ||
endif(LIBBFD_FOUND AND LIBDL_FOUND AND DEBUG) | ||
|
||
# Collect all header files in the library. | ||
file(GLOB_RECURSE INCLUDE_H_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 (likemlpack_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.