wallace created this revision. wallace added a reviewer: clayborg. Herald added subscribers: lldb-commits, mgorny. Herald added a project: LLDB. wallace requested review of this revision. Herald added a subscriber: JDevlieghere.
Depends on D85068 <https://reviews.llvm.org/D85068>. The existing folder structure was not great and was using relative includes for headers in C++ files, which I'm not fond of. I've split the code into two main groups: Core and API. This will help us have a clear separation between the public and private code. Besides, I've updated the CMakeFile accordingly. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85070 Files: lldb/tools/intel-features/cli-wrapper.cpp lldb/tools/intel-features/intel-pt/CMakeLists.txt lldb/tools/intel-features/intel-pt/Decoder.cpp lldb/tools/intel-features/intel-pt/Decoder.h lldb/tools/intel-features/intel-pt/PTDecoder.cpp lldb/tools/intel-features/intel-pt/PTDecoder.h lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp lldb/tools/intel-features/intel-pt/cli-wrapper-pt.h lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h lldb/tools/intel-features/intel-pt/include/intel-pt/API/cli-wrapper-pt.h lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h lldb/tools/intel-features/intel-pt/interface/PTDecoder.i lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp lldb/tools/intel-features/intel-pt/source/CMakeLists.txt lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp lldb/tools/intel-features/scripts/CMakeLists.txt lldb/tools/intel-features/scripts/lldb-intel-features.swig
Index: lldb/tools/intel-features/scripts/lldb-intel-features.swig =================================================================== --- lldb/tools/intel-features/scripts/lldb-intel-features.swig +++ 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; %} Index: lldb/tools/intel-features/scripts/CMakeLists.txt =================================================================== --- lldb/tools/intel-features/scripts/CMakeLists.txt +++ 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 Index: lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp =================================================================== --- lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp +++ 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 <cinttypes> Index: lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt =================================================================== --- lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt +++ 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}) Index: lldb/tools/intel-features/intel-pt/source/CMakeLists.txt =================================================================== --- /dev/null +++ lldb/tools/intel-features/intel-pt/source/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(Core) +add_subdirectory(API) Index: lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp =================================================================== --- lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp +++ lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp @@ -20,8 +20,8 @@ #include <string> #include <vector> -#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" Index: lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp =================================================================== --- lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp +++ 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; Index: lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt =================================================================== --- /dev/null +++ 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}) Index: lldb/tools/intel-features/intel-pt/interface/PTDecoder.i =================================================================== --- lldb/tools/intel-features/intel-pt/interface/PTDecoder.i +++ 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" Index: lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h =================================================================== --- lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h +++ 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 <map> @@ -324,4 +324,4 @@ }; } // namespace intelpt_private -#endif // Decoder_h_ +#endif // LLDB_INTEL_PT_CORE_DECODER_H Index: lldb/tools/intel-features/intel-pt/cli-wrapper-pt.h =================================================================== --- /dev/null +++ lldb/tools/intel-features/intel-pt/cli-wrapper-pt.h @@ -1,12 +0,0 @@ -//===-- cli-wrapper-pt.h----------------------------------*- C++ -*-==========// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// CLI Wrapper of PTDecoder Tool to enable it to be used through LLDB's CLI. -//===----------------------------------------------------------------------===// - -#include "lldb/API/SBDebugger.h" - -bool PTPluginInitialize(lldb::SBDebugger &debugger); Index: lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h =================================================================== --- lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h +++ 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 <vector> @@ -280,4 +280,4 @@ }; } // namespace intelpt -#endif // PTDecoder_h_ +#endif // LLDB_INTEL_PT_API_PT_DECODER_H Index: lldb/tools/intel-features/intel-pt/CMakeLists.txt =================================================================== --- lldb/tools/intel-features/intel-pt/CMakeLists.txt +++ 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) Index: lldb/tools/intel-features/cli-wrapper.cpp =================================================================== --- lldb/tools/intel-features/cli-wrapper.cpp +++ 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"
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits