diff --git a/lldb/tools/intel-features/cli-wrapper.cpp b/lldb/tools/intel-features/cli-wrapper.cpp --- a/lldb/tools/intel-features/cli-wrapper.cpp +++ b/lldb/tools/intel-features/cli-wrapper.cpp @@ -19,7 +19,7 @@ #endif #ifdef BUILD_INTEL_PT -#include "intel-pt/cli-wrapper-pt.h" +#include "intel-pt/API/cli-wrapper-pt.h" #endif #include "lldb/API/SBDebugger.h" diff --git a/lldb/tools/intel-features/intel-pt/CMakeLists.txt b/lldb/tools/intel-features/intel-pt/CMakeLists.txt --- a/lldb/tools/intel-features/intel-pt/CMakeLists.txt +++ b/lldb/tools/intel-features/intel-pt/CMakeLists.txt @@ -1,31 +1,5 @@ -if (NOT LIBIPT_INCLUDE_PATH) - message (FATAL_ERROR "libipt include path not provided") -endif() +set(INTEL_PT_INCLUDES + ${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt/include +) -if (NOT EXISTS "${LIBIPT_INCLUDE_PATH}") - message (FATAL_ERROR "invalid libipt include path provided") -endif() -include_directories(${LIBIPT_INCLUDE_PATH}) - -if (NOT LIBIPT_LIBRARY_PATH) - find_library(LIBIPT_LIBRARY ipt) -else() - if (NOT EXISTS "${LIBIPT_LIBRARY_PATH}") - message (FATAL_ERROR "invalid libipt library path provided") - endif() - find_library(LIBIPT_LIBRARY ipt PATHS ${LIBIPT_LIBRARY_PATH}) -endif() - -if (NOT LIBIPT_LIBRARY) - message (FATAL_ERROR "libipt library not found") -endif() - -add_lldb_library(lldbIntelPT - PTDecoder.cpp - Decoder.cpp - cli-wrapper-pt.cpp - - LINK_LIBS - ${LIBIPT_LIBRARY} - liblldb - ) +add_subdirectory(source) diff --git a/lldb/tools/intel-features/intel-pt/PTDecoder.h b/lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h rename from lldb/tools/intel-features/intel-pt/PTDecoder.h rename to lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h --- a/lldb/tools/intel-features/intel-pt/PTDecoder.h +++ b/lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef PTDecoder_h_ -#define PTDecoder_h_ +#ifndef LLDB_INTEL_PT_API_PT_DECODER_H +#define LLDB_INTEL_PT_API_PT_DECODER_H // C/C++ Includes #include @@ -280,4 +280,4 @@ }; } // namespace intelpt -#endif // PTDecoder_h_ +#endif // LLDB_INTEL_PT_API_PT_DECODER_H diff --git a/lldb/tools/intel-features/intel-pt/cli-wrapper-pt.h b/lldb/tools/intel-features/intel-pt/include/intel-pt/API/cli-wrapper-pt.h rename from lldb/tools/intel-features/intel-pt/cli-wrapper-pt.h rename to lldb/tools/intel-features/intel-pt/include/intel-pt/API/cli-wrapper-pt.h diff --git a/lldb/tools/intel-features/intel-pt/Decoder.h b/lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h rename from lldb/tools/intel-features/intel-pt/Decoder.h rename to lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h --- a/lldb/tools/intel-features/intel-pt/Decoder.h +++ b/lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef Decoder_h_ -#define Decoder_h_ +#ifndef LLDB_INTEL_PT_CORE_DECODER_H +#define LLDB_INTEL_PT_CORE_DECODER_H // C/C++ Includes #include @@ -324,4 +324,4 @@ }; } // namespace intelpt_private -#endif // Decoder_h_ +#endif // LLDB_INTEL_PT_CORE_DECODER_H diff --git a/lldb/tools/intel-features/intel-pt/interface/PTDecoder.i b/lldb/tools/intel-features/intel-pt/interface/PTDecoder.i --- a/lldb/tools/intel-features/intel-pt/interface/PTDecoder.i +++ b/lldb/tools/intel-features/intel-pt/interface/PTDecoder.i @@ -7,4 +7,4 @@ %include "lldb/API/SBDefines.h" -%include "../PTDecoder.h" +%include "intel-pt/API/PTDecoder.h" diff --git a/lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt b/lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt @@ -0,0 +1,9 @@ +add_lldb_library(lldbIntelPT + PTDecoder.cpp + cli-wrapper-pt.cpp + + LINK_LIBS + lldbIntelPTCore +) + +target_include_directories(lldbIntelPT PUBLIC ${INTEL_PT_INCLUDES}) diff --git a/lldb/tools/intel-features/intel-pt/PTDecoder.cpp b/lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp rename from lldb/tools/intel-features/intel-pt/PTDecoder.cpp rename to lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp --- a/lldb/tools/intel-features/intel-pt/PTDecoder.cpp +++ b/lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "PTDecoder.h" -#include "Decoder.h" +#include "intel-pt/API/PTDecoder.h" +#include "intel-pt/Core/Decoder.h" using namespace intelpt; using namespace intelpt_private; diff --git a/lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp b/lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp rename from lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp rename to lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp --- a/lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp +++ b/lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp @@ -20,8 +20,8 @@ #include #include -#include "PTDecoder.h" -#include "cli-wrapper-pt.h" +#include "intel-pt/API/PTDecoder.h" +#include "intel-pt/API/cli-wrapper-pt.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBDebugger.h" diff --git a/lldb/tools/intel-features/intel-pt/source/CMakeLists.txt b/lldb/tools/intel-features/intel-pt/source/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/lldb/tools/intel-features/intel-pt/source/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(Core) +add_subdirectory(API) diff --git a/lldb/tools/intel-features/intel-pt/CMakeLists.txt b/lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt copy from lldb/tools/intel-features/intel-pt/CMakeLists.txt copy to lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt --- a/lldb/tools/intel-features/intel-pt/CMakeLists.txt +++ b/lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt @@ -20,12 +20,12 @@ message (FATAL_ERROR "libipt library not found") endif() -add_lldb_library(lldbIntelPT - PTDecoder.cpp +add_lldb_library(lldbIntelPTCore Decoder.cpp - cli-wrapper-pt.cpp LINK_LIBS ${LIBIPT_LIBRARY} liblldb - ) +) + +target_include_directories(lldbIntelPTCore PRIVATE ${INTEL_PT_INCLUDES}) diff --git a/lldb/tools/intel-features/intel-pt/Decoder.cpp b/lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp rename from lldb/tools/intel-features/intel-pt/Decoder.cpp rename to lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp --- a/lldb/tools/intel-features/intel-pt/Decoder.cpp +++ b/lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "Decoder.h" +#include "intel-pt/Core/Decoder.h" // C/C++ Includes #include diff --git a/lldb/tools/intel-features/scripts/CMakeLists.txt b/lldb/tools/intel-features/scripts/CMakeLists.txt --- a/lldb/tools/intel-features/scripts/CMakeLists.txt +++ b/lldb/tools/intel-features/scripts/CMakeLists.txt @@ -10,7 +10,7 @@ set(INCLUDES -I${LLDB_SOURCE_DIR}/include - -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt + -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt/include ) set(OUTPUT_PYTHON_WRAPPER diff --git a/lldb/tools/intel-features/scripts/lldb-intel-features.swig b/lldb/tools/intel-features/scripts/lldb-intel-features.swig --- a/lldb/tools/intel-features/scripts/lldb-intel-features.swig +++ b/lldb/tools/intel-features/scripts/lldb-intel-features.swig @@ -20,7 +20,7 @@ %{ #include "lldb/lldb-public.h" -#include "intel-pt/PTDecoder.h" +#include "intel-pt/API/PTDecoder.h" using namespace intelpt; %}