Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/gdb-remote/LLDBServerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ using namespace lldb_private;
using namespace lldb_server;


LLDBServerPlugin::LLDBServerPlugin(GDBServer &native_process) :
m_native_process(native_process) {}
LLDBServerPlugin::LLDBServerPlugin(GDBServer &native_process, MainLoop &main_loop) :
m_native_process(native_process), m_main_loop(main_loop) {}

LLDBServerPlugin::~LLDBServerPlugin() {}

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Process/gdb-remote/LLDBServerPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class LLDBServerPlugin {
using GDBServer = process_gdb_remote::GDBRemoteCommunicationServerLLGS;
using Manager = NativeProcessProtocol::Manager;
GDBServer &m_native_process;
MainLoop m_main_loop;
MainLoop &m_main_loop;
std::unique_ptr<Manager> m_process_manager_up;
std::unique_ptr<GDBServer> m_gdb_server;
bool m_is_listening = false;
bool m_is_connected = false;

public:
LLDBServerPlugin(GDBServer &native_process);
LLDBServerPlugin(GDBServer &native_process, MainLoop &main_loop);
virtual ~LLDBServerPlugin();

/// Check if we are already connected.
Expand Down
9 changes: 8 additions & 1 deletion lldb/tools/lldb-server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ if(APPLE_EMBEDDED)
endif()
endif()

if(DEFINED ROCM_PATH)
add_definitions(-DLLDB_ENABLE_AMDGPU_PLUGIN=1)
list(APPEND LLDB_PLUGINS lldbServerPluginAMDGPU)
else()
add_definitions(-DLLDB_ENABLE_MOCKGPU_PLUGIN=1)
list(APPEND LLDB_PLUGINS lldbServerPluginMockGPU)
endif()

add_lldb_tool(lldb-server
lldb-gdbserver.cpp
lldb-platform.cpp
Expand All @@ -60,7 +68,6 @@ add_lldb_tool(lldb-server
lldbPluginInstructionMIPS64
lldbPluginInstructionRISCV
${LLDB_SYSTEM_LIBS}
lldbServerPluginMockGPU

LINK_COMPONENTS
Option
Expand Down
27 changes: 27 additions & 0 deletions lldb/tools/lldb-server/Plugins/AMDGPU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

message(STATUS "ROCM_PATH is set to: '${ROCM_PATH}'")
if(NOT ROCM_PATH)
message(FATAL_ERROR "ROCM_PATH must be specified. Use -DROCM_PATH=/path/to/rocm")
endif()

if (NOT EXISTS ${ROCM_PATH})
message(FATAL_ERROR "ROCM_PATH does not exist: '${ROCM_PATH}'")
endif()

# Find AMD-dbgapi package using the provided CMake config
set(amd-dbgapi_DIR "${ROCM_PATH}/lib/cmake/amd-dbgapi" CACHE PATH "Path to amd-dbgapi cmake config")
find_package(amd-dbgapi REQUIRED CONFIG)

include_directories(${ROCM_PATH}/include)

add_lldb_library(lldbServerPluginAMDGPU
LLDBServerPluginAMDGPU.cpp
ProcessAMDGPU.cpp
RegisterContextAMDGPU.cpp
ThreadAMDGPU.cpp

LINK_LIBS
amd-dbgapi
)
set_target_properties(lldbServerPluginAMDGPU PROPERTIES LINK_FLAGS "-Wl,-rpath,${ROCM_PATH}/lib")
target_include_directories(lldbServerPluginAMDGPU PRIVATE "${LLDB_SOURCE_DIR}/source" ${ROCM_PATH}/include "../..")
Loading