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
35 changes: 33 additions & 2 deletions IDEHelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ file(GLOB SRC_FILES
Targets.cpp
X86XmmInfo.cpp

LinuxDebugger.cpp

Beef/BfCommon.cpp
Clang/CDepChecker.cpp
Clang/ClangHelper.cpp
Expand Down Expand Up @@ -183,9 +181,42 @@ else()
message(FATAL_ERROR "LLVM not found")
endif()

set(DBG64_OBJECTS)

# Windows builds debugger backends through separate Debugger32/Debugger64
# Visual Studio projects, with BF_DBG_32/BF_DBG_64 defined at the target
# level; those Windows debugger backend targets are not currently modeled in
# CMake. Do the same for Linux debugger sources here instead of compiling
# them as part of the common IDEHelper source list.
if(UNIX AND NOT APPLE)
set(DBG64_SRC LinuxDebugger.cpp)
find_path(LLDB_INCLUDE_DIR lldb/API/LLDB.h HINTS ${LLVM_INCLUDE_DIRS})
find_library(LLDB_LIBRARY NAMES lldb liblldb lldb-22 liblldb-22 HINTS ${LLVM_LIBRARY_DIRS})

if (LLDB_INCLUDE_DIR AND LLDB_LIBRARY)
message(STATUS "Found LLDB: ${LLDB_LIBRARY}")
list(APPEND DBG64_SRC LLDBDebugger.cpp)
string(APPEND TARGET_LIBS_OS " ${LLDB_LIBRARY}")
string(STRIP ${TARGET_LIBS_OS} TARGET_LIBS_OS)
else()
message(WARNING "LLDB was not found; Linux IDE debugger support will be disabled")
endif()

add_library(IDEHelperDebugger64 OBJECT ${DBG64_SRC})
target_compile_definitions(IDEHelperDebugger64 PRIVATE BF_DBG_64)
if (LLDB_INCLUDE_DIR AND LLDB_LIBRARY)
target_compile_definitions(IDEHelperDebugger64 PRIVATE LLDB_ENABLED)
target_include_directories(IDEHelperDebugger64 PRIVATE ${LLDB_INCLUDE_DIR})
endif()
set(DBG64_OBJECTS $<TARGET_OBJECTS:IDEHelperDebugger64>)
else()
list(APPEND SRC_FILES LinuxDebugger.cpp)
endif()

# Add library to build.
add_library(${PROJECT_NAME} STATIC
${SRC_FILES}
${DBG64_OBJECTS}
)

if (HAVE_BACKTRACE_HEADERS)
Expand Down
7 changes: 6 additions & 1 deletion IDEHelper/LLDBDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#ifdef LLDB_ENABLED

#ifdef __linux__
#include <limits.h>
#include <unistd.h>
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif
#endif
#ifdef __APPLE__
#include <mach/mach.h>
Expand Down Expand Up @@ -327,8 +331,9 @@ void LLDBDebugger::DoLaunch()

// Launch the process stopped at entry so the IDE can set up before running.
lldb::SBError launchError;
lldb::SBListener listener = debugger.GetListener();
lldb::SBProcess process = target.Launch(
debugger.GetListener(),
listener,
argv.size() > 1 ? &argv.front() : NULL,
envp.size() > 1 ? &envp.front() : NULL,
NULL, // stdin
Expand Down
7 changes: 6 additions & 1 deletion IDEHelper/LinuxDebugger.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "BeefySysLib/Common.h"
#include "LinuxDebugger.h"
#include "Debugger.h"
#include "LLDBDebugger.h"
#include "X86Target.h"

namespace Beefy
Expand All @@ -21,7 +22,11 @@ Beefy::Debugger* CreateDebugger64(DebugManager* debugManager, DbgMiniDump* miniD
{
//if (gX86Target == NULL)
// gX86Target = new X86Target();
#ifdef LLDB_ENABLED
return new LLDBDebugger(debugManager);
#else
return NULL;
#endif
}

NS_BF_END
NS_BF_END
18 changes: 8 additions & 10 deletions IDEHelper/LinuxDebugger.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#define BF_DBG_64

#include "DebugCommon.h"

NS_BF_DBG_BEGIN




NS_BF_DBG_END
#include "DebugCommon.h"

NS_BF_DBG_BEGIN




NS_BF_DBG_END
Loading