diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
commit | 9e6d35490a6542f9c97607f93c2ef8ca8e03cbcc (patch) | |
tree | dd2a1ddf0476664c2b823409c36cbccd52662ca7 /tools/lldb-mi | |
parent | 3bd2e91faeb9eeec1aae82c64a3253afff551cfd (diff) |
Notes
Diffstat (limited to 'tools/lldb-mi')
-rw-r--r-- | tools/lldb-mi/CMakeLists.txt | 102 | ||||
-rw-r--r-- | tools/lldb-mi/MICmdCmdSymbol.cpp | 28 | ||||
-rw-r--r-- | tools/lldb-mi/Makefile | 32 | ||||
-rw-r--r-- | tools/lldb-mi/lldb-Info.plist | 21 |
4 files changed, 165 insertions, 18 deletions
diff --git a/tools/lldb-mi/CMakeLists.txt b/tools/lldb-mi/CMakeLists.txt new file mode 100644 index 000000000000..7fd6ed199e9d --- /dev/null +++ b/tools/lldb-mi/CMakeLists.txt @@ -0,0 +1,102 @@ +set(LLDB_MI_SOURCES + MICmdArgContext.cpp + MICmdArgSet.cpp + MICmdArgValBase.cpp + MICmdArgValConsume.cpp + MICmdArgValFile.cpp + MICmdArgValListBase.cpp + MICmdArgValListOfN.cpp + MICmdArgValNumber.cpp + MICmdArgValOptionLong.cpp + MICmdArgValOptionShort.cpp + MICmdArgValPrintValues.cpp + MICmdArgValString.cpp + MICmdArgValThreadGrp.cpp + MICmdBase.cpp + MICmdCommands.cpp + MICmdCmd.cpp + MICmdCmdBreak.cpp + MICmdCmdData.cpp + MICmdCmdEnviro.cpp + MICmdCmdExec.cpp + MICmdCmdFile.cpp + MICmdCmdGdbInfo.cpp + MICmdCmdGdbSet.cpp + MICmdCmdGdbShow.cpp + MICmdCmdGdbThread.cpp + MICmdCmdMiscellanous.cpp + MICmdCmdStack.cpp + MICmdCmdSupportInfo.cpp + MICmdCmdSupportList.cpp + MICmdCmdSymbol.cpp + MICmdCmdTarget.cpp + MICmdCmdThread.cpp + MICmdCmdTrace.cpp + MICmdCmdVar.cpp + MICmdData.cpp + MICmdFactory.cpp + MICmdInterpreter.cpp + MICmdInvoker.cpp + MICmdMgr.cpp + MICmdMgrSetCmdDeleteCallback.cpp + MICmnBase.cpp + MICmnLLDBBroadcaster.cpp + MICmnLLDBDebugger.cpp + MICmnLLDBDebuggerHandleEvents.cpp + MICmnLLDBDebugSessionInfo.cpp + MICmnLLDBDebugSessionInfoVarObj.cpp + MICmnLLDBProxySBValue.cpp + MICmnLLDBUtilSBValue.cpp + MICmnLog.cpp + MICmnLogMediumFile.cpp + MICmnMIOutOfBandRecord.cpp + MICmnMIResultRecord.cpp + MICmnMIValue.cpp + MICmnMIValueConst.cpp + MICmnMIValueList.cpp + MICmnMIValueResult.cpp + MICmnMIValueTuple.cpp + MICmnResources.cpp + MICmnStreamStderr.cpp + MICmnStreamStdin.cpp + MICmnStreamStdout.cpp + MICmnThreadMgrStd.cpp + MIDriver.cpp + MIDriverBase.cpp + MIDriverMain.cpp + MIDriverMgr.cpp + MIUtilParse.cpp + MIUtilDateTimeStd.cpp + MIUtilDebug.cpp + MIUtilFileStd.cpp + MIUtilMapIdToVariant.cpp + MIUtilString.cpp + MIUtilThreadBaseStd.cpp + MIUtilVariant.cpp + Platform.cpp + ) + +if ( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) + add_definitions( -DIMPORT_LIBLLDB ) + list(APPEND LLDB_MI_SOURCES + ${LLDB_SOURCE_ROOT}/Host/common/GetOptInc.cpp + ) +endif () + +include(../../cmake/LLDBDependencies.cmake) + +add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES}) + +target_link_libraries(lldb-mi liblldb) +if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) + target_link_libraries(lldb-mi pthread) +endif () + +# TODO: why isn't this done by add_lldb_executable? +#target_link_libraries(lldb-mi ${LLDB_USED_LIBS}) +llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS}) + +set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION}) + +install(TARGETS lldb-mi + RUNTIME DESTINATION bin) diff --git a/tools/lldb-mi/MICmdCmdSymbol.cpp b/tools/lldb-mi/MICmdCmdSymbol.cpp index d99ceef22498..abaa3924ddce 100644 --- a/tools/lldb-mi/MICmdCmdSymbol.cpp +++ b/tools/lldb-mi/MICmdCmdSymbol.cpp @@ -82,11 +82,7 @@ CMICmdCmdSymbolListLines::Execute() CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile); const CMIUtilString &strFilePath(pArgFile->GetValue()); - // FIXME: this won't work for header files! To try and use existing - // commands to get this to work for header files would be too slow. - // Instead, this code should be rewritten to use APIs and/or support - // should be added to lldb which would work for header files. - const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str())); + const CMIUtilString strCmd(CMIUtilString::Format("source info --file \"%s\"", strFilePath.AddSlashes().c_str())); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult); @@ -110,10 +106,10 @@ ParseLLDBLineAddressHeader(const char *input, CMIUtilString &file) { // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_header_regex( - "^ *Line table for (.+) in `(.+)$"); - // ^1=file ^2=module + "^ *Lines found for file (.+) in compilation unit (.+) in `(.+)$"); + // ^1=file ^2=cu ^3=module - MIUtilParse::CRegexParser::Match match(3); + MIUtilParse::CRegexParser::Match match(4); const bool ok = g_lineentry_header_regex.Execute(input, match); if (ok) @@ -146,12 +142,12 @@ ParseLLDBLineAddressEntry(const char *input, CMIUtilString &addr, // Match LineEntry using regex. static MIUtilParse::CRegexParser g_lineentry_nocol_regex( - "^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$"); + "^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$"); static MIUtilParse::CRegexParser g_lineentry_col_regex( - "^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$"); - // ^1=addr ^2=f ^3=line ^4=:col(opt) + "^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$"); + // ^1=start ^2=end ^3=f ^4=line ^5=:col(opt) - MIUtilParse::CRegexParser::Match match(5); + MIUtilParse::CRegexParser::Match match(6); // First try matching the LineEntry with the column, // then try without the column. @@ -160,8 +156,8 @@ ParseLLDBLineAddressEntry(const char *input, CMIUtilString &addr, if (ok) { addr = match.GetMatchAtIndex(1); - file = match.GetMatchAtIndex(2); - line = match.GetMatchAtIndex(3); + file = match.GetMatchAtIndex(3); + line = match.GetMatchAtIndex(4); } return ok; } @@ -222,10 +218,6 @@ CMICmdCmdSymbolListLines::Acknowledge() if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine)) continue; - // Skip entries which don't match the desired source. - if (strWantFile != strFile) - continue; - const CMICmnMIValueConst miValueConst(strAddr); const CMICmnMIValueResult miValueResult("pc", miValueConst); CMICmnMIValueTuple miValueTuple(miValueResult); diff --git a/tools/lldb-mi/Makefile b/tools/lldb-mi/Makefile new file mode 100644 index 000000000000..cdd766633b16 --- /dev/null +++ b/tools/lldb-mi/Makefile @@ -0,0 +1,32 @@ +##===- tools/lldb-mi/Makefile -------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LLDB_LEVEL := ../.. + +TOOLNAME = lldb-mi + +NO_PEDANTIC = 1 + +LLVMLibsOptions += -ledit -llldb -llldbUtility +LINK_COMPONENTS := support + +include $(LLDB_LEVEL)/Makefile + +ifeq ($(HOST_OS),Darwin) + LLVMLibsOptions += -Wl,-rpath,@loader_path/../lib/ + LLVMLibsOptions += -Wl,-sectcreate -Wl,__TEXT -Wl,__info_plist -Wl,"$(PROJ_SRC_DIR)/lldb-Info.plist" +endif + +ifneq (,$(filter $(HOST_OS), Linux GNU/kFreeBSD NetBSD)) + LLVMLibsOptions += -Wl,-rpath,$(LibDir) -lpthread +endif + +ifeq ($(HOST_OS),FreeBSD) + CPP.Flags += -I/usr/include/edit #-v + LLVMLibsOptions += -Wl,-rpath,$(LibDir) -lpthread +endif diff --git a/tools/lldb-mi/lldb-Info.plist b/tools/lldb-mi/lldb-Info.plist new file mode 100644 index 000000000000..795512691ef0 --- /dev/null +++ b/tools/lldb-mi/lldb-Info.plist @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.lldb</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>lldb-mi</string> + <key>CFBundleVersion</key> + <string>2</string> + <key>SecTaskAccess</key> + <array> + <string>allowed</string> + <string>debug</string> + </array> +</dict> +</plist> |