diff --git a/CMakeLists.txt b/CMakeLists.txt index 281a14f8..918a7f9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) #### Compiler configuration, see cmake/compilerconfig.cmake include(compilerconfig) +include(doxygen) #### Backend selection #### OPTION( BUILD_BOCHS "Build Bochs Variant?" ON) diff --git a/src/core/Doxyfile.in b/cmake/Doxyfile.in similarity index 99% rename from src/core/Doxyfile.in rename to cmake/Doxyfile.in index 0a0701f1..f306abd4 100644 --- a/src/core/Doxyfile.in +++ b/cmake/Doxyfile.in @@ -33,14 +33,14 @@ PROJECT_NAME = @PROJECT_NAME@ # if some version control system is used. ## The current version is also replaced on the fly by cmake -PROJECT_NUMBER = @FAILSTAR_VERSION@ +PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = doc +OUTPUT_DIRECTORY = @FAIL_DOC_OUTPUT@ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -218,7 +218,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. -EXTENSION_MAPPING = +EXTENSION_MAPPING = ah=C++ # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should @@ -227,7 +227,7 @@ EXTENSION_MAPPING = # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. @@ -605,7 +605,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = +EXCLUDE = @FAIL_DOC_EXCLUDE@ # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded @@ -808,7 +808,7 @@ HTML_STYLESHEET = # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. -HTML_TIMESTAMP = NO +HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to @@ -951,7 +951,7 @@ QHG_LOCATION = # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before the help appears. -GENERATE_ECLIPSEHELP = NO +GENERATE_ECLIPSEHELP = YES # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have @@ -1019,7 +1019,7 @@ SERVER_BASED_SEARCH = NO # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/cmake/doxygen.cmake b/cmake/doxygen.cmake new file mode 100644 index 00000000..789f4baa --- /dev/null +++ b/cmake/doxygen.cmake @@ -0,0 +1,25 @@ + +### Setup doxygen documentation +find_package(Doxygen) +if(DOXYGEN_FOUND) +# Using a .in file means we can use CMake to insert project settings +# into the doxyfile. For example, CMake will replace @PROJECT_NAME@ in +# a configured file with the CMake PROJECT_NAME variable's value. + +set(FAIL_DOC_OUTPUT "${PROJECT_BINARY_DIR}/doc") +set(FAIL_DOC_EXCLUDE "${PROJECT_SOURCE_DIR}/simulators ${PROJECT_SOURCE_DIR}/build ${PROJECT_SOURCE_DIR}/src/core/util/pstream.h") +file(MAKE_DIRECTORY ${FAIL_DOC_OUTPUT}) + +configure_file(${PROJECT_SOURCE_DIR}/cmake/Doxyfile.in + ${PROJECT_BINARY_DIR}/Doxyfile @ONLY} +) + +## call make doc to generate documentation +add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + DEPENDS ${PROJECT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMENT "[${PROJECT_NAME}] Generating Fail* documentation with Doxygen" VERBATIM +) +endif(DOXYGEN_FOUND) + diff --git a/scripts/t32cmm/CMakeLists.txt b/scripts/t32cmm/CMakeLists.txt index 8e7334b9..85d9c326 100644 --- a/scripts/t32cmm/CMakeLists.txt +++ b/scripts/t32cmm/CMakeLists.txt @@ -2,14 +2,14 @@ if(EXISTS $ENV{T32SYS}) SET(T32_SYS $ENV{T32SYS}) - message(STATUS "[FAIL*] T32 base directory: T32SYS=${T32_SYS}") + message(STATUS "[Fail*] T32 base directory: T32SYS=${T32_SYS}") else() message(FATAL_ERROR "Please set env variable T32SYS to a valid T32 installation base directory.") endif() if(EXISTS $ENV{FAIL_ELF_PATH}) SET(T32_ELF_PATH $ENV{FAIL_ELF_PATH}) - message(STATUS "[FAIL*] T32 ELF under test: ${T32_ELF_PATH}") + message(STATUS "[Fail*] T32 ELF under test: ${T32_ELF_PATH}") else() message(FATAL_ERROR "Please set the FAIL_ELF_PATH enviroment variable to the binary under test.") endif() @@ -32,9 +32,9 @@ set(T32_EXE "${T32_SYS}/bin/pc_linux64/" CACHE INTERNAL "") # TODO: set pc_linux add_subdirectory(${T32_ARCHITECTURE}) -message(STATUS "[FAIL*] T32 Architecture: ${T32_ARCHITECTURE}") -message(STATUS "[FAIL*] T32 CPU name: ${T32_CPUNAME}") -message(STATUS "[FAIL*] T32 Executable: ${T32_EXE}") +message(STATUS "[Fail*] T32 Architecture: ${T32_ARCHITECTURE}") +message(STATUS "[Fail*] T32 CPU name: ${T32_CPUNAME}") +message(STATUS "[Fail*] T32 Executable: ${T32_EXE}") add_custom_target(runt32 COMMAND T32CONFIG=${PROJECT_BINARY_DIR}/cmm/config.t32 ${T32_EXE} & diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5a3cd6cc..df4d5eb8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -3,26 +3,6 @@ find_package(Boost 1.42 COMPONENTS thread REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) -### Setup doxygen documentation -# TODO: put into helpers.cmake (?) -find_package(Doxygen) -if(DOXYGEN_FOUND) -# Using a .in file means we can use CMake to insert project settings -# into the doxyfile. For example, CMake will replace @PROJECT_NAME@ in -# a configured file with the CMake PROJECT_NAME variable's value. -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in - ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY} -) - -## call make doc to generate documentation -add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "[${PROJECT_NAME}] Generating Fail* documentation with Doxygen" VERBATIM -) -endif(DOXYGEN_FOUND) - ## Add CMakeLists from subdirectories ## # The autogenerated header files add_subdirectory(config) diff --git a/src/core/util/CMakeLists.txt b/src/core/util/CMakeLists.txt index 5a2d5bf3..ef8190c5 100644 --- a/src/core/util/CMakeLists.txt +++ b/src/core/util/CMakeLists.txt @@ -43,5 +43,16 @@ if(${LIB_IBERTY} STREQUAL LIB_IBERTY-NOTFOUND) message(FATAL_ERROR "libiberty not found. Try installing binutils-dev: [ sudo aptitude install binutils-dev ]") endif() +# objdump required by Diassembler.cc + +set(THE_OBJDUMP "${ARCH_TOOL_PREFIX}objdump") +find_program(FAIL_OBJDUMP "${THE_OBJDUMP}" DOC "binutils object dump tool") +if(${FAIL_OBJDUMP} STREQUAL FAIL_OBJDUMP-NOTFOUND) + message(FATAL_ERROR "Cannot find objdump exeuctable (tried: ${THE_OBJDUMP}") +else() + message(STATUS "[Fail*] objdump binary -> ${FAIL_OBJDUMP}") +endif() +mark_as_advanced(FAIL_OBJDUMP) + add_library(fail-util ${SRCS}) target_link_libraries(fail-util ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${LIB_IBERTY} ) diff --git a/src/core/util/Demangler.hpp b/src/core/util/Demangler.hpp index b8d7299a..3daeba55 100644 --- a/src/core/util/Demangler.hpp +++ b/src/core/util/Demangler.hpp @@ -11,7 +11,7 @@ namespace fail { /** * Get the demangled symbol name of a mangled string. * @param name The mangled symbol - * @return The according demangled name if found, else Demangler:::DEMANGLE_FAILED + * @return The according demangled name if found, else Demangler::DEMANGLE_FAILED */ static std::string demangle(const std::string & name); diff --git a/src/core/util/Disassembler.cc b/src/core/util/Disassembler.cc index dc77617a..8172c103 100644 --- a/src/core/util/Disassembler.cc +++ b/src/core/util/Disassembler.cc @@ -9,6 +9,7 @@ #include #include #endif +#include namespace fail { @@ -21,7 +22,7 @@ namespace fail { char * elfpath = getenv("FAIL_ELF_PATH"); if(elfpath == NULL){ m_log << "FAIL_ELF_PATH not set :(" << std::endl; - return 0; + exit(EXIT_FAILURE); }else{ return init(elfpath); } @@ -44,7 +45,7 @@ namespace fail { if(ex != 0){ m_code.clear(); m_log << "Could not disassemble!" << std::endl; - return 0; + exit(EXIT_FAILURE); } } m_log << "disassembled " << m_code.size() << " lines." << std::endl; diff --git a/src/core/util/Disassembler.hpp b/src/core/util/Disassembler.hpp index a8a60023..fc281bec 100644 --- a/src/core/util/Disassembler.hpp +++ b/src/core/util/Disassembler.hpp @@ -9,8 +9,8 @@ namespace fail { - //! Inform about failed disassembly struct DISASSEMBLER { + //! Inform about failed disassembly static const std::string FAILED; }; @@ -40,7 +40,7 @@ namespace fail { /** * Get disassembler instruction * @param address The instruction address - * @return The according disassembled instruction if found, else DISASSEMBLER:FAILED + * @return The according disassembled instruction if found, else DISASSEMBLER::FAILED */ const Instruction & disassemble(address_t address) const;