summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/API/SBCommunication.cpp3
-rw-r--r--source/API/SBStructuredData.cpp2
-rw-r--r--source/API/SBTarget.cpp2
-rw-r--r--source/API/SBThread.cpp2
-rw-r--r--source/API/SBThreadPlan.cpp2
-rw-r--r--source/API/SBTraceOptions.cpp4
-rw-r--r--source/API/SystemInitializerFull.cpp2
-rw-r--r--source/Commands/CommandObjectFrame.cpp2
-rw-r--r--source/Commands/CommandObjectLog.cpp2
-rw-r--r--source/Commands/CommandObjectTarget.cpp19
-rw-r--r--source/Commands/CommandObjectThread.cpp2
-rw-r--r--source/Core/CMakeLists.txt3
-rw-r--r--source/Core/Communication.cpp2
-rw-r--r--source/Core/Connection.cpp32
-rw-r--r--source/Core/Disassembler.cpp6
-rw-r--r--source/Core/FormatEntity.cpp10
-rw-r--r--source/Core/Mangled.cpp2
-rw-r--r--source/Core/Module.cpp2
-rw-r--r--source/Host/CMakeLists.txt1
-rw-r--r--source/Host/common/Host.cpp10
-rw-r--r--source/Host/common/Symbols.cpp2
-rw-r--r--source/Host/freebsd/Host.cpp9
-rw-r--r--source/Host/linux/Support.cpp10
-rw-r--r--source/Host/macosx/Host.mm3
-rw-r--r--source/Host/macosx/Symbols.cpp2
-rw-r--r--source/Host/netbsd/Host.cpp9
-rw-r--r--source/Host/openbsd/Host.cpp9
-rw-r--r--source/Host/posix/ConnectionFileDescriptorPosix.cpp5
-rw-r--r--source/Host/windows/Host.cpp10
-rw-r--r--source/Initialization/SystemInitializerCommon.cpp2
-rw-r--r--source/Interpreter/CommandInterpreter.cpp2
-rw-r--r--source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp25
-rw-r--r--source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h6
-rw-r--r--source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp4
-rw-r--r--source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h4
-rw-r--r--source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp4
-rw-r--r--source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h4
-rw-r--r--source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp4
-rw-r--r--source/Plugins/ABI/SysV-arm/ABISysV_arm.h4
-rw-r--r--source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp4
-rw-r--r--source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h4
-rw-r--r--source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp4
-rw-r--r--source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h4
-rw-r--r--source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp4
-rw-r--r--source/Plugins/ABI/SysV-i386/ABISysV_i386.h4
-rw-r--r--source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp4
-rw-r--r--source/Plugins/ABI/SysV-mips/ABISysV_mips.h4
-rw-r--r--source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp4
-rw-r--r--source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h4
-rw-r--r--source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp4
-rw-r--r--source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h4
-rw-r--r--source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp4
-rw-r--r--source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h4
-rw-r--r--source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp4
-rw-r--r--source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h4
-rw-r--r--source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp4
-rw-r--r--source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h4
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h2
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h2
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h2
-rw-r--r--source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h2
-rw-r--r--source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h2
-rw-r--r--source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h2
-rw-r--r--source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h2
-rw-r--r--source/Plugins/Language/ObjC/Cocoa.cpp4
-rw-r--r--source/Plugins/Language/ObjC/NSSet.cpp104
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp2
-rw-r--r--source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp2
-rw-r--r--source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp2
-rw-r--r--source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp2
-rw-r--r--source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp4
-rw-r--r--source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp2
-rw-r--r--source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp2
-rw-r--r--source/Plugins/OperatingSystem/Python/OperatingSystemPython.h2
-rw-r--r--source/Plugins/Platform/MacOSX/PlatformDarwin.cpp2
-rw-r--r--source/Plugins/Process/Linux/CMakeLists.txt1
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.cpp280
-rw-r--r--source/Plugins/Process/Linux/NativeProcessLinux.h54
-rw-r--r--source/Plugins/Process/Linux/ProcessorTrace.cpp400
-rw-r--r--source/Plugins/Process/Linux/ProcessorTrace.h140
-rw-r--r--source/Plugins/Process/POSIX/CMakeLists.txt1
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.cpp2
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.h2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp27
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h2
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp8
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp2
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp6
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.h2
-rw-r--r--source/Plugins/Process/gdb-remote/ThreadGDBRemote.h2
-rw-r--r--source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h2
-rw-r--r--source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp2
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp2
-rw-r--r--source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp2
-rw-r--r--source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp2
-rw-r--r--source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h2
-rw-r--r--source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp33
-rw-r--r--source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h1
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp84
-rw-r--r--source/Symbol/FuncUnwinders.cpp133
-rw-r--r--source/Symbol/ObjectFile.cpp2
-rw-r--r--source/Symbol/Symtab.cpp4
-rw-r--r--source/Symbol/UnwindTable.cpp110
-rw-r--r--source/Symbol/Variable.cpp4
-rw-r--r--source/Target/ABI.cpp6
-rw-r--r--source/Target/ObjCLanguageRuntime.cpp2
-rw-r--r--source/Target/Platform.cpp2
-rw-r--r--source/Target/Process.cpp2
-rw-r--r--source/Target/Target.cpp2
-rw-r--r--source/Target/TargetList.cpp2
-rw-r--r--source/Target/ThreadSpec.cpp4
-rw-r--r--source/Utility/CMakeLists.txt4
-rw-r--r--source/Utility/Connection.cpp14
-rw-r--r--source/Utility/IOObject.cpp (renamed from source/Host/common/IOObject.cpp)3
-rw-r--r--source/Utility/JSON.cpp2
-rw-r--r--source/Utility/StructuredData.cpp (renamed from source/Core/StructuredData.cpp)62
-rw-r--r--source/Utility/Timer.cpp (renamed from source/Core/Timer.cpp)5
123 files changed, 1451 insertions, 425 deletions
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index 8ebc33ca26a6d..63b672efe3c02 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBBroadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/Host/Host.h"
#include "lldb/Utility/Log.h"
using namespace lldb;
@@ -51,7 +52,7 @@ void SBCommunication::SetCloseOnEOF(bool b) {
ConnectionStatus SBCommunication::Connect(const char *url) {
if (m_opaque) {
if (!m_opaque->HasConnection())
- m_opaque->SetConnection(Connection::CreateDefaultConnection(url));
+ m_opaque->SetConnection(Host::CreateDefaultConnection(url).release());
return m_opaque->Connect(url, NULL);
}
return eConnectionStatusNoConnection;
diff --git a/source/API/SBStructuredData.cpp b/source/API/SBStructuredData.cpp
index 54022390b80fb..d506410f6d804 100644
--- a/source/API/SBStructuredData.cpp
+++ b/source/API/SBStructuredData.cpp
@@ -11,11 +11,11 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Target/StructuredDataPlugin.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StructuredData.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 0ab7375ccc302..c706344ee4a39 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -2170,7 +2170,7 @@ lldb::addr_t SBTarget::GetStackRedZoneSize() {
if (process_sp)
abi_sp = process_sp->GetABI();
else
- abi_sp = ABI::FindPlugin(target_sp->GetArchitecture());
+ abi_sp = ABI::FindPlugin(ProcessSP(), target_sp->GetArchitecture());
if (abi_sp)
return abi_sp->GetRedZoneSize();
}
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index d9ce6be3f8932..b34489603c8ac 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -16,7 +16,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/CompileUnit.h"
@@ -34,6 +33,7 @@
#include "lldb/Target/ThreadPlanStepRange.h"
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
diff --git a/source/API/SBThreadPlan.cpp b/source/API/SBThreadPlan.cpp
index 7537a7645390b..a19023f66de23 100644
--- a/source/API/SBThreadPlan.cpp
+++ b/source/API/SBThreadPlan.cpp
@@ -16,7 +16,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -33,6 +32,7 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepRange.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
diff --git a/source/API/SBTraceOptions.cpp b/source/API/SBTraceOptions.cpp
index 474fa911f7ecd..20a8f25a768b1 100644
--- a/source/API/SBTraceOptions.cpp
+++ b/source/API/SBTraceOptions.cpp
@@ -10,9 +10,9 @@
#include "lldb/API/SBTraceOptions.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStructuredData.h"
-#include "lldb/Utility/Log.h"
#include "lldb/Core/StructuredDataImpl.h"
-#include "lldb/Core/TraceOptions.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/TraceOptions.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp
index 7be37898c5aac..c505f61e42a68 100644
--- a/source/API/SystemInitializerFull.cpp
+++ b/source/API/SystemInitializerFull.cpp
@@ -20,7 +20,6 @@
#endif
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Initialization/SystemInitializerCommon.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -28,6 +27,7 @@
#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Symbol/OCamlASTContext.h"
+#include "lldb/Utility/Timer.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 9e1805f2eed68..0bcc350629689 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -17,7 +17,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
@@ -47,6 +46,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Commands/CommandObjectLog.cpp b/source/Commands/CommandObjectLog.cpp
index e545d56797251..ef82d07f15fbb 100644
--- a/source/Commands/CommandObjectLog.cpp
+++ b/source/Commands/CommandObjectLog.cpp
@@ -15,7 +15,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -31,6 +30,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index 343530ea4f352..a80acf19be2d4 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -16,7 +16,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/OptionParser.h"
@@ -50,6 +49,7 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/Support/FileSystem.h"
@@ -3426,6 +3426,23 @@ protected:
result.GetOutputStream().Printf("\n");
}
+ if (UnwindPlanSP plan_sp =
+ func_unwinders_sp->GetDebugFrameUnwindPlan(*target, 0)) {
+ result.GetOutputStream().Printf("debug_frame UnwindPlan:\n");
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
+ result.GetOutputStream().Printf("\n");
+ }
+
+ if (UnwindPlanSP plan_sp =
+ func_unwinders_sp->GetDebugFrameAugmentedUnwindPlan(*target,
+ *thread, 0)) {
+ result.GetOutputStream().Printf("debug_frame augmented UnwindPlan:\n");
+ plan_sp->Dump(result.GetOutputStream(), thread.get(),
+ LLDB_INVALID_ADDRESS);
+ result.GetOutputStream().Printf("\n");
+ }
+
UnwindPlanSP arm_unwind_sp =
func_unwinders_sp->GetArmUnwindUnwindPlan(*target, 0);
if (arm_unwind_sp) {
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index cfd8fcb7291d6..687187b26ccdc 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -209,7 +209,7 @@ protected:
Process *process = m_exe_ctx.GetProcessPtr();
Thread *thread = process->GetThreadList().FindThreadByID(tid).get();
if (thread == nullptr) {
- result.AppendErrorWithFormat("Failed to process thread# %lu.\n", tid);
+ result.AppendErrorWithFormat("Failed to process thread# %llu.\n", tid);
result.SetStatus(eReturnStatusFailed);
return false;
}
diff --git a/source/Core/CMakeLists.txt b/source/Core/CMakeLists.txt
index 806227793f24e..c5105bd9ab12b 100644
--- a/source/Core/CMakeLists.txt
+++ b/source/Core/CMakeLists.txt
@@ -7,7 +7,6 @@ add_lldb_library(lldbCore
ArchSpec.cpp
Broadcaster.cpp
Communication.cpp
- Connection.cpp
Debugger.cpp
Disassembler.cpp
DumpDataExtractor.cpp
@@ -33,8 +32,6 @@ add_lldb_library(lldbCore
State.cpp
StreamAsynchronousIO.cpp
StreamFile.cpp
- StructuredData.cpp
- Timer.cpp
UserSettingsController.cpp
Value.cpp
ValueObject.cpp
diff --git a/source/Core/Communication.cpp b/source/Core/Communication.cpp
index 72873a9510b53..38ab902ab4b73 100644
--- a/source/Core/Communication.cpp
+++ b/source/Core/Communication.cpp
@@ -9,11 +9,11 @@
#include "lldb/Core/Communication.h"
-#include "lldb/Core/Connection.h"
#include "lldb/Core/Event.h"
#include "lldb/Core/Listener.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Utility/Connection.h"
#include "lldb/Utility/ConstString.h" // for ConstString
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Logging.h" // for LogIfAnyCategoriesSet, LIBLLDB...
diff --git a/source/Core/Connection.cpp b/source/Core/Connection.cpp
deleted file mode 100644
index 60d1221c160cc..0000000000000
--- a/source/Core/Connection.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/Connection.h"
-
-#if defined(_WIN32)
-#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
-#endif
-
-#include "lldb/Host/ConnectionFileDescriptor.h"
-
-#include <string.h> // for strstr
-
-using namespace lldb_private;
-
-Connection::Connection() {}
-
-Connection::~Connection() {}
-
-Connection *Connection::CreateDefaultConnection(const char *url) {
-#if defined(_WIN32)
- if (strstr(url, "file://") == url)
- return new ConnectionGenericFile();
-#endif
- return new ConnectionFileDescriptor();
-}
diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp
index 0a5d763b6d3f1..6d463d552da65 100644
--- a/source/Core/Disassembler.cpp
+++ b/source/Core/Disassembler.cpp
@@ -17,7 +17,6 @@
#include "lldb/Core/ModuleList.h" // for ModuleList
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/SourceManager.h" // for SourceManager
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValueArray.h"
@@ -37,8 +36,9 @@
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Status.h"
-#include "lldb/Utility/Stream.h" // for Stream
-#include "lldb/Utility/StreamString.h" // for StreamString
+#include "lldb/Utility/Stream.h" // for Stream
+#include "lldb/Utility/StreamString.h" // for StreamString
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private-enumerations.h" // for InstructionType:...
#include "lldb/lldb-private-interfaces.h" // for DisassemblerCrea...
#include "lldb/lldb-private-types.h" // for RegisterInfo
diff --git a/source/Core/FormatEntity.cpp b/source/Core/FormatEntity.cpp
index e3c346f79d6b2..6002efe9244d9 100644
--- a/source/Core/FormatEntity.cpp
+++ b/source/Core/FormatEntity.cpp
@@ -14,8 +14,7 @@
#include "lldb/Core/ArchSpec.h" // for ArchSpec
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/RegisterValue.h" // for RegisterValue
-#include "lldb/Core/StructuredData.h" // for StructuredData::O...
+#include "lldb/Core/RegisterValue.h" // for RegisterValue
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/DataVisualization.h"
@@ -50,9 +49,10 @@
#include "lldb/Utility/SharingPtr.h" // for SharingPtr
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/StringList.h" // for StringList
-#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS
-#include "lldb/lldb-forward.h" // for ValueObjectSP
+#include "lldb/Utility/StringList.h" // for StringList
+#include "lldb/Utility/StructuredData.h" // for StructuredData::O...
+#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS
+#include "lldb/lldb-forward.h" // for ValueObjectSP
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h" // for Triple, Triple::O...
diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp
index 4dac0b8f3bf1e..211a0c32cee7f 100644
--- a/source/Core/Mangled.cpp
+++ b/source/Core/Mangled.cpp
@@ -27,12 +27,12 @@
#include <cxxabi.h>
#endif
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Logging.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-enumerations.h" // for LanguageType
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index 1b510d2ff7b2b..aaae4700db350 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -17,7 +17,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/SearchFilter.h" // for SearchFilt...
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -45,6 +44,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#if defined(LLVM_ON_WIN32)
#include "lldb/Host/windows/PosixApi.h" // for PATH_MAX
diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
index b9079ce26a2c6..73d030e198af0 100644
--- a/source/Host/CMakeLists.txt
+++ b/source/Host/CMakeLists.txt
@@ -13,7 +13,6 @@ add_host_subdirectory(common
common/HostNativeThreadBase.cpp
common/HostProcess.cpp
common/HostThread.cpp
- common/IOObject.cpp
common/LockFileBase.cpp
common/MainLoop.cpp
common/MonitoringProcessLauncher.cpp
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index af0b572489225..29e5991d31aa3 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -58,6 +58,7 @@
#include "lldb/Host/Predicate.h"
#include "lldb/Host/ProcessLauncher.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
#include "lldb/Target/FileAction.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/UnixSignals.h"
@@ -73,6 +74,7 @@
#include "llvm/Support/FileSystem.h"
#if defined(_WIN32)
+#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
#include "lldb/Host/windows/ProcessLauncherWindows.h"
#else
#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
@@ -624,6 +626,14 @@ const UnixSignalsSP &Host::GetUnixSignals() {
return s_unix_signals_sp;
}
+std::unique_ptr<Connection> Host::CreateDefaultConnection(llvm::StringRef url) {
+#if defined(_WIN32)
+ if (url.startswith("file://"))
+ return std::unique_ptr<Connection>(new ConnectionGenericFile());
+#endif
+ return std::unique_ptr<Connection>(new ConnectionFileDescriptor());
+}
+
#if defined(LLVM_ON_UNIX)
WaitStatus WaitStatus::Decode(int wstatus) {
if (WIFEXITED(wstatus))
diff --git a/source/Host/common/Symbols.cpp b/source/Host/common/Symbols.cpp
index fe29b9e789900..e7bdf084d385a 100644
--- a/source/Host/common/Symbols.cpp
+++ b/source/Host/common/Symbols.cpp
@@ -11,7 +11,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBuffer.h"
@@ -19,6 +18,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "llvm/Support/FileSystem.h"
diff --git a/source/Host/freebsd/Host.cpp b/source/Host/freebsd/Host.cpp
index bd547bbeb9c53..037dfc7f5e033 100644
--- a/source/Host/freebsd/Host.cpp
+++ b/source/Host/freebsd/Host.cpp
@@ -27,22 +27,19 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/CleanUp.h"
-#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/NameMatches.h"
-
#include "llvm/Support/Host.h"
extern "C" {
diff --git a/source/Host/linux/Support.cpp b/source/Host/linux/Support.cpp
index 8fbb60052e3f6..31808401ea615 100644
--- a/source/Host/linux/Support.cpp
+++ b/source/Host/linux/Support.cpp
@@ -32,3 +32,13 @@ lldb_private::getProcFile(::pid_t pid, const llvm::Twine &file) {
LLDB_LOG(log, "Failed to open {0}: {1}", File, Ret.getError().message());
return Ret;
}
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+lldb_private::getProcFile(const llvm::Twine &file) {
+ Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
+ std::string File = ("/proc/" + file).str();
+ auto Ret = llvm::MemoryBuffer::getFileAsStream(File);
+ if (!Ret)
+ LLDB_LOG(log, "Failed to open {0}: {1}", File, Ret.getError().message());
+ return Ret;
+}
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index 919b35624e60b..bbf70cd4c4b3f 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -58,8 +58,6 @@
#include "lldb/Core/Communication.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/ThreadLauncher.h"
@@ -73,6 +71,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
#include "llvm/Support/FileSystem.h"
diff --git a/source/Host/macosx/Symbols.cpp b/source/Host/macosx/Symbols.cpp
index 20508a6585634..9d1e8fe96ae98 100644
--- a/source/Host/macosx/Symbols.cpp
+++ b/source/Host/macosx/Symbols.cpp
@@ -26,7 +26,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/CleanUp.h"
@@ -35,6 +34,7 @@
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "mach/machine.h"
diff --git a/source/Host/netbsd/Host.cpp b/source/Host/netbsd/Host.cpp
index bbe34a83d9992..d927f95f06753 100644
--- a/source/Host/netbsd/Host.cpp
+++ b/source/Host/netbsd/Host.cpp
@@ -26,22 +26,19 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/CleanUp.h"
-#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/NameMatches.h"
-
#include "llvm/Support/Host.h"
extern "C" {
diff --git a/source/Host/openbsd/Host.cpp b/source/Host/openbsd/Host.cpp
index 7e4a64fbd9ae4..0535256b9aa1f 100644
--- a/source/Host/openbsd/Host.cpp
+++ b/source/Host/openbsd/Host.cpp
@@ -23,22 +23,19 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/CleanUp.h"
+#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/CleanUp.h"
-#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/NameMatches.h"
-
#include "llvm/Support/Host.h"
extern "C" {
diff --git a/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index c3b237a873029..6b0f069c35a95 100644
--- a/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -16,10 +16,10 @@
#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
#include "lldb/Host/Config.h"
-#include "lldb/Host/IOObject.h"
#include "lldb/Host/Socket.h"
#include "lldb/Host/SocketAddress.h"
#include "lldb/Utility/SelectHelper.h"
+#include "lldb/Utility/Timeout.h"
// C Includes
#include <errno.h>
@@ -42,13 +42,12 @@
#include "llvm/ADT/SmallVector.h"
#endif
// Project includes
-#include "lldb/Core/Communication.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Socket.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Host/windows/Host.cpp b/source/Host/windows/Host.cpp
index 69a7c2ef4f74c..4458ce25e6079 100644
--- a/source/Host/windows/Host.cpp
+++ b/source/Host/windows/Host.cpp
@@ -15,16 +15,14 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Target/Process.h"
-#include "lldb/Utility/Log.h"
-#include "lldb/Utility/Status.h"
-
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Process.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
#include "llvm/Support/ConvertUTF.h"
diff --git a/source/Initialization/SystemInitializerCommon.cpp b/source/Initialization/SystemInitializerCommon.cpp
index 77869807c79c4..e76ba4122bb6f 100644
--- a/source/Initialization/SystemInitializerCommon.cpp
+++ b/source/Initialization/SystemInitializerCommon.cpp
@@ -17,10 +17,10 @@
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#if defined(__APPLE__)
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index a1d8eded09f50..075f2e7b7bd18 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -45,9 +45,9 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#ifndef LLDB_DISABLE_LIBEDIT
#include "lldb/Host/Editline.h"
diff --git a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
index 06b1c7054c1f0..fd5ee6ede4c37 100644
--- a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
+++ b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
@@ -1326,7 +1326,7 @@ size_t ABIMacOSX_arm::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABIMacOSX_arm::CreateInstance(const ArchSpec &arch) {
+ABIMacOSX_arm::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
@@ -1335,7 +1335,7 @@ ABIMacOSX_arm::CreateInstance(const ArchSpec &arch) {
if ((arch_type == llvm::Triple::arm) ||
(arch_type == llvm::Triple::thumb)) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABIMacOSX_arm);
+ g_abi_sp.reset(new ABIMacOSX_arm(process_sp));
return g_abi_sp;
}
}
@@ -1546,16 +1546,14 @@ bool ABIMacOSX_arm::GetArgumentValues(Thread &thread, ValueList &values) const {
return true;
}
-bool ABIMacOSX_arm::IsArmv7kProcess(Thread *thread) const {
+bool ABIMacOSX_arm::IsArmv7kProcess() const {
bool is_armv7k = false;
- if (thread) {
- ProcessSP process_sp(thread->GetProcess());
- if (process_sp) {
- const ArchSpec &arch(process_sp->GetTarget().GetArchitecture());
- const ArchSpec::Core system_core = arch.GetCore();
- if (system_core == ArchSpec::eCore_arm_armv7k) {
- is_armv7k = true;
- }
+ ProcessSP process_sp(GetProcessSP());
+ if (process_sp) {
+ const ArchSpec &arch(process_sp->GetTarget().GetArchitecture());
+ const ArchSpec::Core system_core = arch.GetCore();
+ if (system_core == ArchSpec::eCore_arm_armv7k) {
+ is_armv7k = true;
}
}
return is_armv7k;
@@ -1588,7 +1586,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl(
default:
return return_valobj_sp;
case 128:
- if (IsArmv7kProcess(&thread)) {
+ if (IsArmv7kProcess()) {
// "A composite type not larger than 16 bytes is returned in r0-r3. The
// format is
// as if the result had been stored in memory at a word-aligned address
@@ -1755,8 +1753,7 @@ Status ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
set_it_simple = true;
}
}
- } else if (num_bytes <= 16 &&
- IsArmv7kProcess(frame_sp->GetThread().get())) {
+ } else if (num_bytes <= 16 && IsArmv7kProcess()) {
// "A composite type not larger than 16 bytes is returned in r0-r3. The
// format is
// as if the result had been stored in memory at a word-aligned address
diff --git a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
index 5aa817c20ec2a..d3c20e1e618fa 100644
--- a/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
+++ b/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
@@ -66,7 +66,7 @@ public:
const lldb_private::RegisterInfo *
GetRegisterInfoArray(uint32_t &count) override;
- bool IsArmv7kProcess(lldb_private::Thread *thread) const;
+ bool IsArmv7kProcess() const;
//------------------------------------------------------------------
// Static Functions
@@ -76,7 +76,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -94,7 +94,7 @@ protected:
lldb_private::CompilerType &ast_type) const override;
private:
- ABIMacOSX_arm() : lldb_private::ABI() {
+ ABIMacOSX_arm(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
index a545dfc837da0..e301b21d542a9 100644
--- a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
+++ b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
@@ -1666,7 +1666,7 @@ size_t ABIMacOSX_arm64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
ABISP
-ABIMacOSX_arm64::CreateInstance(const ArchSpec &arch) {
+ABIMacOSX_arm64::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
@@ -1674,7 +1674,7 @@ ABIMacOSX_arm64::CreateInstance(const ArchSpec &arch) {
if (vendor_type == llvm::Triple::Apple) {
if (arch_type == llvm::Triple::aarch64) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABIMacOSX_arm64);
+ g_abi_sp.reset(new ABIMacOSX_arm64(process_sp));
return g_abi_sp;
}
}
diff --git a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
index 589e2ea468efc..2dd7337542db2 100644
--- a/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
+++ b/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
@@ -78,7 +78,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
//------------------------------------------------------------------
// PluginInterface protocol
@@ -102,7 +102,7 @@ protected:
lldb_private::CompilerType &ast_type) const override;
private:
- ABIMacOSX_arm64() : lldb_private::ABI() {
+ ABIMacOSX_arm64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index c393ac9c916b8..716a73b854b39 100644
--- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -713,13 +713,13 @@ size_t ABIMacOSX_i386::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABIMacOSX_i386::CreateInstance(const ArchSpec &arch) {
+ABIMacOSX_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
(arch.GetTriple().isMacOSX() || arch.GetTriple().isiOS() ||
arch.GetTriple().isWatchOS())) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABIMacOSX_i386);
+ g_abi_sp.reset(new ABIMacOSX_i386(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
index 88fb6ffd7a40a..e026e3248672a 100644
--- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
+++ b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
@@ -81,7 +81,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
//------------------------------------------------------------------
// PluginInterface protocol
@@ -101,7 +101,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABIMacOSX_i386() : lldb_private::ABI() {
+ ABIMacOSX_i386(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
index 614c6e8938065..882d5cd23e58d 100644
--- a/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
+++ b/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
@@ -1327,7 +1327,7 @@ size_t ABISysV_arm::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABISysV_arm::CreateInstance(const ArchSpec &arch) {
+ABISysV_arm::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
@@ -1336,7 +1336,7 @@ ABISysV_arm::CreateInstance(const ArchSpec &arch) {
if ((arch_type == llvm::Triple::arm) ||
(arch_type == llvm::Triple::thumb)) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_arm);
+ g_abi_sp.reset(new ABISysV_arm(process_sp));
return g_abi_sp;
}
}
diff --git a/source/Plugins/ABI/SysV-arm/ABISysV_arm.h b/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
index 81f1277419a64..f046968c213d2 100644
--- a/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
+++ b/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
@@ -76,7 +76,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -94,7 +94,7 @@ protected:
lldb_private::CompilerType &ast_type) const override;
private:
- ABISysV_arm() : lldb_private::ABI() {
+ ABISysV_arm(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
index ce8f8a65e3e34..f91ed851a3e54 100644
--- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
+++ b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
@@ -1670,7 +1670,7 @@ size_t ABISysV_arm64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
ABISP
-ABISysV_arm64::CreateInstance(const ArchSpec &arch) {
+ABISysV_arm64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
@@ -1678,7 +1678,7 @@ ABISysV_arm64::CreateInstance(const ArchSpec &arch) {
if (vendor_type != llvm::Triple::Apple) {
if (arch_type == llvm::Triple::aarch64) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_arm64);
+ g_abi_sp.reset(new ABISysV_arm64(process_sp));
return g_abi_sp;
}
}
diff --git a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
index c048e8634ae5e..8d23c2419bab8 100644
--- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
+++ b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
@@ -83,7 +83,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -101,7 +101,7 @@ protected:
lldb_private::CompilerType &ast_type) const override;
private:
- ABISysV_arm64() : lldb_private::ABI() {
+ ABISysV_arm64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
index 425bf2ce0bf6d..74274f08b24f3 100644
--- a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -1019,11 +1019,11 @@ size_t ABISysV_hexagon::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABISysV_hexagon::CreateInstance(const ArchSpec &arch) {
+ABISysV_hexagon::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if (arch.GetTriple().getArch() == llvm::Triple::hexagon) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_hexagon);
+ g_abi_sp.reset(new ABISysV_hexagon(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
index 5f808291eac01..5a6809371d9fe 100644
--- a/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
+++ b/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
@@ -84,7 +84,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -106,7 +106,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_hexagon() : lldb_private::ABI() {
+ ABISysV_hexagon(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
index cb3644d46af47..63da5a77b48fb 100644
--- a/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
+++ b/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
@@ -203,12 +203,12 @@ ABISysV_i386::GetRegisterInfoArray(uint32_t &count) {
//------------------------------------------------------------------
ABISP
-ABISysV_i386::CreateInstance(const ArchSpec &arch) {
+ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
arch.GetTriple().isOSLinux()) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_i386);
+ g_abi_sp.reset(new ABISysV_i386(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-i386/ABISysV_i386.h b/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
index 038bf656b1f17..4dce54c4f073b 100644
--- a/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
+++ b/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
@@ -89,7 +89,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
//------------------------------------------------------------------
// PluginInterface protocol
@@ -109,7 +109,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_i386() : lldb_private::ABI() {
+ ABISysV_i386(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index a77252a204999..95e2a7b0afeb0 100644
--- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -559,13 +559,13 @@ size_t ABISysV_mips::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABISysV_mips::CreateInstance(const ArchSpec &arch) {
+ABISysV_mips::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
if ((arch_type == llvm::Triple::mips) ||
(arch_type == llvm::Triple::mipsel)) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_mips);
+ g_abi_sp.reset(new ABISysV_mips(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-mips/ABISysV_mips.h b/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
index 980553c506bdb..0de8e7751fce4 100644
--- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
+++ b/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
@@ -74,7 +74,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -96,7 +96,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_mips() : lldb_private::ABI() {
+ ABISysV_mips(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index baa478ea1106b..749e170fa17d1 100644
--- a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -559,13 +559,13 @@ size_t ABISysV_mips64::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABISysV_mips64::CreateInstance(const ArchSpec &arch) {
+ABISysV_mips64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
if ((arch_type == llvm::Triple::mips64) ||
(arch_type == llvm::Triple::mips64el)) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_mips64);
+ g_abi_sp.reset(new ABISysV_mips64(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
index ac7d9b8719460..6258c08e35f9d 100644
--- a/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
+++ b/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
@@ -87,7 +87,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -109,7 +109,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_mips64() : lldb_private::ABI() {
+ ABISysV_mips64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
index 00adfe1be82d8..06a8ce932fdae 100644
--- a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
+++ b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
@@ -223,11 +223,11 @@ size_t ABISysV_ppc::GetRedZoneSize() const { return 224; }
//------------------------------------------------------------------
ABISP
-ABISysV_ppc::CreateInstance(const ArchSpec &arch) {
+ABISysV_ppc::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if (arch.GetTriple().getArch() == llvm::Triple::ppc) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_ppc);
+ g_abi_sp.reset(new ABISysV_ppc(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
index 8cb9bf24881f2..df3ebe83faf8d 100644
--- a/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
+++ b/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
@@ -83,7 +83,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -105,7 +105,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_ppc() : lldb_private::ABI() {
+ ABISysV_ppc(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
index 449990d71304b..c090f01ccb1cd 100644
--- a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -223,11 +223,11 @@ size_t ABISysV_ppc64::GetRedZoneSize() const { return 224; }
//------------------------------------------------------------------
ABISP
-ABISysV_ppc64::CreateInstance(const ArchSpec &arch) {
+ABISysV_ppc64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if (arch.GetTriple().getArch() == llvm::Triple::ppc64) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_ppc64);
+ g_abi_sp.reset(new ABISysV_ppc64(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
index 29237a68fc9ec..21608a5c1cdd8 100644
--- a/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
+++ b/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
@@ -83,7 +83,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -105,7 +105,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_ppc64() : lldb_private::ABI() {
+ ABISysV_ppc64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
index 7f76d49bfb0fd..967e407188fac 100644
--- a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
+++ b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
@@ -205,11 +205,11 @@ size_t ABISysV_s390x::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
ABISP
-ABISysV_s390x::CreateInstance(const ArchSpec &arch) {
+ABISysV_s390x::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if (arch.GetTriple().getArch() == llvm::Triple::systemz) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_s390x);
+ g_abi_sp.reset(new ABISysV_s390x(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
index e233a900e3954..5e3d20d7898b6 100644
--- a/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
+++ b/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
@@ -77,7 +77,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -99,7 +99,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_s390x() : lldb_private::ABI() {
+ ABISysV_s390x(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index deccca8c29e93..10bbae5664918 100644
--- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -1093,11 +1093,11 @@ size_t ABISysV_x86_64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
ABISP
-ABISysV_x86_64::CreateInstance(const ArchSpec &arch) {
+ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) {
static ABISP g_abi_sp;
if (arch.GetTriple().getArch() == llvm::Triple::x86_64) {
if (!g_abi_sp)
- g_abi_sp.reset(new ABISysV_x86_64);
+ g_abi_sp.reset(new ABISysV_x86_64(process_sp));
return g_abi_sp;
}
return ABISP();
diff --git a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
index 8d420e88167c2..5b67e8656d365 100644
--- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
+++ b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
@@ -85,7 +85,7 @@ public:
static void Terminate();
- static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch);
+ static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);
static lldb_private::ConstString GetPluginNameStatic();
@@ -107,7 +107,7 @@ protected:
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);
private:
- ABISysV_x86_64() : lldb_private::ABI() {
+ ABISysV_x86_64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) {
// Call CreateInstance instead.
}
};
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
index fdfe45b663c17..a02d1ad9bee36 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
@@ -18,11 +18,11 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"
#include "llvm/ADT/Triple.h"
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
index dd42686195b18..db90966e56157 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -25,11 +25,11 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"
#include "DynamicLoaderDarwin.h"
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
index 81c2fcfb194fb..8b5052e4e2302 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
@@ -28,11 +28,11 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/SafeMachO.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"
#include "DynamicLoaderDarwin.h"
diff --git a/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h b/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
index 9fd21c06f30cb..e9af5a6cdc747 100644
--- a/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
+++ b/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.h
@@ -14,9 +14,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/InstrumentationRuntime.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h b/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
index 87440a2489e68..516d9fef5e8e2 100644
--- a/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
+++ b/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h
@@ -10,9 +10,9 @@
#ifndef liblldb_MainThreadCheckerRuntime_h_
#define liblldb_MainThreadCheckerRuntime_h_
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h b/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
index 2a10582b65d28..dc737d22a67a5 100644
--- a/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
+++ b/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h
@@ -14,9 +14,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h b/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
index 0c478bd57e827..8f138fc12073e 100644
--- a/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
+++ b/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h
@@ -10,9 +10,9 @@
#ifndef liblldb_UndefinedBehaviorSanitizerRuntime_h_
#define liblldb_UndefinedBehaviorSanitizerRuntime_h_
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/InstrumentationRuntime.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
namespace lldb_private {
diff --git a/source/Plugins/Language/ObjC/Cocoa.cpp b/source/Plugins/Language/ObjC/Cocoa.cpp
index 6aaf66cbb486f..2ba005e02ad42 100644
--- a/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -517,11 +517,11 @@ bool lldb_private::formatters::NSNumberSummaryProvider(
bool is_preserved_number = cfinfoa & 0x8;
if (is_preserved_number) {
- lldbassert(!"We should handle preserved numbers!");
+ lldbassert(!static_cast<bool>("We should handle preserved numbers!"));
return false;
}
- type_code = (TypeCodes)(cfinfoa & 0x7);
+ type_code = static_cast<TypeCodes>(cfinfoa & 0x7);
} else {
uint8_t data_type =
process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, 1,
diff --git a/source/Plugins/Language/ObjC/NSSet.cpp b/source/Plugins/Language/ObjC/NSSet.cpp
index b6f6ff7af19d4..2f33987751699 100644
--- a/source/Plugins/Language/ObjC/NSSet.cpp
+++ b/source/Plugins/Language/ObjC/NSSet.cpp
@@ -13,6 +13,7 @@
// Project includes
#include "NSSet.h"
+#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
@@ -84,11 +85,12 @@ private:
std::vector<SetItemDescriptor> m_children;
};
-class NSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+template <typename D32, typename D64>
+class GenericNSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
- NSSetMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+ GenericNSSetMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
- ~NSSetMSyntheticFrontEnd() override;
+ ~GenericNSSetMSyntheticFrontEnd() override;
size_t CalculateNumChildren() override;
@@ -101,32 +103,57 @@ public:
size_t GetIndexOfChildWithName(const ConstString &name) override;
private:
+
+ struct SetItemDescriptor {
+ lldb::addr_t item_ptr;
+ lldb::ValueObjectSP valobj_sp;
+ };
+
+ ExecutionContextRef m_exe_ctx_ref;
+ uint8_t m_ptr_size;
+ D32 *m_data_32;
+ D64 *m_data_64;
+ std::vector<SetItemDescriptor> m_children;
+};
+
+namespace Foundation1300 {
struct DataDescriptor_32 {
uint32_t _used : 26;
uint32_t _size;
uint32_t _mutations;
uint32_t _objs_addr;
};
-
+
struct DataDescriptor_64 {
uint64_t _used : 58;
uint64_t _size;
uint64_t _mutations;
uint64_t _objs_addr;
};
-
- struct SetItemDescriptor {
- lldb::addr_t item_ptr;
- lldb::ValueObjectSP valobj_sp;
+
+ using NSSetMSyntheticFrontEnd =
+ GenericNSSetMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
+namespace Foundation1400 {
+ struct DataDescriptor_32 {
+ uint32_t _used : 26;
+ uint32_t _size;
+ uint32_t _objs_addr;
+ uint32_t _mutations;
};
-
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
- std::vector<SetItemDescriptor> m_children;
-};
-
+
+ struct DataDescriptor_64 {
+ uint64_t _used : 58;
+ uint64_t _size;
+ uint64_t _objs_addr;
+ uint64_t _mutations;
+ };
+
+ using NSSetMSyntheticFrontEnd =
+ GenericNSSetMSyntheticFrontEnd<DataDescriptor_32, DataDescriptor_64>;
+}
+
class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
public:
NSSetCodeRunningSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
@@ -283,7 +310,12 @@ lldb_private::formatters::NSSetSyntheticFrontEndCreator(
if (!strcmp(class_name, "__NSSetI")) {
return (new NSSetISyntheticFrontEnd(valobj_sp));
} else if (!strcmp(class_name, "__NSSetM")) {
- return (new NSSetMSyntheticFrontEnd(valobj_sp));
+ AppleObjCRuntime *apple_runtime =
+ llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
+ if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1400)
+ return (new Foundation1400::NSSetMSyntheticFrontEnd(valobj_sp));
+ else
+ return (new Foundation1300::NSSetMSyntheticFrontEnd(valobj_sp));
} else {
auto &map(NSSet_Additionals::GetAdditionalSynthetics());
auto iter = map.find(class_name_cs), end = map.end();
@@ -442,7 +474,9 @@ lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(size_t idx) {
return set_item.valobj_sp;
}
-lldb_private::formatters::NSSetMSyntheticFrontEnd::NSSetMSyntheticFrontEnd(
+template <typename D32, typename D64>
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::GenericNSSetMSyntheticFrontEnd(
lldb::ValueObjectSP valobj_sp)
: SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
m_data_32(nullptr), m_data_64(nullptr) {
@@ -450,15 +484,19 @@ lldb_private::formatters::NSSetMSyntheticFrontEnd::NSSetMSyntheticFrontEnd(
Update();
}
-lldb_private::formatters::NSSetMSyntheticFrontEnd::~NSSetMSyntheticFrontEnd() {
+template <typename D32, typename D64>
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::~GenericNSSetMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
m_data_64 = nullptr;
}
+template <typename D32, typename D64>
size_t
-lldb_private::formatters::NSSetMSyntheticFrontEnd::GetIndexOfChildWithName(
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::GetIndexOfChildWithName(
const ConstString &name) {
const char *item_name = name.GetCString();
uint32_t idx = ExtractIndexFromString(item_name);
@@ -467,14 +505,19 @@ lldb_private::formatters::NSSetMSyntheticFrontEnd::GetIndexOfChildWithName(
return idx;
}
+template <typename D32, typename D64>
size_t
-lldb_private::formatters::NSSetMSyntheticFrontEnd::CalculateNumChildren() {
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::CalculateNumChildren() {
if (!m_data_32 && !m_data_64)
return 0;
return (m_data_32 ? m_data_32->_used : m_data_64->_used);
}
-bool lldb_private::formatters::NSSetMSyntheticFrontEnd::Update() {
+template <typename D32, typename D64>
+bool
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::Update() {
m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
m_ptr_size = 0;
@@ -500,12 +543,12 @@ bool lldb_private::formatters::NSSetMSyntheticFrontEnd::Update() {
m_ptr_size = process_sp->GetAddressByteSize();
uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
if (m_ptr_size == 4) {
- m_data_32 = new DataDescriptor_32();
- process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+ m_data_32 = new D32();
+ process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
error);
} else {
- m_data_64 = new DataDescriptor_64();
- process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+ m_data_64 = new D64();
+ process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
error);
}
if (error.Fail())
@@ -513,12 +556,17 @@ bool lldb_private::formatters::NSSetMSyntheticFrontEnd::Update() {
return false;
}
-bool lldb_private::formatters::NSSetMSyntheticFrontEnd::MightHaveChildren() {
+template <typename D32, typename D64>
+bool
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::MightHaveChildren() {
return true;
}
+template <typename D32, typename D64>
lldb::ValueObjectSP
-lldb_private::formatters::NSSetMSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+lldb_private::formatters::
+ GenericNSSetMSyntheticFrontEnd<D32, D64>::GetChildAtIndex(size_t idx) {
lldb::addr_t m_objs_addr =
(m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index f15bcaa13844b..2a7735959a910 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -30,7 +30,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/FunctionCaller.h"
@@ -55,6 +54,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "AppleObjCClassDescriptorV2.h"
#include "AppleObjCDeclVendor.h"
diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 8a388a6673724..25bfce7a2b835 100644
--- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -31,11 +31,11 @@ typedef struct ar_hdr {
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/Support/MemoryBuffer.h"
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 20e9a930b4861..3b33cf1601fb7 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -19,7 +19,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
@@ -28,6 +27,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
diff --git a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index 055a8219f1547..06406c6f16556 100644
--- a/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -20,7 +20,6 @@
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Platform.h"
@@ -32,6 +31,7 @@
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#ifndef __APPLE__
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 1a4ae1a21aecc..9bc171e454c98 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -27,7 +27,6 @@
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -44,6 +43,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "lldb/Utility/SafeMachO.h"
@@ -2502,7 +2502,7 @@ size_t ObjectFileMachO::ParseSymtab() {
if (text_section_sp.get() && eh_frame_section_sp.get() &&
m_type != eTypeDebugInfo) {
DWARFCallFrameInfo eh_frame(*this, eh_frame_section_sp,
- eRegisterKindEHFrame, true);
+ DWARFCallFrameInfo::EH);
DWARFCallFrameInfo::FunctionAddressAndSizeVector functions;
eh_frame.GetFunctionAddressAndSizeVector(functions);
addr_t text_base_addr = text_section_sp->GetFileAddress();
diff --git a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 4739a4934aa65..5607a71ad5aab 100644
--- a/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -19,7 +19,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
@@ -28,6 +27,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "llvm/Support/MemoryBuffer.h"
diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 14bf0784dc2cc..588f3f7aec645 100644
--- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -22,7 +22,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
@@ -35,6 +34,7 @@
#include "lldb/Target/ThreadList.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
index 1eec30ef38c7c..2e16804109620 100644
--- a/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
+++ b/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
@@ -16,8 +16,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/OperatingSystem.h"
+#include "lldb/Utility/StructuredData.h"
class DynamicRegisterInfo;
diff --git a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index a29cc9e1ed868..f87852ed7f440 100644
--- a/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -24,7 +24,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Symbols.h"
@@ -39,6 +38,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Threading.h"
diff --git a/source/Plugins/Process/Linux/CMakeLists.txt b/source/Plugins/Process/Linux/CMakeLists.txt
index 8a46d730caffa..8330cac160e6a 100644
--- a/source/Plugins/Process/Linux/CMakeLists.txt
+++ b/source/Plugins/Process/Linux/CMakeLists.txt
@@ -11,6 +11,7 @@ add_lldb_library(lldbPluginProcessLinux PLUGIN
NativeRegisterContextLinux_mips64.cpp
NativeRegisterContextLinux_s390x.cpp
NativeThreadLinux.cpp
+ ProcessorTrace.cpp
SingleStepCheck.cpp
LINK_LIBS
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index e39a1788fc000..8e378802de9c6 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -289,7 +289,8 @@ Status NativeProcessProtocol::Attach(
NativeProcessLinux::NativeProcessLinux()
: NativeProcessProtocol(LLDB_INVALID_PROCESS_ID), m_arch(),
m_supports_mem_region(eLazyBoolCalculate), m_mem_region_cache(),
- m_pending_notification_tid(LLDB_INVALID_THREAD_ID) {}
+ m_pending_notification_tid(LLDB_INVALID_THREAD_ID),
+ m_pt_proces_trace_id(LLDB_INVALID_UID) {}
void NativeProcessLinux::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid,
Status &error) {
@@ -580,6 +581,7 @@ void NativeProcessLinux::MonitorCallback(lldb::pid_t pid, bool exited,
info.si_pid);
auto thread_sp = AddThread(pid);
+
// Resume the newly created thread.
ResumeThread(*thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
ThreadWasCreated(*thread_sp);
@@ -691,6 +693,7 @@ void NativeProcessLinux::WaitForNewThread(::pid_t tid) {
LLDB_LOG(log, "pid = {0}: tracking new thread tid {1}", GetID(), tid);
new_thread_sp = AddThread(tid);
+
ResumeThread(*new_thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
ThreadWasCreated(*new_thread_sp);
}
@@ -1301,6 +1304,9 @@ Status NativeProcessLinux::Detach() {
e; // Save the error, but still attempt to detach from other threads.
}
+ m_processor_trace_monitor.clear();
+ m_pt_proces_trace_id = LLDB_INVALID_UID;
+
return error;
}
@@ -2089,6 +2095,8 @@ bool NativeProcessLinux::StopTrackingThread(lldb::tid_t thread_id) {
}
}
+ if (found)
+ StopTracingForThread(thread_id);
SignalIfAllThreadsStopped();
return found;
}
@@ -2106,6 +2114,21 @@ NativeThreadLinuxSP NativeProcessLinux::AddThread(lldb::tid_t thread_id) {
auto thread_sp = std::make_shared<NativeThreadLinux>(this, thread_id);
m_threads.push_back(thread_sp);
+
+ if (m_pt_proces_trace_id != LLDB_INVALID_UID) {
+ auto traceMonitor = ProcessorTraceMonitor::Create(
+ GetID(), thread_id, m_pt_process_trace_config, true);
+ if (traceMonitor) {
+ m_pt_traced_thread_group.insert(thread_id);
+ m_processor_trace_monitor.insert(
+ std::make_pair(thread_id, std::move(*traceMonitor)));
+ } else {
+ LLDB_LOG(log, "failed to start trace on thread {0}", thread_id);
+ Status error(traceMonitor.takeError());
+ LLDB_LOG(log, "error {0}", error);
+ }
+ }
+
return thread_sp;
}
@@ -2405,3 +2428,258 @@ Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
return error;
}
+
+llvm::Expected<ProcessorTraceMonitor &>
+NativeProcessLinux::LookupProcessorTraceInstance(lldb::user_id_t traceid,
+ lldb::tid_t thread) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ if (thread == LLDB_INVALID_THREAD_ID && traceid == m_pt_proces_trace_id) {
+ LLDB_LOG(log, "thread not specified: {0}", traceid);
+ return Status("tracing not active thread not specified").ToError();
+ }
+
+ for (auto& iter : m_processor_trace_monitor) {
+ if (traceid == iter.second->GetTraceID() &&
+ (thread == iter.first || thread == LLDB_INVALID_THREAD_ID))
+ return *(iter.second);
+ }
+
+ LLDB_LOG(log, "traceid not being traced: {0}", traceid);
+ return Status("tracing not active for this thread").ToError();
+}
+
+Status NativeProcessLinux::GetMetaData(lldb::user_id_t traceid,
+ lldb::tid_t thread,
+ llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset) {
+ TraceOptions trace_options;
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ Status error;
+
+ LLDB_LOG(log, "traceid {0}", traceid);
+
+ auto perf_monitor = LookupProcessorTraceInstance(traceid, thread);
+ if (!perf_monitor) {
+ LLDB_LOG(log, "traceid not being traced: {0}", traceid);
+ buffer = buffer.slice(buffer.size());
+ error = perf_monitor.takeError();
+ return error;
+ }
+ return (*perf_monitor).ReadPerfTraceData(buffer, offset);
+}
+
+Status NativeProcessLinux::GetData(lldb::user_id_t traceid, lldb::tid_t thread,
+ llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ Status error;
+
+ LLDB_LOG(log, "traceid {0}", traceid);
+
+ auto perf_monitor = LookupProcessorTraceInstance(traceid, thread);
+ if (!perf_monitor) {
+ LLDB_LOG(log, "traceid not being traced: {0}", traceid);
+ buffer = buffer.slice(buffer.size());
+ error = perf_monitor.takeError();
+ return error;
+ }
+ return (*perf_monitor).ReadPerfTraceAux(buffer, offset);
+}
+
+Status NativeProcessLinux::GetTraceConfig(lldb::user_id_t traceid,
+ TraceOptions &config) {
+ Status error;
+ if (config.getThreadID() == LLDB_INVALID_THREAD_ID &&
+ m_pt_proces_trace_id == traceid) {
+ if (m_pt_proces_trace_id == LLDB_INVALID_UID) {
+ error.SetErrorString("tracing not active for this process");
+ return error;
+ }
+ config = m_pt_process_trace_config;
+ } else {
+ auto perf_monitor =
+ LookupProcessorTraceInstance(traceid, config.getThreadID());
+ if (!perf_monitor) {
+ error = perf_monitor.takeError();
+ return error;
+ }
+ error = (*perf_monitor).GetTraceConfig(config);
+ }
+ return error;
+}
+
+lldb::user_id_t
+NativeProcessLinux::StartTraceGroup(const TraceOptions &config,
+ Status &error) {
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ if (config.getType() != TraceType::eTraceTypeProcessorTrace)
+ return LLDB_INVALID_UID;
+
+ if (m_pt_proces_trace_id != LLDB_INVALID_UID) {
+ error.SetErrorString("tracing already active on this process");
+ return m_pt_proces_trace_id;
+ }
+
+ for (const auto &thread_sp : m_threads) {
+ if (auto traceInstance = ProcessorTraceMonitor::Create(
+ GetID(), thread_sp->GetID(), config, true)) {
+ m_pt_traced_thread_group.insert(thread_sp->GetID());
+ m_processor_trace_monitor.insert(
+ std::make_pair(thread_sp->GetID(), std::move(*traceInstance)));
+ }
+ }
+
+ m_pt_process_trace_config = config;
+ error = ProcessorTraceMonitor::GetCPUType(m_pt_process_trace_config);
+
+ // Trace on Complete process will have traceid of 0
+ m_pt_proces_trace_id = 0;
+
+ LLDB_LOG(log, "Process Trace ID {0}", m_pt_proces_trace_id);
+ return m_pt_proces_trace_id;
+}
+
+lldb::user_id_t NativeProcessLinux::StartTrace(const TraceOptions &config,
+ Status &error) {
+ if (config.getType() != TraceType::eTraceTypeProcessorTrace)
+ return NativeProcessProtocol::StartTrace(config, error);
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+
+ lldb::tid_t threadid = config.getThreadID();
+
+ if (threadid == LLDB_INVALID_THREAD_ID)
+ return StartTraceGroup(config, error);
+
+ auto thread_sp = GetThreadByID(threadid);
+ if (!thread_sp) {
+ // Thread not tracked by lldb so don't trace.
+ error.SetErrorString("invalid thread id");
+ return LLDB_INVALID_UID;
+ }
+
+ const auto &iter = m_processor_trace_monitor.find(threadid);
+ if (iter != m_processor_trace_monitor.end()) {
+ LLDB_LOG(log, "Thread already being traced");
+ error.SetErrorString("tracing already active on this thread");
+ return LLDB_INVALID_UID;
+ }
+
+ auto traceMonitor =
+ ProcessorTraceMonitor::Create(GetID(), threadid, config, false);
+ if (!traceMonitor) {
+ error = traceMonitor.takeError();
+ LLDB_LOG(log, "error {0}", error);
+ return LLDB_INVALID_UID;
+ }
+ lldb::user_id_t ret_trace_id = (*traceMonitor)->GetTraceID();
+ m_processor_trace_monitor.insert(
+ std::make_pair(threadid, std::move(*traceMonitor)));
+ return ret_trace_id;
+}
+
+Status NativeProcessLinux::StopTracingForThread(lldb::tid_t thread) {
+ Status error;
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ LLDB_LOG(log, "Thread {0}", thread);
+
+ const auto& iter = m_processor_trace_monitor.find(thread);
+ if (iter == m_processor_trace_monitor.end()) {
+ error.SetErrorString("tracing not active for this thread");
+ return error;
+ }
+
+ if (iter->second->GetTraceID() == m_pt_proces_trace_id) {
+ // traceid maps to the whole process so we have to erase it from the
+ // thread group.
+ LLDB_LOG(log, "traceid maps to process");
+ m_pt_traced_thread_group.erase(thread);
+ }
+ m_processor_trace_monitor.erase(iter);
+
+ return error;
+}
+
+Status NativeProcessLinux::StopTrace(lldb::user_id_t traceid,
+ lldb::tid_t thread) {
+ Status error;
+
+ TraceOptions trace_options;
+ trace_options.setThreadID(thread);
+ error = NativeProcessLinux::GetTraceConfig(traceid, trace_options);
+
+ if (error.Fail())
+ return error;
+
+ switch (trace_options.getType()) {
+ case lldb::TraceType::eTraceTypeProcessorTrace:
+ if (traceid == m_pt_proces_trace_id &&
+ thread == LLDB_INVALID_THREAD_ID)
+ StopProcessorTracingOnProcess();
+ else
+ error = StopProcessorTracingOnThread(traceid, thread);
+ break;
+ default:
+ error.SetErrorString("trace not supported");
+ break;
+ }
+
+ return error;
+}
+
+void NativeProcessLinux::StopProcessorTracingOnProcess() {
+ for (auto thread_id_iter : m_pt_traced_thread_group)
+ m_processor_trace_monitor.erase(thread_id_iter);
+ m_pt_traced_thread_group.clear();
+ m_pt_proces_trace_id = LLDB_INVALID_UID;
+}
+
+Status NativeProcessLinux::StopProcessorTracingOnThread(lldb::user_id_t traceid,
+ lldb::tid_t thread) {
+ Status error;
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+
+ if (thread == LLDB_INVALID_THREAD_ID) {
+ for (auto& iter : m_processor_trace_monitor) {
+ if (iter.second->GetTraceID() == traceid) {
+ // Stopping a trace instance for an individual thread
+ // hence there will only be one traceid that can match.
+ m_processor_trace_monitor.erase(iter.first);
+ return error;
+ }
+ LLDB_LOG(log, "Trace ID {0}", iter.second->GetTraceID());
+ }
+
+ LLDB_LOG(log, "Invalid TraceID");
+ error.SetErrorString("invalid trace id");
+ return error;
+ }
+
+ // thread is specified so we can use find function on the map.
+ const auto& iter = m_processor_trace_monitor.find(thread);
+ if (iter == m_processor_trace_monitor.end()) {
+ // thread not found in our map.
+ LLDB_LOG(log, "thread not being traced");
+ error.SetErrorString("tracing not active for this thread");
+ return error;
+ }
+ if (iter->second->GetTraceID() != traceid) {
+ // traceid did not match so it has to be invalid.
+ LLDB_LOG(log, "Invalid TraceID");
+ error.SetErrorString("invalid trace id");
+ return error;
+ }
+
+ LLDB_LOG(log, "UID - {0} , Thread -{1}", traceid, thread);
+
+ if (traceid == m_pt_proces_trace_id) {
+ // traceid maps to the whole process so we have to erase it from the
+ // thread group.
+ LLDB_LOG(log, "traceid maps to process");
+ m_pt_traced_thread_group.erase(thread);
+ }
+ m_processor_trace_monitor.erase(iter);
+
+ return error;
+}
diff --git a/source/Plugins/Process/Linux/NativeProcessLinux.h b/source/Plugins/Process/Linux/NativeProcessLinux.h
index aa6fe44120680..6bf093f6a39a7 100644
--- a/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -23,6 +23,7 @@
#include "lldb/lldb-types.h"
#include "NativeThreadLinux.h"
+#include "ProcessorTrace.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
namespace lldb_private {
@@ -105,6 +106,22 @@ public:
return getProcFile(GetID(), "auxv");
}
+ lldb::user_id_t StartTrace(const TraceOptions &config,
+ Status &error) override;
+
+ Status StopTrace(lldb::user_id_t traceid,
+ lldb::tid_t thread) override;
+
+ Status GetData(lldb::user_id_t traceid, lldb::tid_t thread,
+ llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset = 0) override;
+
+ Status GetMetaData(lldb::user_id_t traceid, lldb::tid_t thread,
+ llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset = 0) override;
+
+ Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions &config) override;
+
// ---------------------------------------------------------------------
// Interface used by NativeRegisterContext-derived classes.
// ---------------------------------------------------------------------
@@ -228,6 +245,43 @@ private:
void SigchldHandler();
Status PopulateMemoryRegionCache();
+
+ lldb::user_id_t StartTraceGroup(const TraceOptions &config,
+ Status &error);
+
+ // This function is intended to be used to stop tracing
+ // on a thread that exited.
+ Status StopTracingForThread(lldb::tid_t thread);
+
+ // The below function as the name suggests, looks up a ProcessorTrace
+ // instance from the m_processor_trace_monitor map. In the case of
+ // process tracing where the traceid passed would map to the complete
+ // process, it is mandatory to provide a threadid to obtain a trace
+ // instance (since ProcessorTrace is tied to a thread). In the other
+ // scenario that an individual thread is being traced, just the traceid
+ // is sufficient to obtain the actual ProcessorTrace instance.
+ llvm::Expected<ProcessorTraceMonitor &>
+ LookupProcessorTraceInstance(lldb::user_id_t traceid, lldb::tid_t thread);
+
+ // Stops tracing on individual threads being traced. Not intended
+ // to be used to stop tracing on complete process.
+ Status StopProcessorTracingOnThread(lldb::user_id_t traceid,
+ lldb::tid_t thread);
+
+ // Intended to stop tracing on complete process.
+ // Should not be used for stopping trace on
+ // individual threads.
+ void StopProcessorTracingOnProcess();
+
+ llvm::DenseMap<lldb::tid_t, ProcessorTraceMonitorUP>
+ m_processor_trace_monitor;
+
+ // Set for tracking threads being traced under
+ // same process user id.
+ llvm::DenseSet<lldb::tid_t> m_pt_traced_thread_group;
+
+ lldb::user_id_t m_pt_proces_trace_id;
+ TraceOptions m_pt_process_trace_config;
};
} // namespace process_linux
diff --git a/source/Plugins/Process/Linux/ProcessorTrace.cpp b/source/Plugins/Process/Linux/ProcessorTrace.cpp
new file mode 100644
index 0000000000000..7043d50256e6c
--- /dev/null
+++ b/source/Plugins/Process/Linux/ProcessorTrace.cpp
@@ -0,0 +1,400 @@
+//===-- ProcessorTrace.cpp ------------------------------------ -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <algorithm>
+#include <fstream>
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MathExtras.h"
+
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
+#include "ProcessorTrace.h"
+#include "lldb/Host/linux/Support.h"
+
+#include <sys/syscall.h>
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace process_linux;
+using namespace llvm;
+
+lldb::user_id_t ProcessorTraceMonitor::m_trace_num = 1;
+
+Status ProcessorTraceMonitor::GetTraceConfig(TraceOptions &config) const {
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+ Status error;
+
+ config.setType(lldb::TraceType::eTraceTypeProcessorTrace);
+ config.setMetaDataBufferSize(m_mmap_meta->data_size);
+
+ config.setTraceBufferSize(m_mmap_meta->aux_size);
+
+ error = GetCPUType(config);
+
+ return error;
+#endif
+}
+
+Status ProcessorTraceMonitor::StartTrace(lldb::pid_t pid, lldb::tid_t tid,
+ const TraceOptions &config) {
+ Status error;
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ LLDB_LOG(log, "{0}", config.getThreadID());
+
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+
+ LLDB_LOG(log, "called thread id {0}", tid);
+ uint64_t page_size = getpagesize();
+ uint64_t bufsize = config.getTraceBufferSize();
+ uint64_t metabufsize = config.getMetaDataBufferSize();
+
+ uint64_t numpages = static_cast<uint64_t>(
+ llvm::PowerOf2Floor((bufsize + page_size - 1) / page_size));
+ numpages = std::max(1ul, numpages);
+ bufsize = page_size * numpages;
+
+ numpages = static_cast<uint64_t>(
+ llvm::PowerOf2Floor((metabufsize + page_size - 1) / page_size));
+ numpages = std::max(0ul, numpages);
+ metabufsize = page_size * numpages;
+
+ perf_event_attr attr;
+ memset(&attr, 0, sizeof(attr));
+ attr.size = sizeof(attr);
+ attr.exclude_kernel = 1;
+ attr.sample_type = PERF_SAMPLE_TIME;
+ attr.sample_id_all = 1;
+ attr.exclude_hv = 1;
+ attr.exclude_idle = 1;
+ attr.mmap = 1;
+
+ int intel_pt_type = 0;
+
+ auto ret = llvm::MemoryBuffer::getFileAsStream(
+ "/sys/bus/event_source/devices/intel_pt/type");
+ if (!ret) {
+ LLDB_LOG(log, "failed to open Config file");
+ return ret.getError();
+ }
+
+ StringRef rest = ret.get()->getBuffer();
+ if (rest.empty() || rest.trim().getAsInteger(10, intel_pt_type)) {
+ LLDB_LOG(log, "failed to read Config file");
+ error.SetErrorString("invalid file");
+ return error;
+ }
+
+ rest.trim().getAsInteger(10, intel_pt_type);
+ LLDB_LOG(log, "intel pt type {0}", intel_pt_type);
+ attr.type = intel_pt_type;
+
+ LLDB_LOG(log, "meta buffer size {0}", metabufsize);
+ LLDB_LOG(log, "buffer size {0} ", bufsize);
+
+ if (error.Fail()) {
+ LLDB_LOG(log, "Status in custom config");
+
+ return error;
+ }
+
+ errno = 0;
+ auto fd =
+ syscall(SYS_perf_event_open, &attr, static_cast<::tid_t>(tid), -1, -1, 0);
+ if (fd == -1) {
+ LLDB_LOG(log, "syscall error {0}", errno);
+ error.SetErrorString("perf event syscall Failed");
+ return error;
+ }
+
+ m_fd = std::move(std::unique_ptr<int, file_close>(new int(fd), file_close()));
+
+ errno = 0;
+ auto base =
+ mmap(NULL, (metabufsize + page_size), PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if (base == MAP_FAILED) {
+ LLDB_LOG(log, "mmap base error {0}", errno);
+ error.SetErrorString("Meta buffer allocation failed");
+ return error;
+ }
+
+ m_mmap_meta = std::move(std::unique_ptr<perf_event_mmap_page, munmap_delete>(
+ reinterpret_cast<perf_event_mmap_page *>(base),
+ munmap_delete(metabufsize + page_size)));
+
+ m_mmap_meta->aux_offset = m_mmap_meta->data_offset + m_mmap_meta->data_size;
+ m_mmap_meta->aux_size = bufsize;
+
+ errno = 0;
+ auto mmap_aux = mmap(NULL, bufsize, PROT_READ, MAP_SHARED, fd,
+ static_cast<long int>(m_mmap_meta->aux_offset));
+
+ if (mmap_aux == MAP_FAILED) {
+ LLDB_LOG(log, "second mmap done {0}", errno);
+ error.SetErrorString("Trace buffer allocation failed");
+ return error;
+ }
+ m_mmap_aux = std::move(std::unique_ptr<uint8_t, munmap_delete>(
+ reinterpret_cast<uint8_t *>(mmap_aux), munmap_delete(bufsize)));
+#endif
+ return error;
+}
+
+llvm::MutableArrayRef<uint8_t> ProcessorTraceMonitor::GetDataBuffer() {
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+ return MutableArrayRef<uint8_t>(
+ (reinterpret_cast<uint8_t *>(m_mmap_meta.get()) +
+ m_mmap_meta->data_offset),
+ m_mmap_meta->data_size);
+#endif
+}
+
+llvm::MutableArrayRef<uint8_t> ProcessorTraceMonitor::GetAuxBuffer() {
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+ return MutableArrayRef<uint8_t>(m_mmap_aux.get(), m_mmap_meta->aux_size);
+#endif
+}
+
+Status ProcessorTraceMonitor::GetCPUType(TraceOptions &config) {
+
+ Status error;
+ uint64_t cpu_family = -1;
+ uint64_t model = -1;
+ uint64_t stepping = -1;
+ std::string vendor_id;
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+
+ auto BufferOrError = getProcFile("cpuinfo");
+ if (!BufferOrError)
+ return BufferOrError.getError();
+
+ LLDB_LOG(log, "GetCPUType Function");
+
+ StringRef Rest = BufferOrError.get()->getBuffer();
+ while (!Rest.empty()) {
+ StringRef Line;
+ std::tie(Line, Rest) = Rest.split('\n');
+
+ SmallVector<StringRef, 2> columns;
+ Line.split(columns, StringRef(":"), -1, false);
+
+ if (columns.size() < 2)
+ continue; // continue searching
+
+ columns[1] = columns[1].trim(" ");
+ if (columns[0].contains("cpu family") &&
+ columns[1].getAsInteger(10, cpu_family))
+ continue;
+
+ else if (columns[0].contains("model") && columns[1].getAsInteger(10, model))
+ continue;
+
+ else if (columns[0].contains("stepping") &&
+ columns[1].getAsInteger(10, stepping))
+ continue;
+
+ else if (columns[0].contains("vendor_id")) {
+ vendor_id = columns[1].str();
+ if (!vendor_id.empty())
+ continue;
+ }
+ LLDB_LOG(log, "{0}:{1}:{2}:{3}", cpu_family, model, stepping, vendor_id);
+
+ if ((cpu_family != static_cast<uint64_t>(-1)) &&
+ (model != static_cast<uint64_t>(-1)) &&
+ (stepping != static_cast<uint64_t>(-1)) && (!vendor_id.empty())) {
+ auto params_dict = std::make_shared<StructuredData::Dictionary>();
+ params_dict->AddIntegerItem("cpu_family", cpu_family);
+ params_dict->AddIntegerItem("cpu_model", model);
+ params_dict->AddIntegerItem("cpu_stepping", stepping);
+ params_dict->AddStringItem("cpu_vendor", vendor_id);
+
+ llvm::StringRef intel_custom_params_key("intel-pt");
+
+ auto intel_custom_params = std::make_shared<StructuredData::Dictionary>();
+ intel_custom_params->AddItem(
+ intel_custom_params_key,
+ StructuredData::ObjectSP(std::move(params_dict)));
+
+ config.setTraceParams(intel_custom_params);
+ return error; // we are done
+ }
+ }
+
+ error.SetErrorString("cpu info not found");
+ return error;
+}
+
+llvm::Expected<ProcessorTraceMonitorUP>
+ProcessorTraceMonitor::Create(lldb::pid_t pid, lldb::tid_t tid,
+ const TraceOptions &config,
+ bool useProcessSettings) {
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+
+ Status error;
+ if (tid == LLDB_INVALID_THREAD_ID) {
+ error.SetErrorString("thread not specified");
+ return std::move(error.ToError());
+ }
+
+ ProcessorTraceMonitorUP pt_monitor_up(new ProcessorTraceMonitor);
+
+ error = pt_monitor_up->StartTrace(pid, tid, config);
+ if (error.Fail())
+ return std::move(error.ToError());
+
+ pt_monitor_up->SetThreadID(tid);
+
+ if (useProcessSettings) {
+ pt_monitor_up->SetTraceID(0);
+ } else {
+ pt_monitor_up->SetTraceID(m_trace_num++);
+ LLDB_LOG(log, "Trace ID {0}", m_trace_num);
+ }
+ return std::move(pt_monitor_up);
+}
+
+Status
+ProcessorTraceMonitor::ReadPerfTraceAux(llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset) {
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ Status error;
+
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+ uint64_t head = m_mmap_meta->aux_head;
+
+ LLDB_LOG(log, "Aux size -{0} , Head - {1}", m_mmap_meta->aux_size, head);
+
+ /**
+ * When configured as ring buffer, the aux buffer keeps wrapping around
+ * the buffer and its not possible to detect how many times the buffer
+ * wrapped. Initially the buffer is filled with zeros,as shown below
+ * so in order to get complete buffer we first copy firstpartsize, followed
+ * by any left over part from beginning to aux_head
+ *
+ * aux_offset [d,d,d,d,d,d,d,d,0,0,0,0,0,0,0,0,0,0,0] aux_size
+ * aux_head->||<- firstpartsize ->|
+ *
+ * */
+
+ ReadCyclicBuffer(buffer, GetAuxBuffer(), static_cast<size_t>(head), offset);
+ LLDB_LOG(log, "ReadCyclic BUffer Done");
+ return error;
+#endif
+}
+
+Status
+ProcessorTraceMonitor::ReadPerfTraceData(llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset) {
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+ uint64_t bytes_remaining = buffer.size();
+ Status error;
+#ifndef PERF_ATTR_SIZE_VER5
+ llvm_unreachable("perf event not supported");
+#else
+
+ uint64_t head = m_mmap_meta->data_head;
+
+ /*
+ * The data buffer and aux buffer have different implementations
+ * with respect to their definition of head pointer. In the case
+ * of Aux data buffer the head always wraps around the aux buffer
+ * and we don't need to care about it, whereas the data_head keeps
+ * increasing and needs to be wrapped by modulus operator
+ */
+
+ LLDB_LOG(log, "bytes_remaining - {0}", bytes_remaining);
+
+ auto data_buffer = GetDataBuffer();
+
+ if (head > data_buffer.size()) {
+ head = head % data_buffer.size();
+ LLDB_LOG(log, "Data size -{0} Head - {1}", m_mmap_meta->data_size, head);
+
+ ReadCyclicBuffer(buffer, data_buffer, static_cast<size_t>(head), offset);
+ bytes_remaining -= buffer.size();
+ } else {
+ LLDB_LOG(log, "Head - {0}", head);
+ if (offset >= head) {
+ LLDB_LOG(log, "Invalid Offset ");
+ error.SetErrorString("invalid offset");
+ buffer = buffer.slice(buffer.size());
+ return error;
+ }
+
+ auto data = data_buffer.slice(offset, (head - offset));
+ auto remaining = std::copy(data.begin(), data.end(), buffer.begin());
+ bytes_remaining -= (remaining - buffer.begin());
+ }
+ buffer = buffer.drop_back(bytes_remaining);
+ return error;
+#endif
+}
+
+void ProcessorTraceMonitor::ReadCyclicBuffer(
+ llvm::MutableArrayRef<uint8_t> &dst, llvm::MutableArrayRef<uint8_t> src,
+ size_t src_cyc_index, size_t offset) {
+
+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
+
+ if (dst.empty() || src.empty()) {
+ dst = dst.drop_back(dst.size());
+ return;
+ }
+
+ if (dst.data() == nullptr || src.data() == nullptr) {
+ dst = dst.drop_back(dst.size());
+ return;
+ }
+
+ if (src_cyc_index > src.size()) {
+ dst = dst.drop_back(dst.size());
+ return;
+ }
+
+ if (offset >= src.size()) {
+ LLDB_LOG(log, "Too Big offset ");
+ dst = dst.drop_back(dst.size());
+ return;
+ }
+
+ llvm::SmallVector<MutableArrayRef<uint8_t>, 2> parts = {
+ src.slice(src_cyc_index), src.take_front(src_cyc_index)};
+
+ if (offset > parts[0].size()) {
+ parts[1] = parts[1].slice(offset - parts[0].size());
+ parts[0] = parts[0].drop_back(parts[0].size());
+ } else if (offset == parts[0].size()) {
+ parts[0] = parts[0].drop_back(parts[0].size());
+ } else {
+ parts[0] = parts[0].slice(offset);
+ }
+ auto next = dst.begin();
+ auto bytes_left = dst.size();
+ for (auto part : parts) {
+ size_t chunk_size = std::min(part.size(), bytes_left);
+ next = std::copy_n(part.begin(), chunk_size, next);
+ bytes_left -= chunk_size;
+ }
+ dst = dst.drop_back(bytes_left);
+}
diff --git a/source/Plugins/Process/Linux/ProcessorTrace.h b/source/Plugins/Process/Linux/ProcessorTrace.h
new file mode 100644
index 0000000000000..ddcaf0f842b5b
--- /dev/null
+++ b/source/Plugins/Process/Linux/ProcessorTrace.h
@@ -0,0 +1,140 @@
+//===-- ProcessorTrace.h -------------------------------------- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ProcessorTrace_H_
+#define liblldb_ProcessorTrace_H_
+
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/TraceOptions.h"
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
+
+#include <linux/perf_event.h>
+#include <sys/mman.h>
+
+namespace lldb_private {
+
+namespace process_linux {
+
+// ---------------------------------------------------------------------
+// This class keeps track of one tracing instance of
+// Intel(R) Processor Trace on Linux OS. There is a map keeping track
+// of different tracing instances on each thread, which enables trace
+// gathering on a per thread level.
+//
+// The tracing instance is linked with a trace id. The trace id acts like
+// a key to the tracing instance and trace manipulations could be
+// performed using the trace id.
+//
+// The traace id could map to trace instances for a group of threads
+// (spanning to all the threads in the process) or a single thread.
+// The kernel interface for us is the perf_event_open.
+// ---------------------------------------------------------------------
+
+class ProcessorTraceMonitor;
+typedef std::unique_ptr<ProcessorTraceMonitor> ProcessorTraceMonitorUP;
+
+class ProcessorTraceMonitor {
+
+ class munmap_delete {
+ size_t m_length;
+
+ public:
+ munmap_delete(size_t length) : m_length(length) {}
+ void operator()(void *ptr) {
+ if (m_length)
+ munmap(ptr, m_length);
+ }
+ };
+
+ class file_close {
+
+ public:
+ file_close() = default;
+ void operator()(int *ptr) {
+ if (ptr == nullptr)
+ return;
+ if (*ptr == -1)
+ return;
+ close(*ptr);
+ std::default_delete<int>()(ptr);
+ }
+ };
+
+ std::unique_ptr<perf_event_mmap_page, munmap_delete> m_mmap_meta;
+ std::unique_ptr<uint8_t, munmap_delete> m_mmap_aux;
+ std::unique_ptr<int, file_close> m_fd;
+
+ // perf_event_mmap_page *m_mmap_base;
+ lldb::user_id_t m_traceid;
+ lldb::tid_t m_thread_id;
+
+ // Counter to track trace instances.
+ static lldb::user_id_t m_trace_num;
+
+ void SetTraceID(lldb::user_id_t traceid) { m_traceid = traceid; }
+
+ Status StartTrace(lldb::pid_t pid, lldb::tid_t tid,
+ const TraceOptions &config);
+
+ llvm::MutableArrayRef<uint8_t> GetAuxBuffer();
+ llvm::MutableArrayRef<uint8_t> GetDataBuffer();
+
+ ProcessorTraceMonitor()
+ : m_mmap_meta(nullptr, munmap_delete(0)),
+ m_mmap_aux(nullptr, munmap_delete(0)), m_fd(nullptr, file_close()),
+ m_traceid(LLDB_INVALID_UID), m_thread_id(LLDB_INVALID_THREAD_ID){};
+
+ void SetThreadID(lldb::tid_t tid) { m_thread_id = tid; }
+
+public:
+ static Status GetCPUType(TraceOptions &config);
+
+ static llvm::Expected<ProcessorTraceMonitorUP>
+ Create(lldb::pid_t pid, lldb::tid_t tid, const TraceOptions &config,
+ bool useProcessSettings);
+
+ Status ReadPerfTraceAux(llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset = 0);
+
+ Status ReadPerfTraceData(llvm::MutableArrayRef<uint8_t> &buffer,
+ size_t offset = 0);
+
+ ~ProcessorTraceMonitor() = default;
+
+ lldb::tid_t GetThreadID() const { return m_thread_id; }
+
+ lldb::user_id_t GetTraceID() const { return m_traceid; }
+
+ Status GetTraceConfig(TraceOptions &config) const;
+
+ // ---------------------------------------------------------------------
+ /// Read data from a cyclic buffer
+ ///
+ /// @param[in] [out] buf
+ /// Destination buffer, the buffer will be truncated to written size.
+ ///
+ /// @param[in] src
+ /// Source buffer which must be a cyclic buffer.
+ ///
+ /// @param[in] src_cyc_index
+ /// The index pointer (start of the valid data in the cyclic
+ /// buffer).
+ ///
+ /// @param[in] offset
+ /// The offset to begin reading the data in the cyclic buffer.
+ // ---------------------------------------------------------------------
+ static void ReadCyclicBuffer(llvm::MutableArrayRef<uint8_t> &dst,
+ llvm::MutableArrayRef<uint8_t> src,
+ size_t src_cyc_index, size_t offset);
+};
+} // namespace process_linux
+} // namespace lldb_private
+#endif
diff --git a/source/Plugins/Process/POSIX/CMakeLists.txt b/source/Plugins/Process/POSIX/CMakeLists.txt
index 66fb7aa155b42..d9a4508df0a34 100644
--- a/source/Plugins/Process/POSIX/CMakeLists.txt
+++ b/source/Plugins/Process/POSIX/CMakeLists.txt
@@ -7,7 +7,6 @@ add_lldb_library(lldbPluginProcessPOSIX PLUGIN
ProcessPOSIXLog.cpp
LINK_LIBS
- lldbCore
lldbInterpreter
LINK_COMPONENTS
Support
diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 0bd90dbf76202..1a4511a822309 100644
--- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -15,11 +15,11 @@
// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StringExtractor.h"
+#include "lldb/Utility/StructuredData.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.h b/source/Plugins/Process/Utility/DynamicRegisterInfo.h
index a30bfa1e1f16c..228acfbed4eee 100644
--- a/source/Plugins/Process/Utility/DynamicRegisterInfo.h
+++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.h
@@ -17,8 +17,8 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private.h"
class DynamicRegisterInfo {
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index bce77d7e0a324..bd73a29e08713 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -297,6 +297,14 @@ void RegisterContextLLDB::InitializeNonZerothFrame() {
return;
}
+ ExecutionContext exe_ctx(m_thread.shared_from_this());
+ Process *process = exe_ctx.GetProcessPtr();
+ // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
+ // this will strip bit zero in case we read a PC from memory or from the LR.
+ ABI *abi = process->GetABI().get();
+ if (abi)
+ pc = abi->FixCodeAddress(pc);
+
if (log) {
UnwindLogMsg("pc = 0x%" PRIx64, pc);
addr_t reg_val;
@@ -321,14 +329,6 @@ void RegisterContextLLDB::InitializeNonZerothFrame() {
}
}
- ExecutionContext exe_ctx(m_thread.shared_from_this());
- Process *process = exe_ctx.GetProcessPtr();
- // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
- // this will strip bit zero in case we read a PC from memory or from the LR.
- ABI *abi = process->GetABI().get();
- if (abi)
- pc = abi->FixCodeAddress(pc);
-
const bool allow_section_end = true;
m_current_pc.SetLoadAddress(pc, &process->GetTarget(), allow_section_end);
@@ -2054,11 +2054,6 @@ bool RegisterContextLLDB::ReadPC(addr_t &pc) {
// unwind past that frame to help
// find the bug.
- if (m_all_registers_available == false && above_trap_handler == false &&
- (pc == 0 || pc == 1)) {
- return false;
- }
-
ProcessSP process_sp (m_thread.GetProcess());
if (process_sp)
{
@@ -2066,6 +2061,12 @@ bool RegisterContextLLDB::ReadPC(addr_t &pc) {
if (abi)
pc = abi->FixCodeAddress(pc);
}
+
+ if (m_all_registers_available == false && above_trap_handler == false &&
+ (pc == 0 || pc == 1)) {
+ return false;
+ }
+
return true;
} else {
return false;
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index 6306651da7a15..a38110faaec62 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -23,9 +23,9 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/StreamGDBRemote.h"
+#include "lldb/Utility/StructuredData.h"
#include "llvm/ADT/Optional.h"
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index d34a79453fed4..7523260c13e4a 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1250,9 +1250,9 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceRead(
lldb::user_id_t uid = LLDB_INVALID_UID;
- size_t byte_count = std::numeric_limits<size_t>::max();
+ uint64_t byte_count = std::numeric_limits<uint64_t>::max();
lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
- size_t offset = std::numeric_limits<size_t>::max();
+ uint64_t offset = std::numeric_limits<uint64_t>::max();
auto json_object = StructuredData::ParseJSON(packet.Peek());
@@ -1286,8 +1286,8 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceRead(
if (error.Fail())
return SendErrorResponse(error.GetError());
- for (size_t i = 0; i < buf.size(); ++i)
- response.PutHex8(buf[i]);
+ for (auto i : buf)
+ response.PutHex8(i);
StreamGDBRemote escaped_response;
escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 73e3732df3efa..977c34c2a69b3 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -22,7 +22,6 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Threading.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Host/Config.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Host.h"
@@ -35,6 +34,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamGDBRemote.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UriParser.h"
// Project includes
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index aeb7c742b4f44..042c96111bb3f 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -35,7 +35,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -66,6 +65,7 @@
#include "lldb/Utility/CleanUp.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
// Project includes
#include "GDBRemoteRegisterContext.h"
@@ -599,7 +599,7 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
// gets called in DidAttach, when the target architecture (and
// consequently the ABI we'll get from
// the process) may be wrong.
- ABISP abi_to_use = ABI::FindPlugin(arch_to_use);
+ ABISP abi_to_use = ABI::FindPlugin(shared_from_this(), arch_to_use);
AugmentRegisterInfoViaABI(reg_info, reg_name, abi_to_use);
@@ -4419,7 +4419,7 @@ bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
// that context we haven't
// set the Target's architecture yet, so the ABI is also potentially
// incorrect.
- ABISP abi_to_use_sp = ABI::FindPlugin(arch_to_use);
+ ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), arch_to_use);
if (feature_node) {
ParseRegisters(feature_node, target_info, this->m_register_info,
abi_to_use_sp, cur_reg_num, reg_offset);
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index d7a4e961b5406..54a472d7332e0 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -24,7 +24,6 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/LoadedModuleInfoList.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Core/ThreadSafeValue.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Target/Process.h"
@@ -35,6 +34,7 @@
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringExtractor.h"
#include "lldb/Utility/StringList.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-private-forward.h"
#include "GDBRemoteCommunicationClient.h"
diff --git a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
index 27caf42fc4a5f..1a5b60aea2887 100644
--- a/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
+++ b/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
@@ -16,9 +16,9 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/StructuredData.h"
class StringExtractor;
diff --git a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index e613e3d6aa6c7..beeb647823676 100644
--- a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -21,10 +21,10 @@
// Project includes
#include "lldb/Utility/Flags.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Host/File.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-defines.h"
#include "llvm/ADT/ArrayRef.h"
diff --git a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index d6d695fc2e746..b7fbd7347d086 100644
--- a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -33,7 +33,6 @@
#include "lldb/Core/Communication.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -44,6 +43,7 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Utility/Timer.h"
#if defined(_WIN32)
#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index fc97a76de59b5..79b2acc4b4f38 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -13,13 +13,13 @@
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFDIECollection.h"
#include "DWARFDebugAbbrev.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index e923225f1d989..13c2d8726821d 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -14,9 +14,9 @@
#include <algorithm>
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugInfo.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 67d8828c45167..694d34fc211cc 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -14,9 +14,9 @@
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#include "LogChannelDWARF.h"
#include "SymbolFileDWARF.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
index 04bc2f4970757..766899c497b02 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
@@ -9,8 +9,8 @@
#include "DWARFDebugPubnames.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFCompileUnit.h"
#include "DWARFDIECollection.h"
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 252a9807a3b5f..ef18c2b5d3bab 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -21,10 +21,10 @@
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index ad009a02a2aa2..eabff86a54287 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -22,12 +22,12 @@
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
//#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
#if defined(DEBUG_OSO_DMAP)
#include "lldb/Core/StreamFile.h"
#endif
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 094e48cf00e18..dbc1b9ee54705 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -10,7 +10,6 @@
#include "SymbolFileSymtab.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -19,6 +18,7 @@
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index 5a377d7b04f7c..f952696ab21dd 100644
--- a/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -15,11 +15,11 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 5a79cb30eb813..6d6abd62dad2a 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -15,12 +15,12 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Host/XML.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h b/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
index 56212b94521a4..2dc5740da9b6b 100644
--- a/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
+++ b/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
@@ -19,12 +19,12 @@
// Other libraries and framework include
// Project includes
#include "lldb/Core/ModuleList.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/UUID.h"
#include "AppleGetItemInfoHandler.h"
diff --git a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
index 9aad2e1e70e2a..9d79a411faad5 100644
--- a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
+++ b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
@@ -452,6 +452,33 @@ bool x86AssemblyInspectionEngine::lea_rsp_pattern_p(int &amount) {
return false;
}
+// lea -0x28(%ebp), %esp
+// (32-bit and 64-bit variants, 8-bit and 32-bit displacement)
+bool x86AssemblyInspectionEngine::lea_rbp_rsp_pattern_p(int &amount) {
+ uint8_t *p = m_cur_insn;
+ if (m_wordsize == 8 && *p == 0x48)
+ p++;
+
+ // Check opcode
+ if (*p != 0x8d)
+ return false;
+ ++p;
+
+ // 8 bit displacement
+ if (*p == 0x65) {
+ amount = (int8_t)p[1];
+ return true;
+ }
+
+ // 32 bit displacement
+ if (*p == 0xa5) {
+ amount = (int32_t)extract_4(p + 1);
+ return true;
+ }
+
+ return false;
+}
+
// popq %rbx
// popl %ebx
bool x86AssemblyInspectionEngine::pop_reg_p(int &regno) {
@@ -843,6 +870,12 @@ bool x86AssemblyInspectionEngine::GetNonCallSiteUnwindPlanFromAssembly(
in_epilogue = true;
}
+ else if (lea_rbp_rsp_pattern_p(stack_offset) &&
+ row->GetCFAValue().GetRegisterNumber() == m_lldb_fp_regnum) {
+ current_sp_bytes_offset_from_cfa =
+ row->GetCFAValue().GetOffset() - stack_offset;
+ }
+
else if (ret_pattern_p() && prologue_completed_row.get()) {
// Reinstate the saved prologue setup for any instructions
// that come after the ret instruction
diff --git a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
index 1c84c89aee833..2e7875966cb6c 100644
--- a/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
+++ b/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
@@ -102,6 +102,7 @@ private:
bool sub_rsp_pattern_p(int &amount);
bool add_rsp_pattern_p(int &amount);
bool lea_rsp_pattern_p(int &amount);
+ bool lea_rbp_rsp_pattern_p(int &amount);
bool push_reg_p(int &regno);
bool pop_reg_p(int &regno);
bool pop_rbp_pattern_p();
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index 015ecd856aa84..9b1f8c694ccfe 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -14,7 +14,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
@@ -23,6 +22,7 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
@@ -151,17 +151,8 @@ GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr,
}
DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile &objfile,
- SectionSP &section_sp,
- lldb::RegisterKind reg_kind,
- bool is_eh_frame)
- : m_objfile(objfile), m_section_sp(section_sp),
- m_reg_kind(reg_kind), // The flavor of registers that the CFI data uses
- // (enum RegisterKind)
- m_flags(), m_cie_map(), m_cfi_data(), m_cfi_data_initialized(false),
- m_fde_index(), m_fde_index_initialized(false),
- m_is_eh_frame(is_eh_frame) {}
-
-DWARFCallFrameInfo::~DWARFCallFrameInfo() {}
+ SectionSP &section_sp, Type type)
+ : m_objfile(objfile), m_section_sp(section_sp), m_type(type) {}
bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) {
FDEEntryMap::Entry fde_entry;
@@ -268,14 +259,20 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
cie_id = m_cfi_data.GetU32(&offset);
end_offset = cie_offset + length + 4;
}
- if (length > 0 && ((!m_is_eh_frame && cie_id == UINT32_MAX) ||
- (m_is_eh_frame && cie_id == 0ul))) {
+ if (length > 0 && ((m_type == DWARF && cie_id == UINT32_MAX) ||
+ (m_type == EH && cie_id == 0ul))) {
size_t i;
// cie.offset = cie_offset;
// cie.length = length;
// cie.cieID = cieID;
cie_sp->ptr_encoding = DW_EH_PE_absptr; // default
cie_sp->version = m_cfi_data.GetU8(&offset);
+ if (cie_sp->version > CFI_VERSION4) {
+ Host::SystemLog(Host::eSystemLogError,
+ "CIE parse error: CFI version %d is not supported\n",
+ cie_sp->version);
+ return nullptr;
+ }
for (i = 0; i < CFI_AUG_MAX_SIZE; ++i) {
cie_sp->augmentation[i] = m_cfi_data.GetU8(&offset);
@@ -294,11 +291,23 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
"CIE parse error: CIE augmentation string was too large "
"for the fixed sized buffer of %d bytes.\n",
CFI_AUG_MAX_SIZE);
- return cie_sp;
+ return nullptr;
}
+
+ // m_cfi_data uses address size from target architecture of the process
+ // may ignore these fields?
+ if (m_type == DWARF && cie_sp->version >= CFI_VERSION4) {
+ cie_sp->address_size = m_cfi_data.GetU8(&offset);
+ cie_sp->segment_size = m_cfi_data.GetU8(&offset);
+ }
+
cie_sp->code_align = (uint32_t)m_cfi_data.GetULEB128(&offset);
cie_sp->data_align = (int32_t)m_cfi_data.GetSLEB128(&offset);
- cie_sp->return_addr_reg_num = m_cfi_data.GetU8(&offset);
+
+ cie_sp->return_addr_reg_num =
+ m_type == DWARF && cie_sp->version >= CFI_VERSION3
+ ? static_cast<uint32_t>(m_cfi_data.GetULEB128(&offset))
+ : m_cfi_data.GetU8(&offset);
if (cie_sp->augmentation[0]) {
// Get the length of the eh_frame augmentation data
@@ -461,11 +470,33 @@ void DWARFCallFrameInfo::GetFDEIndex() {
m_fde_index_initialized = true;
return;
}
+
+ // An FDE entry contains CIE_pointer in debug_frame in same place as cie_id
+ // in eh_frame. CIE_pointer is an offset into the .debug_frame section.
+ // So, variable cie_offset should be equal to cie_id for debug_frame.
+ // FDE entries with cie_id == 0 shouldn't be ignored for it.
+ if ((cie_id == 0 && m_type == EH) || cie_id == UINT32_MAX || len == 0) {
+ auto cie_sp = ParseCIE(current_entry);
+ if (!cie_sp) {
+ // Cannot parse, the reason is already logged
+ m_fde_index.Clear();
+ m_fde_index_initialized = true;
+ return;
+ }
+
+ m_cie_map[current_entry] = std::move(cie_sp);
+ offset = next_entry;
+ continue;
+ }
+
+ if (m_type == DWARF)
+ cie_offset = cie_id;
+
if (cie_offset > m_cfi_data.GetByteSize()) {
- Host::SystemLog(
- Host::eSystemLogError,
- "error: Invalid cie offset of 0x%x found in cie/fde at 0x%x\n",
- cie_offset, current_entry);
+ Host::SystemLog(Host::eSystemLogError,
+ "error: Invalid cie offset of 0x%x "
+ "found in cie/fde at 0x%x\n",
+ cie_offset, current_entry);
// Don't trust anything in this eh_frame section if we find blatantly
// invalid data.
m_fde_index.Clear();
@@ -473,12 +504,6 @@ void DWARFCallFrameInfo::GetFDEIndex() {
return;
}
- if (cie_id == 0 || cie_id == UINT32_MAX || len == 0) {
- m_cie_map[current_entry] = ParseCIE(current_entry);
- offset = next_entry;
- continue;
- }
-
const CIE *cie = GetCIE(cie_offset);
if (cie) {
const lldb::addr_t pc_rel_addr = m_section_sp->GetFileAddress();
@@ -531,12 +556,13 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
cie_offset = m_cfi_data.GetU32(&offset);
}
- assert(cie_offset != 0 && cie_offset != UINT32_MAX);
+ // FDE entries with zeroth cie_offset may occur for debug_frame.
+ assert(!(m_type == EH && 0 == cie_offset) && cie_offset != UINT32_MAX);
// Translate the CIE_id from the eh_frame format, which
// is relative to the FDE offset, into a __eh_frame section
// offset
- if (m_is_eh_frame) {
+ if (m_type == EH) {
unwind_plan.SetSourceName("eh_frame CFI");
cie_offset = current_entry + (is_64bit ? 12 : 4) - cie_offset;
unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
@@ -611,7 +637,7 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
*cie_initial_row = cie->initial_row;
UnwindPlan::RowSP row(cie_initial_row);
- unwind_plan.SetRegisterKind(m_reg_kind);
+ unwind_plan.SetRegisterKind(GetRegisterKind());
unwind_plan.SetReturnAddressRegister(cie->return_addr_reg_num);
std::vector<UnwindPlan::RowSP> stack;
diff --git a/source/Symbol/FuncUnwinders.cpp b/source/Symbol/FuncUnwinders.cpp
index 3b94e250dac73..b9f50cd1b12f0 100644
--- a/source/Symbol/FuncUnwinders.cpp
+++ b/source/Symbol/FuncUnwinders.cpp
@@ -39,7 +39,9 @@ FuncUnwinders::FuncUnwinders(UnwindTable &unwind_table, AddressRange range)
m_unwind_plan_arch_default_sp(),
m_unwind_plan_arch_default_at_func_entry_sp(),
m_tried_unwind_plan_assembly(false), m_tried_unwind_plan_eh_frame(false),
+ m_tried_unwind_plan_debug_frame(false),
m_tried_unwind_plan_eh_frame_augmented(false),
+ m_tried_unwind_plan_debug_frame_augmented(false),
m_tried_unwind_plan_compact_unwind(false),
m_tried_unwind_plan_arm_unwind(false), m_tried_unwind_fast(false),
m_tried_unwind_arch_default(false),
@@ -56,17 +58,14 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtCallSite(Target &target,
int current_offset) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
-
- unwind_plan_sp = GetCompactUnwindUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
-
- unwind_plan_sp = GetArmUnwindUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
+ if (UnwindPlanSP plan_sp = GetEHFrameUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetDebugFrameUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetCompactUnwindUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetArmUnwindUnwindPlan(target, current_offset))
+ return plan_sp;
return nullptr;
}
@@ -121,6 +120,29 @@ UnwindPlanSP FuncUnwinders::GetEHFrameUnwindPlan(Target &target,
return m_unwind_plan_eh_frame_sp;
}
+UnwindPlanSP FuncUnwinders::GetDebugFrameUnwindPlan(Target &target,
+ int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (m_unwind_plan_debug_frame_sp || m_tried_unwind_plan_debug_frame)
+ return m_unwind_plan_debug_frame_sp;
+
+ m_tried_unwind_plan_debug_frame = true;
+ if (m_range.GetBaseAddress().IsValid()) {
+ Address current_pc(m_range.GetBaseAddress());
+ if (current_offset != -1)
+ current_pc.SetOffset(current_pc.GetOffset() + current_offset);
+ DWARFCallFrameInfo *debug_frame = m_unwind_table.GetDebugFrameInfo();
+ if (debug_frame) {
+ m_unwind_plan_debug_frame_sp.reset(
+ new UnwindPlan(lldb::eRegisterKindGeneric));
+ if (!debug_frame->GetUnwindPlan(current_pc,
+ *m_unwind_plan_debug_frame_sp))
+ m_unwind_plan_debug_frame_sp.reset();
+ }
+ }
+ return m_unwind_plan_debug_frame_sp;
+}
+
UnwindPlanSP FuncUnwinders::GetArmUnwindUnwindPlan(Target &target,
int current_offset) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -187,6 +209,48 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
return m_unwind_plan_eh_frame_augmented_sp;
}
+UnwindPlanSP
+FuncUnwinders::GetDebugFrameAugmentedUnwindPlan(Target &target, Thread &thread,
+ int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (m_unwind_plan_debug_frame_augmented_sp.get() ||
+ m_tried_unwind_plan_debug_frame_augmented)
+ return m_unwind_plan_debug_frame_augmented_sp;
+
+ // Only supported on x86 architectures where we get debug_frame from the
+ // compiler that describes the prologue instructions perfectly, and sometimes
+ // the epilogue instructions too.
+ if (target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_32_i386 &&
+ target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64 &&
+ target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64h) {
+ m_tried_unwind_plan_debug_frame_augmented = true;
+ return m_unwind_plan_debug_frame_augmented_sp;
+ }
+
+ m_tried_unwind_plan_debug_frame_augmented = true;
+
+ UnwindPlanSP debug_frame_plan =
+ GetDebugFrameUnwindPlan(target, current_offset);
+ if (!debug_frame_plan)
+ return m_unwind_plan_debug_frame_augmented_sp;
+
+ m_unwind_plan_debug_frame_augmented_sp.reset(
+ new UnwindPlan(*debug_frame_plan));
+
+ // Augment the debug_frame instructions with epilogue descriptions if
+ // necessary so the UnwindPlan can be used at any instruction in the function.
+
+ UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
+ if (assembly_profiler_sp) {
+ if (!assembly_profiler_sp->AugmentUnwindPlanFromCallSite(
+ m_range, thread, *m_unwind_plan_debug_frame_augmented_sp)) {
+ m_unwind_plan_debug_frame_augmented_sp.reset();
+ }
+ } else
+ m_unwind_plan_debug_frame_augmented_sp.reset();
+ return m_unwind_plan_debug_frame_augmented_sp;
+}
+
UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target,
Thread &thread,
int current_offset) {
@@ -248,6 +312,8 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
Thread &thread,
int current_offset) {
UnwindPlanSP eh_frame_sp = GetEHFrameUnwindPlan(target, current_offset);
+ if (!eh_frame_sp)
+ eh_frame_sp = GetDebugFrameUnwindPlan(target, current_offset);
UnwindPlanSP arch_default_at_entry_sp =
GetUnwindPlanArchitectureDefaultAtFunctionEntry(thread);
UnwindPlanSP arch_default_sp = GetUnwindPlanArchitectureDefault(thread);
@@ -255,28 +321,22 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
GetAssemblyUnwindPlan(target, thread, current_offset);
// This point of this code is to detect when a function is using a
- // non-standard ABI, and the eh_frame
- // correctly describes that alternate ABI. This is addressing a specific
- // situation on x86_64 linux
- // systems where one function in a library pushes a value on the stack and
- // jumps to another function.
- // So using an assembly instruction based unwind will not work when you're in
- // the second function -
- // the stack has been modified in a non-ABI way. But we have eh_frame that
- // correctly describes how to
- // unwind from this location. So we're looking to see if the initial pc
- // register save location from
- // the eh_frame is different from the assembly unwind, the arch default
- // unwind, and the arch default at
- // initial function entry.
+ // non-standard ABI, and the eh_frame correctly describes that alternate ABI.
+ // This is addressing a specific situation on x86_64 linux systems where one
+ // function in a library pushes a value on the stack and jumps to another
+ // function. So using an assembly instruction based unwind will not work when
+ // you're in the second function - the stack has been modified in a non-ABI
+ // way. But we have eh_frame that correctly describes how to unwind from this
+ // location. So we're looking to see if the initial pc register save location
+ // from the eh_frame is different from the assembly unwind, the arch default
+ // unwind, and the arch default at initial function entry.
//
// We may have eh_frame that describes the entire function -- or we may have
- // eh_frame that only describes
- // the unwind after the prologue has executed -- so we need to check both the
- // arch default (once the prologue
- // has executed) and the arch default at initial function entry. And we may
- // be running on a target where
- // we have only some of the assembly/arch default unwind plans available.
+ // eh_frame that only describes the unwind after the prologue has executed --
+ // so we need to check both the arch default (once the prologue has executed)
+ // and the arch default at initial function entry. And we may be running on a
+ // target where we have only some of the assembly/arch default unwind plans
+ // available.
if (CompareUnwindPlansForIdenticalInitialPCLocation(
thread, eh_frame_sp, arch_default_at_entry_sp) == eLazyBoolNo &&
@@ -287,11 +347,12 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
return eh_frame_sp;
}
- UnwindPlanSP eh_frame_augmented_sp =
- GetEHFrameAugmentedUnwindPlan(target, thread, current_offset);
- if (eh_frame_augmented_sp) {
- return eh_frame_augmented_sp;
- }
+ if (UnwindPlanSP plan_sp =
+ GetEHFrameAugmentedUnwindPlan(target, thread, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp =
+ GetDebugFrameAugmentedUnwindPlan(target, thread, current_offset))
+ return plan_sp;
return assembly_sp;
}
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index c970de6fef063..fd4180862c15b 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -13,7 +13,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Target/Process.h"
@@ -25,6 +24,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private.h"
using namespace lldb;
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 3eec3e7061850..3e2c965509d3c 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -13,15 +13,15 @@
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Section.h"
#include "lldb/Core/STLUtils.h"
-#include "lldb/Core/Timer.h"
+#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/UnwindTable.cpp b/source/Symbol/UnwindTable.cpp
index 336f0c3e04a77..405d57754ea56 100644
--- a/source/Symbol/UnwindTable.cpp
+++ b/source/Symbol/UnwindTable.cpp
@@ -44,38 +44,64 @@ void UnwindTable::Initialize() {
if (m_initialized) // check again once we've acquired the lock
return;
+ m_initialized = true;
SectionList *sl = m_object_file.GetSectionList();
- if (sl) {
- SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
- if (sect.get()) {
- m_eh_frame_up.reset(new DWARFCallFrameInfo(m_object_file, sect,
- eRegisterKindEHFrame, true));
- }
- sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
- if (sect.get()) {
- m_compact_unwind_up.reset(new CompactUnwindInfo(m_object_file, sect));
- }
- sect = sl->FindSectionByType(eSectionTypeARMexidx, true);
- if (sect.get()) {
- SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true);
- if (sect_extab.get()) {
- m_arm_unwind_up.reset(
- new ArmUnwindInfo(m_object_file, sect, sect_extab));
- }
- }
+ if (!sl)
+ return;
+
+ SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
+ if (sect.get()) {
+ m_eh_frame_up.reset(
+ new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::EH));
}
- m_initialized = true;
+ sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true);
+ if (sect) {
+ m_debug_frame_up.reset(
+ new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::DWARF));
+ }
+
+ sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
+ if (sect) {
+ m_compact_unwind_up.reset(new CompactUnwindInfo(m_object_file, sect));
+ }
+
+ sect = sl->FindSectionByType(eSectionTypeARMexidx, true);
+ if (sect) {
+ SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true);
+ if (sect_extab.get()) {
+ m_arm_unwind_up.reset(new ArmUnwindInfo(m_object_file, sect, sect_extab));
+ }
+ }
}
UnwindTable::~UnwindTable() {}
+llvm::Optional<AddressRange> UnwindTable::GetAddressRange(const Address &addr,
+ SymbolContext &sc) {
+ AddressRange range;
+
+ // First check the symbol context
+ if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
+ false, range) &&
+ range.GetBaseAddress().IsValid())
+ return range;
+
+ // Does the eh_frame unwind info has a function bounds for this addr?
+ if (m_eh_frame_up && m_eh_frame_up->GetAddressRange(addr, range))
+ return range;
+
+ // Try debug_frame as well
+ if (m_debug_frame_up && m_debug_frame_up->GetAddressRange(addr, range))
+ return range;
+
+ return llvm::None;
+}
+
FuncUnwindersSP
UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
SymbolContext &sc) {
- FuncUnwindersSP no_unwind_found;
-
Initialize();
std::lock_guard<std::mutex> guard(m_mutex);
@@ -96,23 +122,14 @@ UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
return pos->second;
}
- AddressRange range;
- if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) ||
- !range.GetBaseAddress().IsValid()) {
- // Does the eh_frame unwind info has a function bounds for this addr?
- if (m_eh_frame_up == nullptr ||
- !m_eh_frame_up->GetAddressRange(addr, range)) {
- return no_unwind_found;
- }
- }
+ auto range_or = GetAddressRange(addr, sc);
+ if (!range_or)
+ return nullptr;
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
+ FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, *range_or));
m_unwinds.insert(insert_pos,
- std::make_pair(range.GetBaseAddress().GetFileAddress(),
+ std::make_pair(range_or->GetBaseAddress().GetFileAddress(),
func_unwinder_sp));
- // StreamFile s(stdout, false);
- // Dump (s);
return func_unwinder_sp;
}
@@ -121,26 +138,16 @@ UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
// UnwindTable. This is intended for use by target modules show-unwind where we
// want to create
// new UnwindPlans, not re-use existing ones.
-
FuncUnwindersSP
UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr,
SymbolContext &sc) {
- FuncUnwindersSP no_unwind_found;
Initialize();
- AddressRange range;
- if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) ||
- !range.GetBaseAddress().IsValid()) {
- // Does the eh_frame unwind info has a function bounds for this addr?
- if (m_eh_frame_up == nullptr ||
- !m_eh_frame_up->GetAddressRange(addr, range)) {
- return no_unwind_found;
- }
- }
+ auto range_or = GetAddressRange(addr, sc);
+ if (!range_or)
+ return nullptr;
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
- return func_unwinder_sp;
+ return std::make_shared<FuncUnwinders>(*this, *range_or);
}
void UnwindTable::Dump(Stream &s) {
@@ -161,6 +168,11 @@ DWARFCallFrameInfo *UnwindTable::GetEHFrameInfo() {
return m_eh_frame_up.get();
}
+DWARFCallFrameInfo *UnwindTable::GetDebugFrameInfo() {
+ Initialize();
+ return m_debug_frame_up.get();
+}
+
CompactUnwindInfo *UnwindTable::GetCompactUnwindInfo() {
Initialize();
return m_compact_unwind_up.get();
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index fd19a09949663..ff32aa7314657 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -160,7 +160,7 @@ void Variable::Dump(Stream *s, bool show_context) const {
if (m_owner_scope) {
ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
if (module_sp)
- abi = ABI::FindPlugin(module_sp->GetArchitecture()).get();
+ abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get();
}
m_location.GetDescription(s, lldb::eDescriptionLevelBrief,
loclist_base_addr, abi);
@@ -471,7 +471,7 @@ bool Variable::DumpLocationForAddress(Stream *s, const Address &address) {
if (m_owner_scope) {
ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
if (module_sp)
- abi = ABI::FindPlugin(module_sp->GetArchitecture()).get();
+ abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get();
}
const addr_t file_addr = address.GetFileAddress();
diff --git a/source/Target/ABI.cpp b/source/Target/ABI.cpp
index 87363a3b8aeb8..72f58be5a3d4f 100644
--- a/source/Target/ABI.cpp
+++ b/source/Target/ABI.cpp
@@ -25,7 +25,7 @@ using namespace lldb;
using namespace lldb_private;
ABISP
-ABI::FindPlugin(const ArchSpec &arch) {
+ABI::FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch) {
ABISP abi_sp;
ABICreateInstance create_callback;
@@ -33,7 +33,7 @@ ABI::FindPlugin(const ArchSpec &arch) {
(create_callback = PluginManager::GetABICreateCallbackAtIndex(idx)) !=
nullptr;
++idx) {
- abi_sp = create_callback(arch);
+ abi_sp = create_callback(process_sp, arch);
if (abi_sp)
return abi_sp;
@@ -42,8 +42,6 @@ ABI::FindPlugin(const ArchSpec &arch) {
return abi_sp;
}
-ABI::ABI() = default;
-
ABI::~ABI() = default;
bool ABI::GetRegisterInfoByName(const ConstString &name, RegisterInfo &info) {
diff --git a/source/Target/ObjCLanguageRuntime.cpp b/source/Target/ObjCLanguageRuntime.cpp
index 165c75a0952b3..d3cc7c019dcee 100644
--- a/source/Target/ObjCLanguageRuntime.cpp
+++ b/source/Target/ObjCLanguageRuntime.cpp
@@ -11,7 +11,6 @@
#include "lldb/Core/MappedHash.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -21,6 +20,7 @@
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/StringRef.h"
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index cfd971e9de62f..498facf8e0d02 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -25,7 +25,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
@@ -42,6 +41,7 @@
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
#include "llvm/Support/FileSystem.h"
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index c6ad536cee10d..6cbe289ef26be 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -1735,7 +1735,7 @@ addr_t Process::GetImageInfoAddress() { return LLDB_INVALID_ADDRESS; }
const lldb::ABISP &Process::GetABI() {
if (!m_abi_sp)
- m_abi_sp = ABI::FindPlugin(GetTarget().GetArchitecture());
+ m_abi_sp = ABI::FindPlugin(shared_from_this(), GetTarget().GetArchitecture());
return m_abi_sp;
}
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 5c46a024be60f..4632ada26ed30 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -30,7 +30,6 @@
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/REPL.h"
#include "lldb/Expression/UserExpression.h"
@@ -58,6 +57,7 @@
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp
index 43e1227ba205f..5c652aced39f4 100644
--- a/source/Target/TargetList.cpp
+++ b/source/Target/TargetList.cpp
@@ -15,7 +15,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -24,6 +23,7 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/TildeExpressionResolver.h"
+#include "lldb/Utility/Timer.h"
// Other libraries and framework includes
#include "llvm/ADT/SmallString.h"
diff --git a/source/Target/ThreadSpec.cpp b/source/Target/ThreadSpec.cpp
index f769d1a775af5..444a5a5b262aa 100644
--- a/source/Target/ThreadSpec.cpp
+++ b/source/Target/ThreadSpec.cpp
@@ -11,9 +11,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Target/Thread.h"
-#include "lldb/Core/StructuredData.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/StructuredData.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Utility/CMakeLists.txt b/source/Utility/CMakeLists.txt
index 31b14acda9629..78598562692bb 100644
--- a/source/Utility/CMakeLists.txt
+++ b/source/Utility/CMakeLists.txt
@@ -1,5 +1,6 @@
add_lldb_library(lldbUtility
Baton.cpp
+ Connection.cpp
ConstString.cpp
DataBufferHeap.cpp
DataBufferLLVM.cpp
@@ -8,6 +9,7 @@ add_lldb_library(lldbUtility
FastDemangle.cpp
FileSpec.cpp
History.cpp
+ IOObject.cpp
JSON.cpp
LLDBAssert.cpp
Log.cpp
@@ -26,8 +28,10 @@ add_lldb_library(lldbUtility
StringExtractorGDBRemote.cpp
StringLexer.cpp
StringList.cpp
+ StructuredData.cpp
TaskPool.cpp
TildeExpressionResolver.cpp
+ Timer.cpp
UserID.cpp
UriParser.cpp
UUID.cpp
diff --git a/source/Utility/Connection.cpp b/source/Utility/Connection.cpp
new file mode 100644
index 0000000000000..9f6114f6ed5de
--- /dev/null
+++ b/source/Utility/Connection.cpp
@@ -0,0 +1,14 @@
+//===-- Connection.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Utility/Connection.h"
+
+using namespace lldb_private;
+
+Connection::~Connection() = default;
diff --git a/source/Host/common/IOObject.cpp b/source/Utility/IOObject.cpp
index 6f7de442be1dd..df7929c4f9110 100644
--- a/source/Host/common/IOObject.cpp
+++ b/source/Utility/IOObject.cpp
@@ -7,8 +7,9 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Host/IOObject.h"
+#include "lldb/Utility/IOObject.h"
using namespace lldb_private;
const IOObject::WaitableHandle IOObject::kInvalidHandleValue = -1;
+IOObject::~IOObject() = default;
diff --git a/source/Utility/JSON.cpp b/source/Utility/JSON.cpp
index cb23f140cbfe0..1520bc7c47ec7 100644
--- a/source/Utility/JSON.cpp
+++ b/source/Utility/JSON.cpp
@@ -191,7 +191,7 @@ JSONValue::SP JSONArray::GetObject(Index i) {
JSONArray::Size JSONArray::GetNumElements() { return m_elements.size(); }
-JSONParser::JSONParser(const char *cstr) : StringExtractor(cstr) {}
+JSONParser::JSONParser(llvm::StringRef data) : StringExtractor(data) {}
JSONParser::Token JSONParser::GetToken(std::string &value) {
StreamString error;
diff --git a/source/Core/StructuredData.cpp b/source/Utility/StructuredData.cpp
index b03665ed3485d..9fc05354cfd3f 100644
--- a/source/Core/StructuredData.cpp
+++ b/source/Utility/StructuredData.cpp
@@ -7,28 +7,18 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/StructuredData.h"
-
-#include "lldb/Host/File.h"
-#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/StructuredData.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/JSON.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StreamString.h"
-#include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermiss...
-#include "lldb/lldb-forward.h" // for DataBufferSP
-
#include "llvm/ADT/STLExtras.h" // for make_unique
-
-#include <limits> // for numeric_limits
-
-#include <errno.h>
+#include <cerrno>
+#include <cstdlib>
#include <inttypes.h>
-#include <stdio.h> // for printf
-#include <stdlib.h>
-#include <sys/types.h> // for off_t
+#include <limits> // for numeric_limits
using namespace lldb_private;
@@ -43,36 +33,20 @@ StructuredData::ObjectSP
StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) {
StructuredData::ObjectSP return_sp;
if (!input_spec.Exists()) {
- error.SetErrorStringWithFormat("input file %s does not exist.",
- input_spec.GetPath().c_str());
+ error.SetErrorStringWithFormatv("input file {0} does not exist.",
+ input_spec);
return return_sp;
}
- File input_file(nullptr, File::OpenOptions::eOpenOptionRead,
- lldb::eFilePermissionsUserRead);
- std::string input_path = input_spec.GetPath();
- error =
- input_file.Open(input_path.c_str(), File::OpenOptions::eOpenOptionRead,
- lldb::eFilePermissionsUserRead);
-
- if (!error.Success()) {
- error.SetErrorStringWithFormat("could not open input file: %s - %s.",
- input_spec.GetPath().c_str(),
- error.AsCString());
+ auto buffer_or_error = llvm::MemoryBuffer::getFile(input_spec.GetPath());
+ if (!buffer_or_error) {
+ error.SetErrorStringWithFormatv("could not open input file: {0} - {1}.",
+ input_spec.GetPath(),
+ buffer_or_error.getError().message());
return return_sp;
}
- lldb::DataBufferSP input_data;
- size_t num_bytes = std::numeric_limits<size_t>::max();
- off_t offset = 0;
- error = input_file.Read(num_bytes, offset, true, input_data);
- if (!error.Success()) {
- error.SetErrorStringWithFormat("could not read input file: %s - %s.",
- input_spec.GetPath().c_str(),
- error.AsCString());
- return return_sp;
- }
- JSONParser json_parser((char *)input_data->GetBytes());
+ JSONParser json_parser(buffer_or_error.get()->getBuffer());
return_sp = ParseJSONValue(json_parser);
return return_sp;
}
@@ -146,16 +120,14 @@ static StructuredData::ObjectSP ParseJSONValue(JSONParser &json_parser) {
return ParseJSONArray(json_parser);
case JSONParser::Token::Integer: {
- bool success = false;
- uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success);
- if (success)
+ uint64_t uval;
+ if (llvm::to_integer(value, uval, 0))
return std::make_shared<StructuredData::Integer>(uval);
} break;
case JSONParser::Token::Float: {
- bool success = false;
- double val = StringConvert::ToDouble(value.c_str(), 0.0, &success);
- if (success)
+ double val;
+ if (llvm::to_float(value, val))
return std::make_shared<StructuredData::Float>(val);
} break;
@@ -219,7 +191,7 @@ StructuredData::Object::GetObjectForDotSeparatedPath(llvm::StringRef path) {
void StructuredData::Object::DumpToStdout(bool pretty_print) const {
StreamString stream;
Dump(stream, pretty_print);
- printf("%s\n", stream.GetData());
+ llvm::outs() << stream.GetString();
}
void StructuredData::Array::Dump(Stream &s, bool pretty_print) const {
diff --git a/source/Core/Timer.cpp b/source/Utility/Timer.cpp
index 59c3e13a717e0..fe7787458fa6d 100644
--- a/source/Core/Timer.cpp
+++ b/source/Utility/Timer.cpp
@@ -6,11 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/Timer.h"
-
-#include "lldb/Host/Host.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/Stream.h"
-#include "lldb/lldb-types.h" // for thread_key_t
#include <algorithm>
#include <map>