aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/API')
-rw-r--r--contrib/llvm-project/lldb/source/API/SBBreakpoint.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBBreakpointLocation.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBBreakpointOptionCommon.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBCommandInterpreter.cpp10
-rw-r--r--contrib/llvm-project/lldb/source/API/SBDebugger.cpp10
-rw-r--r--contrib/llvm-project/lldb/source/API/SBEvent.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBFormat.cpp44
-rw-r--r--contrib/llvm-project/lldb/source/API/SBFrame.cpp36
-rw-r--r--contrib/llvm-project/lldb/source/API/SBHostOS.cpp46
-rw-r--r--contrib/llvm-project/lldb/source/API/SBInstruction.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/API/SBInstructionList.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/API/SBModule.cpp54
-rw-r--r--contrib/llvm-project/lldb/source/API/SBPlatform.cpp40
-rw-r--r--contrib/llvm-project/lldb/source/API/SBProcess.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/API/SBProcessInfoList.cpp74
-rw-r--r--contrib/llvm-project/lldb/source/API/SBSourceManager.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBStream.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/API/SBTarget.cpp134
-rw-r--r--contrib/llvm-project/lldb/source/API/SBThread.cpp40
-rw-r--r--contrib/llvm-project/lldb/source/API/SBThreadPlan.cpp1
-rw-r--r--contrib/llvm-project/lldb/source/API/SBType.cpp8
-rw-r--r--contrib/llvm-project/lldb/source/API/SBUnixSignals.cpp2
-rw-r--r--contrib/llvm-project/lldb/source/API/SBValue.cpp31
-rw-r--r--contrib/llvm-project/lldb/source/API/SBWatchpoint.cpp23
-rw-r--r--contrib/llvm-project/lldb/source/API/SBWatchpointOptions.cpp73
-rw-r--r--contrib/llvm-project/lldb/source/API/SystemInitializerFull.cpp3
26 files changed, 459 insertions, 183 deletions
diff --git a/contrib/llvm-project/lldb/source/API/SBBreakpoint.cpp b/contrib/llvm-project/lldb/source/API/SBBreakpoint.cpp
index 6631afb1483f..f1fb6f904f5f 100644
--- a/contrib/llvm-project/lldb/source/API/SBBreakpoint.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBBreakpoint.cpp
@@ -25,7 +25,6 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBBreakpointLocation.cpp b/contrib/llvm-project/lldb/source/API/SBBreakpointLocation.cpp
index 3c4aab6175c6..75b66364d4f1 100644
--- a/contrib/llvm-project/lldb/source/API/SBBreakpointLocation.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBBreakpointLocation.cpp
@@ -18,7 +18,6 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBBreakpointOptionCommon.cpp b/contrib/llvm-project/lldb/source/API/SBBreakpointOptionCommon.cpp
index 685ed172c820..1a14bce4cd24 100644
--- a/contrib/llvm-project/lldb/source/API/SBBreakpointOptionCommon.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBBreakpointOptionCommon.cpp
@@ -19,7 +19,6 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/Process.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBCommandInterpreter.cpp b/contrib/llvm-project/lldb/source/API/SBCommandInterpreter.cpp
index 396c0eef0603..c3cbb00145ed 100644
--- a/contrib/llvm-project/lldb/source/API/SBCommandInterpreter.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBCommandInterpreter.cpp
@@ -70,19 +70,21 @@ public:
}
protected:
- bool DoExecute(Args &command, CommandReturnObject &result) override {
+ void DoExecute(Args &command, CommandReturnObject &result) override {
SBCommandReturnObject sb_return(result);
SBCommandInterpreter sb_interpreter(&m_interpreter);
SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
- bool ret = m_backend->DoExecute(debugger_sb, command.GetArgumentVector(),
- sb_return);
- return ret;
+ m_backend->DoExecute(debugger_sb, command.GetArgumentVector(), sb_return);
}
std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
std::optional<std::string> m_auto_repeat_command;
};
} // namespace lldb_private
+SBCommandInterpreter::SBCommandInterpreter() : m_opaque_ptr() {
+ LLDB_INSTRUMENT_VA(this);
+}
+
SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter)
: m_opaque_ptr(interpreter) {
LLDB_INSTRUMENT_VA(this, interpreter);
diff --git a/contrib/llvm-project/lldb/source/API/SBDebugger.cpp b/contrib/llvm-project/lldb/source/API/SBDebugger.cpp
index 9cf464660648..fbcf30e67fc1 100644
--- a/contrib/llvm-project/lldb/source/API/SBDebugger.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBDebugger.cpp
@@ -39,10 +39,10 @@
#include "lldb/Core/DebuggerEvents.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Progress.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Host/Config.h"
+#include "lldb/Host/StreamFile.h"
#include "lldb/Host/XML.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -781,6 +781,9 @@ SBStructuredData SBDebugger::GetBuildConfiguration() {
AddBoolConfigEntry(
*config_up, "editline", LLDB_ENABLE_LIBEDIT,
"A boolean value that indicates if editline support is enabled in LLDB");
+ AddBoolConfigEntry(*config_up, "editline_wchar", LLDB_EDITLINE_USE_WCHAR,
+ "A boolean value that indicates if editline wide "
+ "characters support is enabled in LLDB");
AddBoolConfigEntry(
*config_up, "lzma", LLDB_ENABLE_LZMA,
"A boolean value that indicates if lzma support is enabled in LLDB");
@@ -1538,14 +1541,11 @@ bool SBDebugger::SetCurrentPlatformSDKRoot(const char *sysroot) {
bool SBDebugger::GetCloseInputOnEOF() const {
LLDB_INSTRUMENT_VA(this);
- return (m_opaque_sp ? m_opaque_sp->GetCloseInputOnEOF() : false);
+ return false;
}
void SBDebugger::SetCloseInputOnEOF(bool b) {
LLDB_INSTRUMENT_VA(this, b);
-
- if (m_opaque_sp)
- m_opaque_sp->SetCloseInputOnEOF(b);
}
SBTypeCategory SBDebugger::GetCategory(const char *category_name) {
diff --git a/contrib/llvm-project/lldb/source/API/SBEvent.cpp b/contrib/llvm-project/lldb/source/API/SBEvent.cpp
index 13ed148e7737..f12df2939420 100644
--- a/contrib/llvm-project/lldb/source/API/SBEvent.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBEvent.cpp
@@ -12,7 +12,6 @@
#include "lldb/Utility/Instrumentation.h"
#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/ConstString.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBFormat.cpp b/contrib/llvm-project/lldb/source/API/SBFormat.cpp
new file mode 100644
index 000000000000..51cddceea037
--- /dev/null
+++ b/contrib/llvm-project/lldb/source/API/SBFormat.cpp
@@ -0,0 +1,44 @@
+//===-- SBFormat.cpp ------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBFormat.h"
+#include "Utils.h"
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/lldb-types.h"
+#include <lldb/API/SBError.h>
+#include <lldb/Utility/Status.h>
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBFormat::SBFormat() : m_opaque_sp() {}
+
+SBFormat::SBFormat(const SBFormat &rhs) {
+ m_opaque_sp = clone(rhs.m_opaque_sp);
+}
+
+SBFormat::~SBFormat() = default;
+
+SBFormat &SBFormat::operator=(const SBFormat &rhs) {
+ if (this != &rhs)
+ m_opaque_sp = clone(rhs.m_opaque_sp);
+ return *this;
+}
+
+SBFormat::operator bool() const { return (bool)m_opaque_sp; }
+
+SBFormat::SBFormat(const char *format, lldb::SBError &error) {
+ FormatEntrySP format_entry_sp = std::make_shared<FormatEntity::Entry>();
+ Status status = FormatEntity::Parse(format, *format_entry_sp);
+
+ error.SetError(status);
+ if (error.Success())
+ m_opaque_sp = format_entry_sp;
+}
+
+lldb::FormatEntrySP SBFormat::GetFormatEntrySP() const { return m_opaque_sp; }
diff --git a/contrib/llvm-project/lldb/source/API/SBFrame.cpp b/contrib/llvm-project/lldb/source/API/SBFrame.cpp
index a19ce63bab15..a16bbc2ae756 100644
--- a/contrib/llvm-project/lldb/source/API/SBFrame.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBFrame.cpp
@@ -17,7 +17,6 @@
#include "Utils.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectRegister.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Core/ValueObjectConstResult.h"
@@ -46,6 +45,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFormat.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBThread.h"
@@ -948,6 +948,40 @@ SBValue SBFrame::FindRegister(const char *name) {
return result;
}
+SBError SBFrame::GetDescriptionWithFormat(const SBFormat &format,
+ SBStream &output) {
+ Stream &strm = output.ref();
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ StackFrame *frame = nullptr;
+ Target *target = exe_ctx.GetTargetPtr();
+ Process *process = exe_ctx.GetProcessPtr();
+ SBError error;
+
+ if (!format) {
+ error.SetErrorString("The provided SBFormat object is invalid");
+ return error;
+ }
+
+ if (target && process) {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process->GetRunLock())) {
+ frame = exe_ctx.GetFramePtr();
+ if (frame &&
+ frame->DumpUsingFormat(strm, format.GetFormatEntrySP().get())) {
+ return error;
+ }
+ }
+ }
+ error.SetErrorStringWithFormat(
+ "It was not possible to generate a frame "
+ "description with the given format string '%s'",
+ format.GetFormatEntrySP()->string.c_str());
+ return error;
+}
+
bool SBFrame::GetDescription(SBStream &description) {
LLDB_INSTRUMENT_VA(this, description);
diff --git a/contrib/llvm-project/lldb/source/API/SBHostOS.cpp b/contrib/llvm-project/lldb/source/API/SBHostOS.cpp
index cb026fd9203b..a77a703bba37 100644
--- a/contrib/llvm-project/lldb/source/API/SBHostOS.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBHostOS.cpp
@@ -101,61 +101,23 @@ lldb::thread_t SBHostOS::ThreadCreate(const char *name,
lldb::thread_func_t thread_function,
void *thread_arg, SBError *error_ptr) {
LLDB_INSTRUMENT_VA(name, thread_function, thread_arg, error_ptr);
- llvm::Expected<HostThread> thread =
- ThreadLauncher::LaunchThread(name, [thread_function, thread_arg] {
- return thread_function(thread_arg);
- });
- if (!thread) {
- if (error_ptr)
- error_ptr->SetError(Status(thread.takeError()));
- else
- llvm::consumeError(thread.takeError());
- return LLDB_INVALID_HOST_THREAD;
- }
-
- return thread->Release();
+ return LLDB_INVALID_HOST_THREAD;
}
void SBHostOS::ThreadCreated(const char *name) { LLDB_INSTRUMENT_VA(name); }
bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
LLDB_INSTRUMENT_VA(thread, error_ptr);
-
- Status error;
- HostThread host_thread(thread);
- error = host_thread.Cancel();
- if (error_ptr)
- error_ptr->SetError(error);
- host_thread.Release();
- return error.Success();
+ return false;
}
bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
LLDB_INSTRUMENT_VA(thread, error_ptr);
-
- Status error;
-#if defined(_WIN32)
- if (error_ptr)
- error_ptr->SetErrorString("ThreadDetach is not supported on this platform");
-#else
- HostThread host_thread(thread);
- error = host_thread.GetNativeThread().Detach();
- if (error_ptr)
- error_ptr->SetError(error);
- host_thread.Release();
-#endif
- return error.Success();
+ return false;
}
bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
SBError *error_ptr) {
LLDB_INSTRUMENT_VA(thread, result, error_ptr);
-
- Status error;
- HostThread host_thread(thread);
- error = host_thread.Join(result);
- if (error_ptr)
- error_ptr->SetError(error);
- host_thread.Release();
- return error.Success();
+ return false;
}
diff --git a/contrib/llvm-project/lldb/source/API/SBInstruction.cpp b/contrib/llvm-project/lldb/source/API/SBInstruction.cpp
index ea14e90abfd2..30703eea6fa6 100644
--- a/contrib/llvm-project/lldb/source/API/SBInstruction.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBInstruction.cpp
@@ -19,8 +19,8 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StreamFile.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBInstructionList.cpp b/contrib/llvm-project/lldb/source/API/SBInstructionList.cpp
index ae87d7965766..3f37b984cb46 100644
--- a/contrib/llvm-project/lldb/source/API/SBInstructionList.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBInstructionList.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/StreamFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Utility/Instrumentation.h"
#include "lldb/Utility/Stream.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBModule.cpp b/contrib/llvm-project/lldb/source/API/SBModule.cpp
index b865502228e0..262e26c6bf43 100644
--- a/contrib/llvm-project/lldb/source/API/SBModule.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBModule.cpp
@@ -437,26 +437,25 @@ lldb::SBType SBModule::FindFirstType(const char *name_cstr) {
LLDB_INSTRUMENT_VA(this, name_cstr);
ModuleSP module_sp(GetSP());
- if (!name_cstr || !module_sp)
- return {};
- SymbolContext sc;
- const bool exact_match = false;
- ConstString name(name_cstr);
+ if (name_cstr && module_sp) {
+ ConstString name(name_cstr);
+ TypeQuery query(name.GetStringRef(), TypeQueryOptions::e_find_one);
+ TypeResults results;
+ module_sp->FindTypes(query, results);
+ TypeSP type_sp = results.GetFirstType();
+ if (type_sp)
+ return SBType(type_sp);
- SBType sb_type = SBType(module_sp->FindFirstType(sc, name, exact_match));
-
- if (sb_type.IsValid())
- return sb_type;
+ auto type_system_or_err =
+ module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+ if (auto err = type_system_or_err.takeError()) {
+ llvm::consumeError(std::move(err));
+ return {};
+ }
- auto type_system_or_err = module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
- if (auto err = type_system_or_err.takeError()) {
- llvm::consumeError(std::move(err));
- return {};
+ if (auto ts = *type_system_or_err)
+ return SBType(ts->GetBuiltinTypeByName(name));
}
-
- if (auto ts = *type_system_or_err)
- return SBType(ts->GetBuiltinTypeByName(name));
-
return {};
}
@@ -471,7 +470,7 @@ lldb::SBType SBModule::GetBasicType(lldb::BasicType type) {
llvm::consumeError(std::move(err));
} else {
if (auto ts = *type_system_or_err)
- return SBType(ts->GetBasicTypeFromAST(type));
+ return SBType(ts->GetBasicTypeFromAST(type));
}
}
return SBType();
@@ -485,13 +484,11 @@ lldb::SBTypeList SBModule::FindTypes(const char *type) {
ModuleSP module_sp(GetSP());
if (type && module_sp) {
TypeList type_list;
- const bool exact_match = false;
- ConstString name(type);
- llvm::DenseSet<SymbolFile *> searched_symbol_files;
- module_sp->FindTypes(name, exact_match, UINT32_MAX, searched_symbol_files,
- type_list);
-
- if (type_list.Empty()) {
+ TypeQuery query(type);
+ TypeResults results;
+ module_sp->FindTypes(query, results);
+ if (results.GetTypeMap().Empty()) {
+ ConstString name(type);
auto type_system_or_err =
module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
if (auto err = type_system_or_err.takeError()) {
@@ -502,11 +499,8 @@ lldb::SBTypeList SBModule::FindTypes(const char *type) {
retval.Append(SBType(compiler_type));
}
} else {
- for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
- TypeSP type_sp(type_list.GetTypeAtIndex(idx));
- if (type_sp)
- retval.Append(SBType(type_sp));
- }
+ for (const TypeSP &type_sp : results.GetTypeMap().Types())
+ retval.Append(SBType(type_sp));
}
}
return retval;
diff --git a/contrib/llvm-project/lldb/source/API/SBPlatform.cpp b/contrib/llvm-project/lldb/source/API/SBPlatform.cpp
index f8300a5bab30..3623fd35bcdf 100644
--- a/contrib/llvm-project/lldb/source/API/SBPlatform.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBPlatform.cpp
@@ -7,12 +7,15 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEnvironment.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBModuleSpec.h"
#include "lldb/API/SBPlatform.h"
+#include "lldb/API/SBProcessInfoList.h"
+#include "lldb/API/SBTarget.h"
#include "lldb/API/SBUnixSignals.h"
#include "lldb/Host/File.h"
#include "lldb/Target/Platform.h"
@@ -574,6 +577,43 @@ SBError SBPlatform::Launch(SBLaunchInfo &launch_info) {
});
}
+SBProcess SBPlatform::Attach(SBAttachInfo &attach_info,
+ const SBDebugger &debugger, SBTarget &target,
+ SBError &error) {
+ LLDB_INSTRUMENT_VA(this, attach_info, debugger, target, error);
+
+ if (PlatformSP platform_sp = GetSP()) {
+ if (platform_sp->IsConnected()) {
+ ProcessAttachInfo &info = attach_info.ref();
+ Status status;
+ ProcessSP process_sp = platform_sp->Attach(info, debugger.ref(),
+ target.GetSP().get(), status);
+ error.SetError(status);
+ return SBProcess(process_sp);
+ }
+
+ error.SetErrorString("not connected");
+ return {};
+ }
+
+ error.SetErrorString("invalid platform");
+ return {};
+}
+
+SBProcessInfoList SBPlatform::GetAllProcesses(SBError &error) {
+ if (PlatformSP platform_sp = GetSP()) {
+ if (platform_sp->IsConnected()) {
+ ProcessInstanceInfoList list = platform_sp->GetAllProcesses();
+ return SBProcessInfoList(list);
+ }
+ error.SetErrorString("not connected");
+ return {};
+ }
+
+ error.SetErrorString("invalid platform");
+ return {};
+}
+
SBError SBPlatform::Kill(const lldb::pid_t pid) {
LLDB_INSTRUMENT_VA(this, pid);
return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
diff --git a/contrib/llvm-project/lldb/source/API/SBProcess.cpp b/contrib/llvm-project/lldb/source/API/SBProcess.cpp
index 67d08f1f02be..4864ea0e7d02 100644
--- a/contrib/llvm-project/lldb/source/API/SBProcess.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBProcess.cpp
@@ -17,8 +17,8 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Host/StreamFile.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBProcessInfoList.cpp b/contrib/llvm-project/lldb/source/API/SBProcessInfoList.cpp
new file mode 100644
index 000000000000..a711bcb58301
--- /dev/null
+++ b/contrib/llvm-project/lldb/source/API/SBProcessInfoList.cpp
@@ -0,0 +1,74 @@
+//===-- SBProcessInfoList.cpp ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBProcessInfoList.h"
+#include "lldb/API/SBProcessInfo.h"
+#include "lldb/Utility/Instrumentation.h"
+#include "lldb/Utility/ProcessInfo.h"
+
+#include "Utils.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBProcessInfoList::SBProcessInfoList() = default;
+
+SBProcessInfoList::~SBProcessInfoList() = default;
+
+SBProcessInfoList::SBProcessInfoList(const ProcessInfoList &impl)
+ : m_opaque_up(std::make_unique<ProcessInfoList>(impl)) {
+ LLDB_INSTRUMENT_VA(this, impl);
+}
+
+SBProcessInfoList::SBProcessInfoList(const lldb::SBProcessInfoList &rhs) {
+
+ LLDB_INSTRUMENT_VA(this, rhs);
+
+ m_opaque_up = clone(rhs.m_opaque_up);
+}
+
+const lldb::SBProcessInfoList &
+SBProcessInfoList::operator=(const lldb::SBProcessInfoList &rhs) {
+
+ LLDB_INSTRUMENT_VA(this, rhs);
+
+ if (this != &rhs)
+ m_opaque_up = clone(rhs.m_opaque_up);
+ return *this;
+}
+
+uint32_t SBProcessInfoList::GetSize() const {
+ LLDB_INSTRUMENT_VA(this);
+
+ if (m_opaque_up)
+ return m_opaque_up->GetSize();
+
+ return 0;
+}
+
+void SBProcessInfoList::Clear() {
+ LLDB_INSTRUMENT_VA(this);
+
+ if (m_opaque_up)
+ m_opaque_up->Clear();
+}
+
+bool SBProcessInfoList::GetProcessInfoAtIndex(uint32_t idx,
+ SBProcessInfo &info) {
+ LLDB_INSTRUMENT_VA(this, idx, info);
+
+ if (m_opaque_up) {
+ lldb_private::ProcessInstanceInfo process_instance_info;
+ if (m_opaque_up->GetProcessInfoAtIndex(idx, process_instance_info)) {
+ info.SetProcessInfo(process_instance_info);
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/contrib/llvm-project/lldb/source/API/SBSourceManager.cpp b/contrib/llvm-project/lldb/source/API/SBSourceManager.cpp
index 68815026c464..e46f990698d8 100644
--- a/contrib/llvm-project/lldb/source/API/SBSourceManager.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBSourceManager.cpp
@@ -15,7 +15,6 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/SourceManager.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Target/Target.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBStream.cpp b/contrib/llvm-project/lldb/source/API/SBStream.cpp
index 9275a02bb62c..fc8f09a7bb9a 100644
--- a/contrib/llvm-project/lldb/source/API/SBStream.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBStream.cpp
@@ -9,8 +9,8 @@
#include "lldb/API/SBStream.h"
#include "lldb/API/SBFile.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/StreamFile.h"
#include "lldb/Utility/Instrumentation.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Status.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBTarget.cpp b/contrib/llvm-project/lldb/source/API/SBTarget.cpp
index 3fef7428abe2..8e616afbcb4e 100644
--- a/contrib/llvm-project/lldb/source/API/SBTarget.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBTarget.cpp
@@ -37,6 +37,7 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StructuredDataImpl.h"
@@ -1321,27 +1322,39 @@ SBWatchpoint SBTarget::FindWatchpointByID(lldb::watch_id_t wp_id) {
}
lldb::SBWatchpoint SBTarget::WatchAddress(lldb::addr_t addr, size_t size,
- bool read, bool write,
+ bool read, bool modify,
SBError &error) {
LLDB_INSTRUMENT_VA(this, addr, size, read, write, error);
+ SBWatchpointOptions options;
+ options.SetWatchpointTypeRead(read);
+ options.SetWatchpointTypeWrite(eWatchpointWriteTypeOnModify);
+ return WatchpointCreateByAddress(addr, size, options, error);
+}
+
+lldb::SBWatchpoint
+SBTarget::WatchpointCreateByAddress(lldb::addr_t addr, size_t size,
+ SBWatchpointOptions options,
+ SBError &error) {
+ LLDB_INSTRUMENT_VA(this, addr, size, options, error);
+
SBWatchpoint sb_watchpoint;
lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
- if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS &&
- size > 0) {
+ uint32_t watch_type = 0;
+ if (options.GetWatchpointTypeRead())
+ watch_type |= LLDB_WATCH_TYPE_READ;
+ if (options.GetWatchpointTypeWrite() == eWatchpointWriteTypeAlways)
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+ if (options.GetWatchpointTypeWrite() == eWatchpointWriteTypeOnModify)
+ watch_type |= LLDB_WATCH_TYPE_MODIFY;
+ if (watch_type == 0) {
+ error.SetErrorString("Can't create a watchpoint that is neither read nor "
+ "write nor modify.");
+ return sb_watchpoint;
+ }
+ if (target_sp && addr != LLDB_INVALID_ADDRESS && size > 0) {
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
- uint32_t watch_type = 0;
- if (read)
- watch_type |= LLDB_WATCH_TYPE_READ;
- if (write)
- watch_type |= LLDB_WATCH_TYPE_WRITE;
- if (watch_type == 0) {
- error.SetErrorString(
- "Can't create a watchpoint that is neither read nor write.");
- return sb_watchpoint;
- }
-
// Target::CreateWatchpoint() is thread safe.
Status cw_error;
// This API doesn't take in a type, so we can't figure out what it is.
@@ -1477,28 +1490,29 @@ lldb::SBModule SBTarget::AddModule(const char *path, const char *triple,
const char *uuid_cstr, const char *symfile) {
LLDB_INSTRUMENT_VA(this, path, triple, uuid_cstr, symfile);
- lldb::SBModule sb_module;
TargetSP target_sp(GetSP());
- if (target_sp) {
- ModuleSpec module_spec;
- if (path)
- module_spec.GetFileSpec().SetFile(path, FileSpec::Style::native);
+ if (!target_sp)
+ return {};
- if (uuid_cstr)
- module_spec.GetUUID().SetFromStringRef(uuid_cstr);
+ ModuleSpec module_spec;
+ if (path)
+ module_spec.GetFileSpec().SetFile(path, FileSpec::Style::native);
- if (triple)
- module_spec.GetArchitecture() = Platform::GetAugmentedArchSpec(
- target_sp->GetPlatform().get(), triple);
- else
- module_spec.GetArchitecture() = target_sp->GetArchitecture();
+ if (uuid_cstr)
+ module_spec.GetUUID().SetFromStringRef(uuid_cstr);
- if (symfile)
- module_spec.GetSymbolFileSpec().SetFile(symfile, FileSpec::Style::native);
+ if (triple)
+ module_spec.GetArchitecture() =
+ Platform::GetAugmentedArchSpec(target_sp->GetPlatform().get(), triple);
+ else
+ module_spec.GetArchitecture() = target_sp->GetArchitecture();
- sb_module.SetSP(target_sp->GetOrCreateModule(module_spec, true /* notify */));
- }
- return sb_module;
+ if (symfile)
+ module_spec.GetSymbolFileSpec().SetFile(symfile, FileSpec::Style::native);
+
+ SBModuleSpec sb_modulespec(module_spec);
+
+ return AddModule(sb_modulespec);
}
lldb::SBModule SBTarget::AddModule(const SBModuleSpec &module_spec) {
@@ -1506,9 +1520,27 @@ lldb::SBModule SBTarget::AddModule(const SBModuleSpec &module_spec) {
lldb::SBModule sb_module;
TargetSP target_sp(GetSP());
- if (target_sp)
+ if (target_sp) {
sb_module.SetSP(target_sp->GetOrCreateModule(*module_spec.m_opaque_up,
true /* notify */));
+ if (!sb_module.IsValid() && module_spec.m_opaque_up->GetUUID().IsValid()) {
+ Status error;
+ if (PluginManager::DownloadObjectAndSymbolFile(*module_spec.m_opaque_up,
+ error,
+ /* force_lookup */ true)) {
+ if (FileSystem::Instance().Exists(
+ module_spec.m_opaque_up->GetFileSpec())) {
+ sb_module.SetSP(target_sp->GetOrCreateModule(*module_spec.m_opaque_up,
+ true /* notify */));
+ }
+ }
+ }
+ }
+ // If the target hasn't initialized any architecture yet, use the
+ // binary's architecture.
+ if (sb_module.IsValid() && !target_sp->GetArchitecture().IsValid() &&
+ sb_module.GetSP()->GetArchitecture().IsValid())
+ target_sp->SetArchitecture(sb_module.GetSP()->GetArchitecture());
return sb_module;
}
@@ -1772,21 +1804,13 @@ lldb::SBType SBTarget::FindFirstType(const char *typename_cstr) {
TargetSP target_sp(GetSP());
if (typename_cstr && typename_cstr[0] && target_sp) {
ConstString const_typename(typename_cstr);
- SymbolContext sc;
- const bool exact_match = false;
-
- const ModuleList &module_list = target_sp->GetImages();
- size_t count = module_list.GetSize();
- for (size_t idx = 0; idx < count; idx++) {
- ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
- if (module_sp) {
- TypeSP type_sp(
- module_sp->FindFirstType(sc, const_typename, exact_match));
- if (type_sp)
- return SBType(type_sp);
- }
- }
-
+ TypeQuery query(const_typename.GetStringRef(),
+ TypeQueryOptions::e_find_one);
+ TypeResults results;
+ target_sp->GetImages().FindTypes(/*search_first=*/nullptr, query, results);
+ TypeSP type_sp = results.GetFirstType();
+ if (type_sp)
+ return SBType(type_sp);
// Didn't find the type in the symbols; Try the loaded language runtimes.
if (auto process_sp = target_sp->GetProcessSP()) {
for (auto *runtime : process_sp->GetLanguageRuntimes()) {
@@ -1827,17 +1851,11 @@ lldb::SBTypeList SBTarget::FindTypes(const char *typename_cstr) {
if (typename_cstr && typename_cstr[0] && target_sp) {
ModuleList &images = target_sp->GetImages();
ConstString const_typename(typename_cstr);
- bool exact_match = false;
- TypeList type_list;
- llvm::DenseSet<SymbolFile *> searched_symbol_files;
- images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX,
- searched_symbol_files, type_list);
-
- for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
- TypeSP type_sp(type_list.GetTypeAtIndex(idx));
- if (type_sp)
- sb_type_list.Append(SBType(type_sp));
- }
+ TypeQuery query(typename_cstr);
+ TypeResults results;
+ images.FindTypes(nullptr, query, results);
+ for (const TypeSP &type_sp : results.GetTypeMap().Types())
+ sb_type_list.Append(SBType(type_sp));
// Try the loaded language runtimes
if (auto process_sp = target_sp->GetProcessSP()) {
diff --git a/contrib/llvm-project/lldb/source/API/SBThread.cpp b/contrib/llvm-project/lldb/source/API/SBThread.cpp
index bd316ddf54a9..fa4c80e59d97 100644
--- a/contrib/llvm-project/lldb/source/API/SBThread.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBThread.cpp
@@ -12,6 +12,7 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBFormat.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
@@ -22,7 +23,6 @@
#include "lldb/API/SBValue.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -181,7 +181,7 @@ size_t SBThread::GetStopReasonDataCount() {
exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID(
site_id));
if (bp_site_sp)
- return bp_site_sp->GetNumberOfOwners() * 2;
+ return bp_site_sp->GetNumberOfConstituents() * 2;
else
return 0; // Breakpoint must have cleared itself...
} break;
@@ -241,7 +241,7 @@ uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) {
if (bp_site_sp) {
uint32_t bp_index = idx / 2;
BreakpointLocationSP bp_loc_sp(
- bp_site_sp->GetOwnerAtIndex(bp_index));
+ bp_site_sp->GetConstituentAtIndex(bp_index));
if (bp_loc_sp) {
if (idx & 1) {
// Odd idx, return the breakpoint location ID
@@ -1224,17 +1224,41 @@ bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
if (exe_ctx.HasThreadScope()) {
- exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm,
- LLDB_INVALID_THREAD_ID,
- stop_format);
- // strm.Printf("SBThread: tid = 0x%4.4" PRIx64,
- // exe_ctx.GetThreadPtr()->GetID());
+ exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(
+ strm, LLDB_INVALID_THREAD_ID, stop_format);
} else
strm.PutCString("No value");
return true;
}
+SBError SBThread::GetDescriptionWithFormat(const SBFormat &format,
+ SBStream &output) {
+ Stream &strm = output.ref();
+
+ SBError error;
+ if (!format) {
+ error.SetErrorString("The provided SBFormat object is invalid");
+ return error;
+ }
+
+ std::unique_lock<std::recursive_mutex> lock;
+ ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
+
+ if (exe_ctx.HasThreadScope()) {
+ if (exe_ctx.GetThreadPtr()->DumpUsingFormat(
+ strm, LLDB_INVALID_THREAD_ID, format.GetFormatEntrySP().get())) {
+ return error;
+ }
+ }
+
+ error.SetErrorStringWithFormat(
+ "It was not possible to generate a thread description with the given "
+ "format string '%s'",
+ format.GetFormatEntrySP()->string.c_str());
+ return error;
+}
+
SBThread SBThread::GetExtendedBacktraceThread(const char *type) {
LLDB_INSTRUMENT_VA(this, type);
diff --git a/contrib/llvm-project/lldb/source/API/SBThreadPlan.cpp b/contrib/llvm-project/lldb/source/API/SBThreadPlan.cpp
index 2e66ac120839..f756bca3176e 100644
--- a/contrib/llvm-project/lldb/source/API/SBThreadPlan.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBThreadPlan.cpp
@@ -15,7 +15,6 @@
#include "lldb/API/SBSymbolContext.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/CompileUnit.h"
diff --git a/contrib/llvm-project/lldb/source/API/SBType.cpp b/contrib/llvm-project/lldb/source/API/SBType.cpp
index ee5b64474280..ac0e56303fae 100644
--- a/contrib/llvm-project/lldb/source/API/SBType.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBType.cpp
@@ -586,6 +586,14 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) {
return eTemplateArgumentKindNull;
}
+SBType SBType::FindDirectNestedType(const char *name) {
+ LLDB_INSTRUMENT_VA(this, name);
+
+ if (!IsValid())
+ return SBType();
+ return SBType(m_opaque_sp->FindDirectNestedType(name));
+}
+
SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
LLDB_INSTRUMENT_VA(this);
}
diff --git a/contrib/llvm-project/lldb/source/API/SBUnixSignals.cpp b/contrib/llvm-project/lldb/source/API/SBUnixSignals.cpp
index 7cccbaff1d2f..519881b186e4 100644
--- a/contrib/llvm-project/lldb/source/API/SBUnixSignals.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBUnixSignals.cpp
@@ -66,7 +66,7 @@ const char *SBUnixSignals::GetSignalAsCString(int32_t signo) const {
LLDB_INSTRUMENT_VA(this, signo);
if (auto signals_sp = GetSP())
- return ConstString(signals_sp->GetSignalAsCString(signo)).GetCString();
+ return ConstString(signals_sp->GetSignalAsStringRef(signo)).GetCString();
return nullptr;
}
diff --git a/contrib/llvm-project/lldb/source/API/SBValue.cpp b/contrib/llvm-project/lldb/source/API/SBValue.cpp
index e8ed36380d37..34d01d759ba5 100644
--- a/contrib/llvm-project/lldb/source/API/SBValue.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBValue.cpp
@@ -20,7 +20,6 @@
#include "lldb/Core/Declaration.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
@@ -115,7 +114,7 @@ public:
Target *target = value_sp->GetTargetSP().get();
// If this ValueObject holds an error, then it is valuable for that.
- if (value_sp->GetError().Fail())
+ if (value_sp->GetError().Fail())
return value_sp;
if (!target)
@@ -1039,8 +1038,8 @@ lldb::ValueObjectSP SBValue::GetSP(ValueLocker &locker) const {
// IsValid means that the SBValue has a value in it. But that's not the
// only time that ValueObjects are useful. We also want to return the value
// if there's an error state in it.
- if (!m_opaque_sp || (!m_opaque_sp->IsValid()
- && (m_opaque_sp->GetRootSP()
+ if (!m_opaque_sp || (!m_opaque_sp->IsValid()
+ && (m_opaque_sp->GetRootSP()
&& !m_opaque_sp->GetRootSP()->GetError().Fail()))) {
locker.GetError().SetErrorString("No value");
return ValueObjectSP();
@@ -1434,10 +1433,17 @@ lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
return sb_watchpoint;
uint32_t watch_type = 0;
- if (read)
+ if (read) {
watch_type |= LLDB_WATCH_TYPE_READ;
- if (write)
- watch_type |= LLDB_WATCH_TYPE_WRITE;
+ // read + write, the most likely intention
+ // is to catch all writes to this, not just
+ // value modifications.
+ if (write)
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+ } else {
+ if (write)
+ watch_type |= LLDB_WATCH_TYPE_MODIFY;
+ }
Status rc;
CompilerType type(value_sp->GetCompilerType());
@@ -1499,3 +1505,14 @@ lldb::SBValue SBValue::Persist() {
}
return persisted_sb;
}
+
+lldb::SBValue SBValue::GetVTable() {
+ SBValue vtable_sb;
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (!value_sp)
+ return vtable_sb;
+
+ vtable_sb.SetSP(value_sp->GetVTable());
+ return vtable_sb;
+}
diff --git a/contrib/llvm-project/lldb/source/API/SBWatchpoint.cpp b/contrib/llvm-project/lldb/source/API/SBWatchpoint.cpp
index f5a7f53a8b30..9664bbe61860 100644
--- a/contrib/llvm-project/lldb/source/API/SBWatchpoint.cpp
+++ b/contrib/llvm-project/lldb/source/API/SBWatchpoint.cpp
@@ -16,7 +16,6 @@
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Breakpoint/WatchpointList.h"
-#include "lldb/Core/StreamFile.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -95,16 +94,11 @@ SBError SBWatchpoint::GetError() {
int32_t SBWatchpoint::GetHardwareIndex() {
LLDB_INSTRUMENT_VA(this);
- int32_t hw_index = -1;
-
- lldb::WatchpointSP watchpoint_sp(GetSP());
- if (watchpoint_sp) {
- std::lock_guard<std::recursive_mutex> guard(
- watchpoint_sp->GetTarget().GetAPIMutex());
- hw_index = watchpoint_sp->GetHardwareIndex();
- }
-
- return hw_index;
+ // For processes using gdb remote protocol,
+ // we cannot determine the hardware breakpoint
+ // index reliably; providing possibly correct
+ // guesses is not useful to anyone.
+ return -1;
}
addr_t SBWatchpoint::GetWatchAddress() {
@@ -148,9 +142,9 @@ void SBWatchpoint::SetEnabled(bool enabled) {
const bool notify = true;
if (process_sp) {
if (enabled)
- process_sp->EnableWatchpoint(watchpoint_sp.get(), notify);
+ process_sp->EnableWatchpoint(watchpoint_sp, notify);
else
- process_sp->DisableWatchpoint(watchpoint_sp.get(), notify);
+ process_sp->DisableWatchpoint(watchpoint_sp, notify);
} else {
watchpoint_sp->SetEnabled(enabled, notify);
}
@@ -355,7 +349,8 @@ bool SBWatchpoint::IsWatchingWrites() {
std::lock_guard<std::recursive_mutex> guard(
watchpoint_sp->GetTarget().GetAPIMutex());
- return watchpoint_sp->WatchpointWrite();
+ return watchpoint_sp->WatchpointWrite() ||
+ watchpoint_sp->WatchpointModify();
}
return false;
diff --git a/contrib/llvm-project/lldb/source/API/SBWatchpointOptions.cpp b/contrib/llvm-project/lldb/source/API/SBWatchpointOptions.cpp
new file mode 100644
index 000000000000..62e9c21a8579
--- /dev/null
+++ b/contrib/llvm-project/lldb/source/API/SBWatchpointOptions.cpp
@@ -0,0 +1,73 @@
+//===-- SBWatchpointOptions.cpp -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBWatchpointOptions.h"
+#include "lldb/Breakpoint/Watchpoint.h"
+#include "lldb/Utility/Instrumentation.h"
+
+#include "Utils.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+class WatchpointOptionsImpl {
+public:
+ bool m_read = false;
+ bool m_write = false;
+ bool m_modify = false;
+};
+
+
+SBWatchpointOptions::SBWatchpointOptions()
+ : m_opaque_up(new WatchpointOptionsImpl()) {
+ LLDB_INSTRUMENT_VA(this);
+}
+
+SBWatchpointOptions::SBWatchpointOptions(const SBWatchpointOptions &rhs) {
+ LLDB_INSTRUMENT_VA(this, rhs);
+
+ m_opaque_up = clone(rhs.m_opaque_up);
+}
+
+const SBWatchpointOptions &
+SBWatchpointOptions::operator=(const SBWatchpointOptions &rhs) {
+ LLDB_INSTRUMENT_VA(this, rhs);
+
+ if (this != &rhs)
+ m_opaque_up = clone(rhs.m_opaque_up);
+ return *this;
+}
+
+SBWatchpointOptions::~SBWatchpointOptions() = default;
+
+void SBWatchpointOptions::SetWatchpointTypeRead(bool read) {
+ m_opaque_up->m_read = read;
+}
+bool SBWatchpointOptions::GetWatchpointTypeRead() const {
+ return m_opaque_up->m_read;
+}
+
+void SBWatchpointOptions::SetWatchpointTypeWrite(
+ WatchpointWriteType write_type) {
+ if (write_type == eWatchpointWriteTypeOnModify) {
+ m_opaque_up->m_write = false;
+ m_opaque_up->m_modify = true;
+ } else if (write_type == eWatchpointWriteTypeAlways) {
+ m_opaque_up->m_write = true;
+ m_opaque_up->m_modify = false;
+ } else
+ m_opaque_up->m_write = m_opaque_up->m_modify = false;
+}
+
+WatchpointWriteType SBWatchpointOptions::GetWatchpointTypeWrite() const {
+ if (m_opaque_up->m_modify)
+ return eWatchpointWriteTypeOnModify;
+ if (m_opaque_up->m_write)
+ return eWatchpointWriteTypeAlways;
+ return eWatchpointWriteTypeDisabled;
+}
diff --git a/contrib/llvm-project/lldb/source/API/SystemInitializerFull.cpp b/contrib/llvm-project/lldb/source/API/SystemInitializerFull.cpp
index 27319debc858..c48466f25ede 100644
--- a/contrib/llvm-project/lldb/source/API/SystemInitializerFull.cpp
+++ b/contrib/llvm-project/lldb/source/API/SystemInitializerFull.cpp
@@ -68,9 +68,6 @@ llvm::Error SystemInitializerFull::Initialize() {
#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
#include "Plugins/Plugins.def"
- // Initialize plug-ins in core LLDB
- ProcessTrace::Initialize();
-
// Scan for any system or user LLDB plug-ins
PluginManager::Initialize();