summaryrefslogtreecommitdiff
path: root/source/Core
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
commit5f29bb8a675e8f96452b632e7129113f7dec850e (patch)
tree3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /source/Core
parent88c643b6fec27eec436c8d138fee6346e92337d6 (diff)
Notes
Diffstat (limited to 'source/Core')
-rw-r--r--source/Core/Address.cpp11
-rw-r--r--source/Core/AddressRange.cpp25
-rw-r--r--source/Core/AddressResolver.cpp9
-rw-r--r--source/Core/AddressResolverFileLine.cpp9
-rw-r--r--source/Core/AddressResolverName.cpp7
-rw-r--r--source/Core/Communication.cpp26
-rw-r--r--source/Core/Debugger.cpp133
-rw-r--r--source/Core/Disassembler.cpp44
-rw-r--r--source/Core/DumpDataExtractor.cpp13
-rw-r--r--source/Core/DumpRegisterValue.cpp7
-rw-r--r--source/Core/DynamicLoader.cpp29
-rw-r--r--source/Core/EmulateInstruction.cpp16
-rw-r--r--source/Core/FileLineResolver.cpp9
-rw-r--r--source/Core/FileSpecList.cpp34
-rw-r--r--source/Core/FormatEntity.cpp216
-rw-r--r--source/Core/Highlighter.cpp7
-rw-r--r--source/Core/IOHandler.cpp148
-rw-r--r--source/Core/Mangled.cpp69
-rw-r--r--source/Core/Module.cpp94
-rw-r--r--source/Core/ModuleChild.cpp10
-rw-r--r--source/Core/ModuleList.cpp85
-rw-r--r--source/Core/Opcode.cpp7
-rw-r--r--source/Core/PluginManager.cpp176
-rw-r--r--source/Core/RichManglingContext.cpp13
-rw-r--r--source/Core/SearchFilter.cpp36
-rw-r--r--source/Core/Section.cpp33
-rw-r--r--source/Core/SourceManager.cpp21
-rw-r--r--source/Core/StreamAsynchronousIO.cpp7
-rw-r--r--source/Core/StreamFile.cpp9
-rw-r--r--source/Core/UserSettingsController.cpp9
-rw-r--r--source/Core/Value.cpp41
-rw-r--r--source/Core/ValueObject.cpp234
-rw-r--r--source/Core/ValueObjectCast.cpp11
-rw-r--r--source/Core/ValueObjectChild.cpp9
-rw-r--r--source/Core/ValueObjectConstResult.cpp23
-rw-r--r--source/Core/ValueObjectConstResultCast.cpp9
-rw-r--r--source/Core/ValueObjectConstResultChild.cpp9
-rw-r--r--source/Core/ValueObjectConstResultImpl.cpp27
-rw-r--r--source/Core/ValueObjectDynamicValue.cpp7
-rw-r--r--source/Core/ValueObjectList.cpp14
-rw-r--r--source/Core/ValueObjectMemory.cpp15
-rw-r--r--source/Core/ValueObjectRegister.cpp31
-rw-r--r--source/Core/ValueObjectSyntheticFilter.cpp43
-rw-r--r--source/Core/ValueObjectVariable.cpp15
44 files changed, 846 insertions, 954 deletions
diff --git a/source/Core/Address.cpp b/source/Core/Address.cpp
index a4dc364b701bd..0da83eb98edb1 100644
--- a/source/Core/Address.cpp
+++ b/source/Core/Address.cpp
@@ -1,9 +1,8 @@
//===-- Address.cpp ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -162,7 +161,7 @@ static bool ReadAddress(ExecutionContextScope *exe_scope,
static bool DumpUInt(ExecutionContextScope *exe_scope, const Address &address,
uint32_t byte_size, Stream *strm) {
if (exe_scope == nullptr || byte_size == 0)
- return 0;
+ return false;
std::vector<uint8_t> buf(byte_size, 0);
if (ReadBytes(exe_scope, address, &buf[0], buf.size()) == buf.size()) {
@@ -928,7 +927,6 @@ size_t Address::MemorySize() const {
return sizeof(Address);
}
-//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two addresses
// from different modules in any meaningful way, but it will compare the module
@@ -940,7 +938,6 @@ size_t Address::MemorySize() const {
// address results to make much sense
//
// This basically lets Address objects be used in ordered collection classes.
-//----------------------------------------------------------------------
bool lldb_private::operator<(const Address &lhs, const Address &rhs) {
ModuleSP lhs_module_sp(lhs.GetModule());
diff --git a/source/Core/AddressRange.cpp b/source/Core/AddressRange.cpp
index 1afe4fa223db9..71eec3c196072 100644
--- a/source/Core/AddressRange.cpp
+++ b/source/Core/AddressRange.cpp
@@ -1,9 +1,8 @@
//===-- AddressRange.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -123,6 +122,24 @@ bool AddressRange::ContainsLoadAddress(addr_t load_addr, Target *target) const {
return false;
}
+bool AddressRange::Extend(const AddressRange &rhs_range) {
+ addr_t lhs_end_addr = GetBaseAddress().GetFileAddress() + GetByteSize();
+ addr_t rhs_base_addr = rhs_range.GetBaseAddress().GetFileAddress();
+
+ if (!ContainsFileAddress(rhs_range.GetBaseAddress()) &&
+ lhs_end_addr != rhs_base_addr)
+ // The ranges don't intersect at all on the right side of this range.
+ return false;
+
+ addr_t rhs_end_addr = rhs_base_addr + rhs_range.GetByteSize();
+ if (lhs_end_addr >= rhs_end_addr)
+ // The rhs range totally overlaps this one, nothing to add.
+ return false;
+
+ m_byte_size += rhs_end_addr - lhs_end_addr;
+ return true;
+}
+
void AddressRange::Clear() {
m_base_addr.Clear();
m_byte_size = 0;
diff --git a/source/Core/AddressResolver.cpp b/source/Core/AddressResolver.cpp
index 8d7cc9f6a4281..974d99b620655 100644
--- a/source/Core/AddressResolver.cpp
+++ b/source/Core/AddressResolver.cpp
@@ -1,9 +1,8 @@
//===-- AddressResolver.cpp -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -17,9 +16,7 @@ class ModuleList;
using namespace lldb_private;
-//----------------------------------------------------------------------
// AddressResolver:
-//----------------------------------------------------------------------
AddressResolver::AddressResolver() {}
AddressResolver::~AddressResolver() {}
diff --git a/source/Core/AddressResolverFileLine.cpp b/source/Core/AddressResolverFileLine.cpp
index 203ab2787fe3e..24c0222d6ec2f 100644
--- a/source/Core/AddressResolverFileLine.cpp
+++ b/source/Core/AddressResolverFileLine.cpp
@@ -1,9 +1,8 @@
//===-- AddressResolverFileLine.cpp -----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -28,9 +27,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// AddressResolverFileLine:
-//----------------------------------------------------------------------
AddressResolverFileLine::AddressResolverFileLine(const FileSpec &file_spec,
uint32_t line_no,
bool check_inlines)
diff --git a/source/Core/AddressResolverName.cpp b/source/Core/AddressResolverName.cpp
index 7683e391e0cf9..e861368c0a25f 100644
--- a/source/Core/AddressResolverName.cpp
+++ b/source/Core/AddressResolverName.cpp
@@ -1,9 +1,8 @@
//===-- AddressResolverName.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/Communication.cpp b/source/Core/Communication.cpp
index afdabc0c7ce52..a67cb925d648f 100644
--- a/source/Core/Communication.cpp
+++ b/source/Core/Communication.cpp
@@ -1,9 +1,8 @@
//===-- Communication.cpp ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -205,10 +204,23 @@ bool Communication::StartReadThread(Status *error_ptr) {
m_read_thread_enabled = true;
m_read_thread_did_exit = false;
- m_read_thread = ThreadLauncher::LaunchThread(
- thread_name, Communication::ReadThread, this, error_ptr);
+ auto maybe_thread = ThreadLauncher::LaunchThread(
+ thread_name, Communication::ReadThread, this);
+ if (maybe_thread) {
+ m_read_thread = *maybe_thread;
+ } else {
+ if (error_ptr)
+ *error_ptr = Status(maybe_thread.takeError());
+ else {
+ LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
+ "failed to launch host thread: {}",
+ llvm::toString(maybe_thread.takeError()));
+ }
+ }
+
if (!m_read_thread.IsJoinable())
m_read_thread_enabled = false;
+
return m_read_thread_enabled;
}
@@ -360,7 +372,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) {
// Let clients know that this thread is exiting
comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
- return NULL;
+ return {};
}
void Communication::SetReadThreadBytesReceivedCallback(
diff --git a/source/Core/Debugger.cpp b/source/Core/Debugger.cpp
index 765b59c8865ed..1a69fc582d0c3 100644
--- a/source/Core/Debugger.cpp
+++ b/source/Core/Debugger.cpp
@@ -1,9 +1,8 @@
//===-- Debugger.cpp --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -122,7 +121,10 @@ static constexpr OptionEnumValueElement g_language_enumerators[] = {
"{${frame.no-debug}${function.pc-offset}}}}"
#define FILE_AND_LINE \
- "{ at ${line.file.basename}:${line.number}{:${line.column}}}"
+ "{ at ${ansi.fg.cyan}${line.file.basename}${ansi.normal}" \
+ ":${ansi.fg.yellow}${line.number}${ansi.normal}" \
+ "{:${ansi.fg.yellow}${line.column}${ansi.normal}}}"
+
#define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
#define IS_ARTIFICIAL "{${frame.is-artificial} [artificial]}"
@@ -130,32 +132,36 @@ static constexpr OptionEnumValueElement g_language_enumerators[] = {
#define DEFAULT_THREAD_FORMAT \
"thread #${thread.index}: tid = ${thread.id%tid}" \
"{, ${frame.pc}}" MODULE_WITH_FUNC FILE_AND_LINE \
- "{, name = '${thread.name}'}" \
- "{, queue = '${thread.queue}'}" \
- "{, activity = '${thread.info.activity.name}'}" \
+ "{, name = ${ansi.fg.green}'${thread.name}'${ansi.normal}}" \
+ "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}" \
+ "{, activity = " \
+ "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}" \
"{, ${thread.info.trace_messages} messages}" \
- "{, stop reason = ${thread.stop-reason}}" \
+ "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}" \
"{\\nReturn value: ${thread.return-value}}" \
"{\\nCompleted expression: ${thread.completed-expression}}" \
"\\n"
#define DEFAULT_THREAD_STOP_FORMAT \
"thread #${thread.index}{, name = '${thread.name}'}" \
- "{, queue = '${thread.queue}'}" \
- "{, activity = '${thread.info.activity.name}'}" \
+ "{, queue = ${ansi.fg.green}'${thread.queue}'${ansi.normal}}" \
+ "{, activity = " \
+ "${ansi.fg.green}'${thread.info.activity.name}'${ansi.normal}}" \
"{, ${thread.info.trace_messages} messages}" \
- "{, stop reason = ${thread.stop-reason}}" \
+ "{, stop reason = ${ansi.fg.red}${thread.stop-reason}${ansi.normal}}" \
"{\\nReturn value: ${thread.return-value}}" \
"{\\nCompleted expression: ${thread.completed-expression}}" \
"\\n"
#define DEFAULT_FRAME_FORMAT \
- "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE \
+ "frame #${frame.index}: " \
+ "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC FILE_AND_LINE \
IS_OPTIMIZED IS_ARTIFICIAL "\\n"
#define DEFAULT_FRAME_FORMAT_NO_ARGS \
- "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE \
- IS_OPTIMIZED IS_ARTIFICIAL "\\n"
+ "frame #${frame.index}: " \
+ "${ansi.fg.yellow}${frame.pc}${ansi.normal}" MODULE_WITH_FUNC_NO_ARGS \
+ FILE_AND_LINE IS_OPTIMIZED IS_ARTIFICIAL "\\n"
// Three parts to this disassembly format specification:
// 1. If this is a new function/symbol (no previous symbol/function), print
@@ -712,7 +718,7 @@ void Debugger::Destroy(DebuggerSP &debugger_sp) {
}
DebuggerSP
-Debugger::FindDebuggerWithInstanceName(const ConstString &instance_name) {
+Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
DebuggerSP debugger_sp;
if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
@@ -761,14 +767,15 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
m_input_file_sp(std::make_shared<StreamFile>(stdin, false)),
m_output_file_sp(std::make_shared<StreamFile>(stdout, false)),
m_error_file_sp(std::make_shared<StreamFile>(stderr, false)),
+ m_input_recorder(nullptr),
m_broadcaster_manager_sp(BroadcasterManager::MakeBroadcasterManager()),
m_terminal_state(), m_target_list(*this), m_platform_list(),
m_listener_sp(Listener::MakeListener("lldb.Debugger")),
- m_source_manager_ap(), m_source_file_cache(),
- m_command_interpreter_ap(llvm::make_unique<CommandInterpreter>(
- *this, eScriptLanguageDefault, false)),
- m_input_reader_stack(), m_instance_name(), m_loaded_plugins(),
- m_event_handler_thread(), m_io_handler_thread(),
+ m_source_manager_up(), m_source_file_cache(),
+ m_command_interpreter_up(
+ llvm::make_unique<CommandInterpreter>(*this, false)),
+ m_script_interpreter_sp(), m_input_reader_stack(), m_instance_name(),
+ m_loaded_plugins(), m_event_handler_thread(), m_io_handler_thread(),
m_sync_broadcaster(nullptr, "lldb.debugger.sync"),
m_forward_listener_sp(), m_clear_once() {
char instance_cstr[256];
@@ -777,7 +784,7 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
if (log_callback)
m_log_callback_stream_sp =
std::make_shared<StreamCallback>(log_callback, baton);
- m_command_interpreter_ap->Initialize();
+ m_command_interpreter_up->Initialize();
// Always add our default platform to the platform list
PlatformSP default_platform_sp(Platform::GetHostPlatform());
assert(default_platform_sp);
@@ -794,11 +801,11 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
m_collection_sp->AppendProperty(
ConstString("symbols"), ConstString("Symbol lookup and cache settings."),
true, ModuleList::GetGlobalModuleListProperties().GetValueProperties());
- if (m_command_interpreter_ap) {
+ if (m_command_interpreter_up) {
m_collection_sp->AppendProperty(
ConstString("interpreter"),
ConstString("Settings specify to the debugger's command interpreter."),
- true, m_command_interpreter_ap->GetValueProperties());
+ true, m_command_interpreter_up->GetValueProperties());
}
OptionValueSInt64 *term_width =
m_collection_sp->GetPropertyAtIndexAsOptionValueSInt64(
@@ -824,7 +831,6 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
Debugger::~Debugger() { Clear(); }
void Debugger::Clear() {
- //----------------------------------------------------------------------
// Make sure we call this function only once. With the C++ global destructor
// chain having a list of debuggers and with code that can be running on
// other threads, we need to ensure this doesn't happen multiple times.
@@ -833,7 +839,6 @@ void Debugger::Clear() {
// Debugger::~Debugger();
// static void Debugger::Destroy(lldb::DebuggerSP &debugger_sp);
// static void Debugger::Terminate();
- //----------------------------------------------------------------------
llvm::call_once(m_clear_once, [this]() {
ClearIOHandlers();
StopIOHandlerThread();
@@ -857,7 +862,7 @@ void Debugger::Clear() {
if (m_input_file_sp)
m_input_file_sp->GetFile().Close();
- m_command_interpreter_ap->Clear();
+ m_command_interpreter_up->Clear();
});
}
@@ -871,14 +876,18 @@ void Debugger::SetCloseInputOnEOF(bool b) {
}
bool Debugger::GetAsyncExecution() {
- return !m_command_interpreter_ap->GetSynchronous();
+ return !m_command_interpreter_up->GetSynchronous();
}
void Debugger::SetAsyncExecution(bool async_execution) {
- m_command_interpreter_ap->SetSynchronous(!async_execution);
+ m_command_interpreter_up->SetSynchronous(!async_execution);
}
-void Debugger::SetInputFileHandle(FILE *fh, bool tranfer_ownership) {
+repro::DataRecorder *Debugger::GetInputRecorder() { return m_input_recorder; }
+
+void Debugger::SetInputFileHandle(FILE *fh, bool tranfer_ownership,
+ repro::DataRecorder *recorder) {
+ m_input_recorder = recorder;
if (m_input_file_sp)
m_input_file_sp->GetFile().SetStream(fh, tranfer_ownership);
else
@@ -903,12 +912,10 @@ void Debugger::SetOutputFileHandle(FILE *fh, bool tranfer_ownership) {
if (!out_file.IsValid())
out_file.SetStream(stdout, false);
- // do not create the ScriptInterpreter just for setting the output file
- // handle as the constructor will know how to do the right thing on its own
- const bool can_create = false;
- ScriptInterpreter *script_interpreter =
- GetCommandInterpreter().GetScriptInterpreter(can_create);
- if (script_interpreter)
+ // Do not create the ScriptInterpreter just for setting the output file
+ // handle as the constructor will know how to do the right thing on its own.
+ if (ScriptInterpreter *script_interpreter =
+ GetScriptInterpreter(/*can_create=*/false))
script_interpreter->ResetOutputFileHandle(fh);
}
@@ -1286,10 +1293,23 @@ bool Debugger::EnableLog(llvm::StringRef channel,
error_stream);
}
+ScriptInterpreter *Debugger::GetScriptInterpreter(bool can_create) {
+ std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex);
+
+ if (!m_script_interpreter_sp) {
+ if (!can_create)
+ return nullptr;
+ m_script_interpreter_sp = PluginManager::GetScriptInterpreterForLanguage(
+ GetScriptLanguage(), *this);
+ }
+
+ return m_script_interpreter_sp.get();
+}
+
SourceManager &Debugger::GetSourceManager() {
- if (!m_source_manager_ap)
- m_source_manager_ap = llvm::make_unique<SourceManager>(shared_from_this());
- return *m_source_manager_ap;
+ if (!m_source_manager_up)
+ m_source_manager_up = llvm::make_unique<SourceManager>(shared_from_this());
+ return *m_source_manager_up;
}
// This function handles events that were broadcast by the process.
@@ -1537,7 +1557,7 @@ void Debugger::DefaultEventHandler() {
listener_sp->StartListeningForEventSpec(m_broadcaster_manager_sp,
thread_event_spec);
listener_sp->StartListeningForEvents(
- m_command_interpreter_ap.get(),
+ m_command_interpreter_up.get(),
CommandInterpreter::eBroadcastBitQuitCommandReceived |
CommandInterpreter::eBroadcastBitAsynchronousOutputData |
CommandInterpreter::eBroadcastBitAsynchronousErrorData);
@@ -1564,7 +1584,7 @@ void Debugger::DefaultEventHandler() {
}
} else if (broadcaster_class == broadcaster_class_thread) {
HandleThreadEvent(event_sp);
- } else if (broadcaster == m_command_interpreter_ap.get()) {
+ } else if (broadcaster == m_command_interpreter_up.get()) {
if (event_type &
CommandInterpreter::eBroadcastBitQuitCommandReceived) {
done = true;
@@ -1603,7 +1623,7 @@ void Debugger::DefaultEventHandler() {
lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
((Debugger *)arg)->DefaultEventHandler();
- return NULL;
+ return {};
}
bool Debugger::StartEventHandlerThread() {
@@ -1622,8 +1642,17 @@ bool Debugger::StartEventHandlerThread() {
full_name.AsCString() : "dbg.evt-handler";
// Use larger 8MB stack for this thread
- m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
- EventHandlerThread, this, nullptr, g_debugger_event_thread_stack_bytes);
+ llvm::Expected<HostThread> event_handler_thread =
+ ThreadLauncher::LaunchThread(thread_name, EventHandlerThread, this,
+ g_debugger_event_thread_stack_bytes);
+
+ if (event_handler_thread) {
+ m_event_handler_thread = *event_handler_thread;
+ } else {
+ LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
+ "failed to launch host thread: {}",
+ llvm::toString(event_handler_thread.takeError()));
+ }
// Make sure DefaultEventHandler() is running and listening to events
// before we return from this function. We are only listening for events of
@@ -1648,16 +1677,24 @@ lldb::thread_result_t Debugger::IOHandlerThread(lldb::thread_arg_t arg) {
Debugger *debugger = (Debugger *)arg;
debugger->ExecuteIOHandlers();
debugger->StopEventHandlerThread();
- return NULL;
+ return {};
}
bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); }
bool Debugger::StartIOHandlerThread() {
- if (!m_io_handler_thread.IsJoinable())
- m_io_handler_thread = ThreadLauncher::LaunchThread(
- "lldb.debugger.io-handler", IOHandlerThread, this, nullptr,
+ if (!m_io_handler_thread.IsJoinable()) {
+ llvm::Expected<HostThread> io_handler_thread = ThreadLauncher::LaunchThread(
+ "lldb.debugger.io-handler", IOHandlerThread, this,
8 * 1024 * 1024); // Use larger 8MB stack for this thread
+ if (io_handler_thread) {
+ m_io_handler_thread = *io_handler_thread;
+ } else {
+ LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST),
+ "failed to launch host thread: {}",
+ llvm::toString(io_handler_thread.takeError()));
+ }
+ }
return m_io_handler_thread.IsJoinable();
}
diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp
index a34b8038c5892..af7cf82d470ad 100644
--- a/source/Core/Disassembler.cpp
+++ b/source/Core/Disassembler.cpp
@@ -1,9 +1,8 @@
//===-- Disassembler.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -162,7 +161,7 @@ size_t Disassembler::Disassemble(Debugger &debugger, const ArchSpec &arch,
bool Disassembler::Disassemble(Debugger &debugger, const ArchSpec &arch,
const char *plugin_name, const char *flavor,
const ExecutionContext &exe_ctx,
- const ConstString &name, Module *module,
+ ConstString name, Module *module,
uint32_t num_instructions,
bool mixed_source_and_assembly,
uint32_t num_mixed_context_lines,
@@ -742,11 +741,11 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size,
}
bool Instruction::DumpEmulation(const ArchSpec &arch) {
- std::unique_ptr<EmulateInstruction> insn_emulator_ap(
+ std::unique_ptr<EmulateInstruction> insn_emulator_up(
EmulateInstruction::FindPlugin(arch, eInstructionTypeAny, nullptr));
- if (insn_emulator_ap) {
- insn_emulator_ap->SetInstruction(GetOpcode(), GetAddress(), nullptr);
- return insn_emulator_ap->EvaluateInstruction(0);
+ if (insn_emulator_up) {
+ insn_emulator_up->SetInstruction(GetOpcode(), GetAddress(), nullptr);
+ return insn_emulator_up->EvaluateInstruction(0);
}
return false;
@@ -993,11 +992,11 @@ bool Instruction::TestEmulation(Stream *out_stream, const char *file_name) {
arch.SetTriple(llvm::Triple(value_sp->GetStringValue()));
bool success = false;
- std::unique_ptr<EmulateInstruction> insn_emulator_ap(
+ std::unique_ptr<EmulateInstruction> insn_emulator_up(
EmulateInstruction::FindPlugin(arch, eInstructionTypeAny, nullptr));
- if (insn_emulator_ap)
+ if (insn_emulator_up)
success =
- insn_emulator_ap->TestEmulation(out_stream, arch, data_dictionary);
+ insn_emulator_up->TestEmulation(out_stream, arch, data_dictionary);
if (success)
out_stream->Printf("Emulation test succeeded.");
@@ -1013,14 +1012,14 @@ bool Instruction::Emulate(
EmulateInstruction::WriteMemoryCallback write_mem_callback,
EmulateInstruction::ReadRegisterCallback read_reg_callback,
EmulateInstruction::WriteRegisterCallback write_reg_callback) {
- std::unique_ptr<EmulateInstruction> insn_emulator_ap(
+ std::unique_ptr<EmulateInstruction> insn_emulator_up(
EmulateInstruction::FindPlugin(arch, eInstructionTypeAny, nullptr));
- if (insn_emulator_ap) {
- insn_emulator_ap->SetBaton(baton);
- insn_emulator_ap->SetCallbacks(read_mem_callback, write_mem_callback,
+ if (insn_emulator_up) {
+ insn_emulator_up->SetBaton(baton);
+ insn_emulator_up->SetCallbacks(read_mem_callback, write_mem_callback,
read_reg_callback, write_reg_callback);
- insn_emulator_ap->SetInstruction(GetOpcode(), GetAddress(), nullptr);
- return insn_emulator_ap->EvaluateInstruction(evaluate_options);
+ insn_emulator_up->SetInstruction(GetOpcode(), GetAddress(), nullptr);
+ return insn_emulator_up->EvaluateInstruction(evaluate_options);
}
return false;
@@ -1088,13 +1087,16 @@ void InstructionList::Append(lldb::InstructionSP &inst_sp) {
uint32_t
InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target) const {
+ Target &target,
+ bool ignore_calls) const {
size_t num_instructions = m_instructions.size();
uint32_t next_branch = UINT32_MAX;
size_t i;
for (i = start; i < num_instructions; i++) {
if (m_instructions[i]->DoesBranch()) {
+ if (ignore_calls && m_instructions[i]->IsCall())
+ continue;
next_branch = i;
break;
}
@@ -1238,9 +1240,7 @@ size_t Disassembler::ParseInstructions(const ExecutionContext *exe_ctx,
return m_instruction_list.GetSize();
}
-//----------------------------------------------------------------------
// Disassembler copy constructor
-//----------------------------------------------------------------------
Disassembler::Disassembler(const ArchSpec &arch, const char *flavor)
: m_arch(arch), m_instruction_list(), m_base_addr(LLDB_INVALID_ADDRESS),
m_flavor() {
@@ -1272,9 +1272,7 @@ const InstructionList &Disassembler::GetInstructionList() const {
return m_instruction_list;
}
-//----------------------------------------------------------------------
// Class PseudoInstruction
-//----------------------------------------------------------------------
PseudoInstruction::PseudoInstruction()
: Instruction(Address(), AddressClass::eUnknown), m_description() {}
diff --git a/source/Core/DumpDataExtractor.cpp b/source/Core/DumpDataExtractor.cpp
index 43a026d0dcb29..aa84370e223a5 100644
--- a/source/Core/DumpDataExtractor.cpp
+++ b/source/Core/DumpDataExtractor.cpp
@@ -1,9 +1,8 @@
//===-- DumpDataExtractor.cpp -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -552,7 +551,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
case eFormatFloat: {
TargetSP target_sp;
- bool used_apfloat = false;
+ bool used_upfloat = false;
if (exe_scope)
target_sp = exe_scope->CalculateTarget();
if (target_sp) {
@@ -601,13 +600,13 @@ lldb::offset_t lldb_private::DumpDataExtractor(
if (!sv.empty()) {
s->Printf("%*.*s", (int)sv.size(), (int)sv.size(), sv.data());
- used_apfloat = true;
+ used_upfloat = true;
}
}
}
}
- if (!used_apfloat) {
+ if (!used_upfloat) {
std::ostringstream ss;
if (item_byte_size == sizeof(float) || item_byte_size == 2) {
float f;
diff --git a/source/Core/DumpRegisterValue.cpp b/source/Core/DumpRegisterValue.cpp
index d7196a585667a..74b02413f1018 100644
--- a/source/Core/DumpRegisterValue.cpp
+++ b/source/Core/DumpRegisterValue.cpp
@@ -1,9 +1,8 @@
//===-- DumpRegisterValue.cpp -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/DynamicLoader.cpp b/source/Core/DynamicLoader.cpp
index 72ee3cfd6d5b6..57130d6fa57a1 100644
--- a/source/Core/DynamicLoader.cpp
+++ b/source/Core/DynamicLoader.cpp
@@ -1,9 +1,8 @@
//===-- DynamicLoader.cpp ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -39,10 +38,10 @@ DynamicLoader *DynamicLoader::FindPlugin(Process *process,
PluginManager::GetDynamicLoaderCreateCallbackForPluginName(
const_plugin_name);
if (create_callback) {
- std::unique_ptr<DynamicLoader> instance_ap(
+ std::unique_ptr<DynamicLoader> instance_up(
create_callback(process, true));
- if (instance_ap)
- return instance_ap.release();
+ if (instance_up)
+ return instance_up.release();
}
} else {
for (uint32_t idx = 0;
@@ -50,10 +49,10 @@ DynamicLoader *DynamicLoader::FindPlugin(Process *process,
PluginManager::GetDynamicLoaderCreateCallbackAtIndex(idx)) !=
nullptr;
++idx) {
- std::unique_ptr<DynamicLoader> instance_ap(
+ std::unique_ptr<DynamicLoader> instance_up(
create_callback(process, false));
- if (instance_ap)
- return instance_ap.release();
+ if (instance_up)
+ return instance_up.release();
}
}
return nullptr;
@@ -63,10 +62,8 @@ DynamicLoader::DynamicLoader(Process *process) : m_process(process) {}
DynamicLoader::~DynamicLoader() = default;
-//----------------------------------------------------------------------
// Accessosors to the global setting as to whether to stop at image (shared
// library) loading/unloading.
-//----------------------------------------------------------------------
bool DynamicLoader::GetStopWhenImagesChange() const {
return m_process->GetStopOnSharedLibraryEvents();
@@ -97,7 +94,7 @@ ModuleSP DynamicLoader::GetTargetExecutable() {
}
if (!executable) {
- executable = target.GetSharedModule(module_spec);
+ executable = target.GetOrCreateModule(module_spec, true /* notify */);
if (executable.get() != target.GetExecutableModulePointer()) {
// Don't load dependent images since we are in dyld where we will
// know and find out about all images that are loaded
@@ -167,7 +164,8 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file,
return module_sp;
}
- if ((module_sp = target.GetSharedModule(module_spec))) {
+ if ((module_sp = target.GetOrCreateModule(module_spec,
+ true /* notify */))) {
UpdateLoadedSections(module_sp, link_map_addr, base_addr,
base_addr_is_offset);
return module_sp;
@@ -203,7 +201,8 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file,
return module_sp;
}
- if ((module_sp = target.GetSharedModule(new_module_spec))) {
+ if ((module_sp = target.GetOrCreateModule(new_module_spec,
+ true /* notify */))) {
UpdateLoadedSections(module_sp, link_map_addr, base_addr, false);
return module_sp;
}
diff --git a/source/Core/EmulateInstruction.cpp b/source/Core/EmulateInstruction.cpp
index 0fcb2eb7e8cea..62942fb715b3e 100644
--- a/source/Core/EmulateInstruction.cpp
+++ b/source/Core/EmulateInstruction.cpp
@@ -1,9 +1,8 @@
//===-- EmulateInstruction.cpp ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -72,14 +71,7 @@ EmulateInstruction::FindPlugin(const ArchSpec &arch,
return nullptr;
}
-EmulateInstruction::EmulateInstruction(const ArchSpec &arch)
- : m_arch(arch), m_baton(nullptr), m_read_mem_callback(&ReadMemoryDefault),
- m_write_mem_callback(&WriteMemoryDefault),
- m_read_reg_callback(&ReadRegisterDefault),
- m_write_reg_callback(&WriteRegisterDefault),
- m_addr(LLDB_INVALID_ADDRESS) {
- ::memset(&m_opcode, 0, sizeof(m_opcode));
-}
+EmulateInstruction::EmulateInstruction(const ArchSpec &arch) : m_arch(arch) {}
bool EmulateInstruction::ReadRegister(const RegisterInfo *reg_info,
RegisterValue &reg_value) {
diff --git a/source/Core/FileLineResolver.cpp b/source/Core/FileLineResolver.cpp
index 0f4120711b246..3cba1c7e81432 100644
--- a/source/Core/FileLineResolver.cpp
+++ b/source/Core/FileLineResolver.cpp
@@ -1,9 +1,8 @@
//===-- FileLineResolver.cpp ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,9 +23,7 @@ class Address;
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// FileLineResolver:
-//----------------------------------------------------------------------
FileLineResolver::FileLineResolver(const FileSpec &file_spec, uint32_t line_no,
bool check_inlines)
: Searcher(), m_file_spec(file_spec), m_line_number(line_no),
diff --git a/source/Core/FileSpecList.cpp b/source/Core/FileSpecList.cpp
index ae4831b6efa61..95133faf7502e 100644
--- a/source/Core/FileSpecList.cpp
+++ b/source/Core/FileSpecList.cpp
@@ -1,9 +1,8 @@
//===-- FileSpecList.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -21,32 +20,17 @@ using namespace std;
FileSpecList::FileSpecList() : m_files() {}
-FileSpecList::FileSpecList(const FileSpecList &rhs) = default;
-
FileSpecList::~FileSpecList() = default;
-//------------------------------------------------------------------
-// Assignment operator
-//------------------------------------------------------------------
-const FileSpecList &FileSpecList::operator=(const FileSpecList &rhs) {
- if (this != &rhs)
- m_files = rhs.m_files;
- return *this;
-}
-
-//------------------------------------------------------------------
// Append the "file_spec" to the end of the file spec list.
-//------------------------------------------------------------------
void FileSpecList::Append(const FileSpec &file_spec) {
m_files.push_back(file_spec);
}
-//------------------------------------------------------------------
// Only append the "file_spec" if this list doesn't already contain it.
//
// Returns true if "file_spec" was added, false if this list already contained
// a copy of "file_spec".
-//------------------------------------------------------------------
bool FileSpecList::AppendIfUnique(const FileSpec &file_spec) {
collection::iterator end = m_files.end();
if (find(m_files.begin(), end, file_spec) == end) {
@@ -56,14 +40,10 @@ bool FileSpecList::AppendIfUnique(const FileSpec &file_spec) {
return false;
}
-//------------------------------------------------------------------
// Clears the file list.
-//------------------------------------------------------------------
void FileSpecList::Clear() { m_files.clear(); }
-//------------------------------------------------------------------
// Dumps the file list to the supplied stream pointer "s".
-//------------------------------------------------------------------
void FileSpecList::Dump(Stream *s, const char *separator_cstr) const {
collection::const_iterator pos, end = m_files.end();
for (pos = m_files.begin(); pos != end; ++pos) {
@@ -73,13 +53,11 @@ void FileSpecList::Dump(Stream *s, const char *separator_cstr) const {
}
}
-//------------------------------------------------------------------
// Find the index of the file in the file spec list that matches "file_spec"
// starting "start_idx" entries into the file spec list.
//
// Returns the valid index of the file that matches "file_spec" if it is found,
// else std::numeric_limits<uint32_t>::max() is returned.
-//------------------------------------------------------------------
size_t FileSpecList::FindFileIndex(size_t start_idx, const FileSpec &file_spec,
bool full) const {
const size_t num_files = m_files.size();
@@ -104,10 +82,8 @@ size_t FileSpecList::FindFileIndex(size_t start_idx, const FileSpec &file_spec,
return UINT32_MAX;
}
-//------------------------------------------------------------------
// Returns the FileSpec object at index "idx". If "idx" is out of range, then
// an empty FileSpec object will be returned.
-//------------------------------------------------------------------
const FileSpec &FileSpecList::GetFileSpecAtIndex(size_t idx) const {
if (idx < m_files.size())
return m_files[idx];
@@ -121,12 +97,10 @@ const FileSpec *FileSpecList::GetFileSpecPointerAtIndex(size_t idx) const {
return nullptr;
}
-//------------------------------------------------------------------
// Return the size in bytes that this object takes in memory. This returns the
// size in bytes of this object's member variables and any FileSpec objects its
// member variables contain, the result doesn't not include the string values
// for the directories any filenames as those are in shared string pools.
-//------------------------------------------------------------------
size_t FileSpecList::MemorySize() const {
size_t mem_size = sizeof(FileSpecList);
collection::const_iterator pos, end = m_files.end();
@@ -137,9 +111,7 @@ size_t FileSpecList::MemorySize() const {
return mem_size;
}
-//------------------------------------------------------------------
// Return the number of files in the file spec list.
-//------------------------------------------------------------------
size_t FileSpecList::GetSize() const { return m_files.size(); }
size_t FileSpecList::GetFilesMatchingPartialPath(const char *path,
diff --git a/source/Core/FormatEntity.cpp b/source/Core/FormatEntity.cpp
index 200008dcff5fd..1ffbed2cd64e6 100644
--- a/source/Core/FormatEntity.cpp
+++ b/source/Core/FormatEntity.cpp
@@ -1,9 +1,8 @@
//===-- FormatEntity.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -80,108 +79,98 @@ using namespace lldb_private;
enum FileKind { FileError = 0, Basename, Dirname, Fullpath };
-#define ENTRY(n, t, f) \
- { \
- n, nullptr, FormatEntity::Entry::Type::t, \
- FormatEntity::Entry::FormatType::f, 0, 0, nullptr, false \
- }
-#define ENTRY_VALUE(n, t, f, v) \
+#define ENTRY(n, t) \
+ { n, nullptr, FormatEntity::Entry::Type::t, 0, 0, nullptr, false }
+#define ENTRY_VALUE(n, t, v) \
+ { n, nullptr, FormatEntity::Entry::Type::t, v, 0, nullptr, false }
+#define ENTRY_CHILDREN(n, t, c) \
{ \
- n, nullptr, FormatEntity::Entry::Type::t, \
- FormatEntity::Entry::FormatType::f, v, 0, nullptr, false \
- }
-#define ENTRY_CHILDREN(n, t, f, c) \
- { \
- n, nullptr, FormatEntity::Entry::Type::t, \
- FormatEntity::Entry::FormatType::f, 0, \
+ n, nullptr, FormatEntity::Entry::Type::t, 0, \
static_cast<uint32_t>(llvm::array_lengthof(c)), c, false \
}
-#define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c) \
+#define ENTRY_CHILDREN_KEEP_SEP(n, t, c) \
{ \
- n, nullptr, FormatEntity::Entry::Type::t, \
- FormatEntity::Entry::FormatType::f, 0, \
+ n, nullptr, FormatEntity::Entry::Type::t, 0, \
static_cast<uint32_t>(llvm::array_lengthof(c)), c, true \
}
#define ENTRY_STRING(n, s) \
- { \
- n, s, FormatEntity::Entry::Type::InsertString, \
- FormatEntity::Entry::FormatType::None, 0, 0, nullptr, false \
- }
+ { n, s, FormatEntity::Entry::Type::EscapeCode, 0, 0, nullptr, false }
static FormatEntity::Entry::Definition g_string_entry[] = {
- ENTRY("*", ParentString, None)};
+ ENTRY("*", ParentString)};
static FormatEntity::Entry::Definition g_addr_entries[] = {
- ENTRY("load", AddressLoad, UInt64), ENTRY("file", AddressFile, UInt64),
- ENTRY("load", AddressLoadOrFile, UInt64),
+ ENTRY("load", AddressLoad),
+ ENTRY("file", AddressFile),
+ ENTRY("load", AddressLoadOrFile),
};
static FormatEntity::Entry::Definition g_file_child_entries[] = {
- ENTRY_VALUE("basename", ParentNumber, CString, FileKind::Basename),
- ENTRY_VALUE("dirname", ParentNumber, CString, FileKind::Dirname),
- ENTRY_VALUE("fullpath", ParentNumber, CString, FileKind::Fullpath)};
+ ENTRY_VALUE("basename", ParentNumber, FileKind::Basename),
+ ENTRY_VALUE("dirname", ParentNumber, FileKind::Dirname),
+ ENTRY_VALUE("fullpath", ParentNumber, FileKind::Fullpath)};
static FormatEntity::Entry::Definition g_frame_child_entries[] = {
- ENTRY("index", FrameIndex, UInt32),
- ENTRY("pc", FrameRegisterPC, UInt64),
- ENTRY("fp", FrameRegisterFP, UInt64),
- ENTRY("sp", FrameRegisterSP, UInt64),
- ENTRY("flags", FrameRegisterFlags, UInt64),
- ENTRY("no-debug", FrameNoDebug, None),
- ENTRY_CHILDREN("reg", FrameRegisterByName, UInt64, g_string_entry),
- ENTRY("is-artificial", FrameIsArtificial, UInt32),
+ ENTRY("index", FrameIndex),
+ ENTRY("pc", FrameRegisterPC),
+ ENTRY("fp", FrameRegisterFP),
+ ENTRY("sp", FrameRegisterSP),
+ ENTRY("flags", FrameRegisterFlags),
+ ENTRY("no-debug", FrameNoDebug),
+ ENTRY_CHILDREN("reg", FrameRegisterByName, g_string_entry),
+ ENTRY("is-artificial", FrameIsArtificial),
};
static FormatEntity::Entry::Definition g_function_child_entries[] = {
- ENTRY("id", FunctionID, UInt64), ENTRY("name", FunctionName, CString),
- ENTRY("name-without-args", FunctionNameNoArgs, CString),
- ENTRY("name-with-args", FunctionNameWithArgs, CString),
- ENTRY("addr-offset", FunctionAddrOffset, UInt64),
- ENTRY("concrete-only-addr-offset-no-padding", FunctionAddrOffsetConcrete,
- UInt64),
- ENTRY("line-offset", FunctionLineOffset, UInt64),
- ENTRY("pc-offset", FunctionPCOffset, UInt64),
- ENTRY("initial-function", FunctionInitial, None),
- ENTRY("changed", FunctionChanged, None),
- ENTRY("is-optimized", FunctionIsOptimized, None)};
+ ENTRY("id", FunctionID),
+ ENTRY("name", FunctionName),
+ ENTRY("name-without-args", FunctionNameNoArgs),
+ ENTRY("name-with-args", FunctionNameWithArgs),
+ ENTRY("addr-offset", FunctionAddrOffset),
+ ENTRY("concrete-only-addr-offset-no-padding", FunctionAddrOffsetConcrete),
+ ENTRY("line-offset", FunctionLineOffset),
+ ENTRY("pc-offset", FunctionPCOffset),
+ ENTRY("initial-function", FunctionInitial),
+ ENTRY("changed", FunctionChanged),
+ ENTRY("is-optimized", FunctionIsOptimized)};
static FormatEntity::Entry::Definition g_line_child_entries[] = {
- ENTRY_CHILDREN("file", LineEntryFile, None, g_file_child_entries),
- ENTRY("number", LineEntryLineNumber, UInt32),
- ENTRY("column", LineEntryColumn, UInt32),
- ENTRY("start-addr", LineEntryStartAddress, UInt64),
- ENTRY("end-addr", LineEntryEndAddress, UInt64),
+ ENTRY_CHILDREN("file", LineEntryFile, g_file_child_entries),
+ ENTRY("number", LineEntryLineNumber),
+ ENTRY("column", LineEntryColumn),
+ ENTRY("start-addr", LineEntryStartAddress),
+ ENTRY("end-addr", LineEntryEndAddress),
};
static FormatEntity::Entry::Definition g_module_child_entries[] = {
- ENTRY_CHILDREN("file", ModuleFile, None, g_file_child_entries),
+ ENTRY_CHILDREN("file", ModuleFile, g_file_child_entries),
};
static FormatEntity::Entry::Definition g_process_child_entries[] = {
- ENTRY("id", ProcessID, UInt64),
- ENTRY_VALUE("name", ProcessFile, CString, FileKind::Basename),
- ENTRY_CHILDREN("file", ProcessFile, None, g_file_child_entries),
+ ENTRY("id", ProcessID),
+ ENTRY_VALUE("name", ProcessFile, FileKind::Basename),
+ ENTRY_CHILDREN("file", ProcessFile, g_file_child_entries),
};
static FormatEntity::Entry::Definition g_svar_child_entries[] = {
- ENTRY("*", ParentString, None)};
+ ENTRY("*", ParentString)};
static FormatEntity::Entry::Definition g_var_child_entries[] = {
- ENTRY("*", ParentString, None)};
+ ENTRY("*", ParentString)};
static FormatEntity::Entry::Definition g_thread_child_entries[] = {
- ENTRY("id", ThreadID, UInt64),
- ENTRY("protocol_id", ThreadProtocolID, UInt64),
- ENTRY("index", ThreadIndexID, UInt32),
- ENTRY_CHILDREN("info", ThreadInfo, None, g_string_entry),
- ENTRY("queue", ThreadQueue, CString),
- ENTRY("name", ThreadName, CString),
- ENTRY("stop-reason", ThreadStopReason, CString),
- ENTRY("return-value", ThreadReturnValue, CString),
- ENTRY("completed-expression", ThreadCompletedExpression, CString),
+ ENTRY("id", ThreadID),
+ ENTRY("protocol_id", ThreadProtocolID),
+ ENTRY("index", ThreadIndexID),
+ ENTRY_CHILDREN("info", ThreadInfo, g_string_entry),
+ ENTRY("queue", ThreadQueue),
+ ENTRY("name", ThreadName),
+ ENTRY("stop-reason", ThreadStopReason),
+ ENTRY("return-value", ThreadReturnValue),
+ ENTRY("completed-expression", ThreadCompletedExpression),
};
static FormatEntity::Entry::Definition g_target_child_entries[] = {
- ENTRY("arch", TargetArch, CString),
+ ENTRY("arch", TargetArch),
};
#define _TO_STR2(_val) #_val
@@ -224,8 +213,8 @@ static FormatEntity::Entry::Definition g_ansi_bg_entries[] = {
};
static FormatEntity::Entry::Definition g_ansi_entries[] = {
- ENTRY_CHILDREN("fg", Invalid, None, g_ansi_fg_entries),
- ENTRY_CHILDREN("bg", Invalid, None, g_ansi_bg_entries),
+ ENTRY_CHILDREN("fg", Invalid, g_ansi_fg_entries),
+ ENTRY_CHILDREN("bg", Invalid, g_ansi_bg_entries),
ENTRY_STRING("normal",
ANSI_ESC_START _TO_STR(ANSI_CTRL_NORMAL) ANSI_ESC_END),
ENTRY_STRING("bold", ANSI_ESC_START _TO_STR(ANSI_CTRL_BOLD) ANSI_ESC_END),
@@ -247,37 +236,33 @@ static FormatEntity::Entry::Definition g_ansi_entries[] = {
};
static FormatEntity::Entry::Definition g_script_child_entries[] = {
- ENTRY("frame", ScriptFrame, None),
- ENTRY("process", ScriptProcess, None),
- ENTRY("target", ScriptTarget, None),
- ENTRY("thread", ScriptThread, None),
- ENTRY("var", ScriptVariable, None),
- ENTRY("svar", ScriptVariableSynthetic, None),
- ENTRY("thread", ScriptThread, None),
+ ENTRY("frame", ScriptFrame), ENTRY("process", ScriptProcess),
+ ENTRY("target", ScriptTarget), ENTRY("thread", ScriptThread),
+ ENTRY("var", ScriptVariable), ENTRY("svar", ScriptVariableSynthetic),
+ ENTRY("thread", ScriptThread),
};
static FormatEntity::Entry::Definition g_top_level_entries[] = {
- ENTRY_CHILDREN("addr", AddressLoadOrFile, UInt64, g_addr_entries),
- ENTRY("addr-file-or-load", AddressLoadOrFile, UInt64),
- ENTRY_CHILDREN("ansi", Invalid, None, g_ansi_entries),
- ENTRY("current-pc-arrow", CurrentPCArrow, CString),
- ENTRY_CHILDREN("file", File, CString, g_file_child_entries),
- ENTRY("language", Lang, CString),
- ENTRY_CHILDREN("frame", Invalid, None, g_frame_child_entries),
- ENTRY_CHILDREN("function", Invalid, None, g_function_child_entries),
- ENTRY_CHILDREN("line", Invalid, None, g_line_child_entries),
- ENTRY_CHILDREN("module", Invalid, None, g_module_child_entries),
- ENTRY_CHILDREN("process", Invalid, None, g_process_child_entries),
- ENTRY_CHILDREN("script", Invalid, None, g_script_child_entries),
- ENTRY_CHILDREN_KEEP_SEP("svar", VariableSynthetic, None,
- g_svar_child_entries),
- ENTRY_CHILDREN("thread", Invalid, None, g_thread_child_entries),
- ENTRY_CHILDREN("target", Invalid, None, g_target_child_entries),
- ENTRY_CHILDREN_KEEP_SEP("var", Variable, None, g_var_child_entries),
+ ENTRY_CHILDREN("addr", AddressLoadOrFile, g_addr_entries),
+ ENTRY("addr-file-or-load", AddressLoadOrFile),
+ ENTRY_CHILDREN("ansi", Invalid, g_ansi_entries),
+ ENTRY("current-pc-arrow", CurrentPCArrow),
+ ENTRY_CHILDREN("file", File, g_file_child_entries),
+ ENTRY("language", Lang),
+ ENTRY_CHILDREN("frame", Invalid, g_frame_child_entries),
+ ENTRY_CHILDREN("function", Invalid, g_function_child_entries),
+ ENTRY_CHILDREN("line", Invalid, g_line_child_entries),
+ ENTRY_CHILDREN("module", Invalid, g_module_child_entries),
+ ENTRY_CHILDREN("process", Invalid, g_process_child_entries),
+ ENTRY_CHILDREN("script", Invalid, g_script_child_entries),
+ ENTRY_CHILDREN_KEEP_SEP("svar", VariableSynthetic, g_svar_child_entries),
+ ENTRY_CHILDREN("thread", Invalid, g_thread_child_entries),
+ ENTRY_CHILDREN("target", Invalid, g_target_child_entries),
+ ENTRY_CHILDREN_KEEP_SEP("var", Variable, g_var_child_entries),
};
static FormatEntity::Entry::Definition g_root =
- ENTRY_CHILDREN("<root>", Root, None, g_top_level_entries);
+ ENTRY_CHILDREN("<root>", Root, g_top_level_entries);
FormatEntity::Entry::Entry(llvm::StringRef s)
: string(s.data(), s.size()), printf_format(), children(),
@@ -322,7 +307,7 @@ const char *FormatEntity::Entry::TypeToCString(Type t) {
ENUM_TO_CSTR(Invalid);
ENUM_TO_CSTR(ParentNumber);
ENUM_TO_CSTR(ParentString);
- ENUM_TO_CSTR(InsertString);
+ ENUM_TO_CSTR(EscapeCode);
ENUM_TO_CSTR(Root);
ENUM_TO_CSTR(String);
ENUM_TO_CSTR(Scope);
@@ -411,7 +396,7 @@ static bool RunScriptFormatKeyword(Stream &s, const SymbolContext *sc,
if (target) {
ScriptInterpreter *script_interpreter =
- target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ target->GetDebugger().GetScriptInterpreter();
if (script_interpreter) {
Status error;
std::string script_output;
@@ -477,9 +462,8 @@ static bool DumpAddressOffsetFromFunction(Stream &s, const SymbolContext *sc,
// can be discontiguous.
Block *inline_block = sc->block->GetContainingInlinedBlock();
AddressRange inline_range;
- if (inline_block &&
- inline_block->GetRangeContainingAddress(format_addr,
- inline_range))
+ if (inline_block && inline_block->GetRangeContainingAddress(
+ format_addr, inline_range))
func_addr = inline_range.GetBaseAddress();
}
} else if (sc->symbol && sc->symbol->ValueIsAddress())
@@ -1118,9 +1102,18 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
// FormatEntity::Entry::Definition encoding
case Entry::Type::ParentString: // Only used for
// FormatEntity::Entry::Definition encoding
- case Entry::Type::InsertString: // Only used for
- // FormatEntity::Entry::Definition encoding
return false;
+ case Entry::Type::EscapeCode:
+ if (exe_ctx) {
+ if (Target *target = exe_ctx->GetTargetPtr()) {
+ Debugger &debugger = target->GetDebugger();
+ if (debugger.GetUseColor()) {
+ s.PutCString(entry.string);
+ }
+ }
+ }
+ // Always return true, so colors being disabled is transparent.
+ return true;
case Entry::Type::Root:
for (const auto &child : entry.children) {
@@ -1715,8 +1708,9 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,
var_representation = buffer;
} else
var_value_sp->DumpPrintableRepresentation(
- ss, ValueObject::ValueObjectRepresentationStyle::
- eValueObjectRepresentationStyleSummary,
+ ss,
+ ValueObject::ValueObjectRepresentationStyle::
+ eValueObjectRepresentationStyleSummary,
eFormatDefault,
ValueObject::PrintableRepresentationSpecialCases::eAllow,
false);
@@ -1911,7 +1905,7 @@ static Status ParseEntry(const llvm::StringRef &format_str,
entry.number = entry_def->data;
return error; // Success
- case FormatEntity::Entry::Type::InsertString:
+ case FormatEntity::Entry::Type::EscapeCode:
entry.type = entry_def->type;
entry.string = entry_def->string;
return error; // Success
@@ -2280,13 +2274,7 @@ Status FormatEntity::ParseInternal(llvm::StringRef &format, Entry &parent_entry,
return error;
}
}
- // Check if this entry just wants to insert a constant string value
- // into the parent_entry, if so, insert the string with AppendText,
- // else append the entry to the parent_entry.
- if (entry.type == Entry::Type::InsertString)
- parent_entry.AppendText(entry.string.c_str());
- else
- parent_entry.AppendEntry(std::move(entry));
+ parent_entry.AppendEntry(std::move(entry));
}
}
break;
diff --git a/source/Core/Highlighter.cpp b/source/Core/Highlighter.cpp
index c7dd0db83645f..0b0aa969bf654 100644
--- a/source/Core/Highlighter.cpp
+++ b/source/Core/Highlighter.cpp
@@ -1,9 +1,8 @@
//===-- Highlighter.cpp -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/IOHandler.cpp b/source/Core/IOHandler.cpp
index 5c0eea5ea1a3f..b30308490cca5 100644
--- a/source/Core/IOHandler.cpp
+++ b/source/Core/IOHandler.cpp
@@ -1,9 +1,8 @@
//===-- IOHandler.cpp -------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -77,16 +76,19 @@ IOHandler::IOHandler(Debugger &debugger, IOHandler::Type type)
StreamFileSP(), // Adopt STDIN from top input reader
StreamFileSP(), // Adopt STDOUT from top input reader
StreamFileSP(), // Adopt STDERR from top input reader
- 0) // Flags
-{}
+ 0, // Flags
+ nullptr // Shadow file recorder
+ ) {}
IOHandler::IOHandler(Debugger &debugger, IOHandler::Type type,
const lldb::StreamFileSP &input_sp,
const lldb::StreamFileSP &output_sp,
- const lldb::StreamFileSP &error_sp, uint32_t flags)
+ const lldb::StreamFileSP &error_sp, uint32_t flags,
+ repro::DataRecorder *data_recorder)
: m_debugger(debugger), m_input_sp(input_sp), m_output_sp(output_sp),
- m_error_sp(error_sp), m_popped(false), m_flags(flags), m_type(type),
- m_user_data(nullptr), m_done(false), m_active(false) {
+ m_error_sp(error_sp), m_data_recorder(data_recorder), m_popped(false),
+ m_flags(flags), m_type(type), m_user_data(nullptr), m_done(false),
+ m_active(false) {
// If any files are not specified, then adopt them from the top input reader.
if (!m_input_sp || !m_output_sp || !m_error_sp)
debugger.AdoptTopIOHandlerFilesIfInvalid(m_input_sp, m_output_sp,
@@ -154,7 +156,7 @@ IOHandlerConfirm::IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt,
llvm::StringRef(), // No continuation prompt
false, // Multi-line
false, // Don't colorize the prompt (i.e. the confirm message.)
- 0, *this),
+ 0, *this, nullptr),
m_default_response(default_response), m_user_response(default_response) {
StreamString prompt_stream;
prompt_stream.PutCString(prompt);
@@ -265,7 +267,7 @@ IOHandlerEditline::IOHandlerEditline(
const char *editline_name, // Used for saving history files
llvm::StringRef prompt, llvm::StringRef continuation_prompt,
bool multi_line, bool color_prompts, uint32_t line_number_start,
- IOHandlerDelegate &delegate)
+ IOHandlerDelegate &delegate, repro::DataRecorder *data_recorder)
: IOHandlerEditline(debugger, type,
StreamFileSP(), // Inherit input from top input reader
StreamFileSP(), // Inherit output from top input reader
@@ -273,7 +275,7 @@ IOHandlerEditline::IOHandlerEditline(
0, // Flags
editline_name, // Used for saving history files
prompt, continuation_prompt, multi_line, color_prompts,
- line_number_start, delegate) {}
+ line_number_start, delegate, data_recorder) {}
IOHandlerEditline::IOHandlerEditline(
Debugger &debugger, IOHandler::Type type,
@@ -282,10 +284,11 @@ IOHandlerEditline::IOHandlerEditline(
const char *editline_name, // Used for saving history files
llvm::StringRef prompt, llvm::StringRef continuation_prompt,
bool multi_line, bool color_prompts, uint32_t line_number_start,
- IOHandlerDelegate &delegate)
- : IOHandler(debugger, type, input_sp, output_sp, error_sp, flags),
+ IOHandlerDelegate &delegate, repro::DataRecorder *data_recorder)
+ : IOHandler(debugger, type, input_sp, output_sp, error_sp, flags,
+ data_recorder),
#ifndef LLDB_DISABLE_LIBEDIT
- m_editline_ap(),
+ m_editline_up(),
#endif
m_delegate(delegate), m_prompt(), m_continuation_prompt(),
m_current_lines_ptr(nullptr), m_base_line_number(line_number_start),
@@ -300,17 +303,17 @@ IOHandlerEditline::IOHandlerEditline(
use_editline = m_input_sp->GetFile().GetIsRealTerminal();
if (use_editline) {
- m_editline_ap.reset(new Editline(editline_name, GetInputFILE(),
+ m_editline_up.reset(new Editline(editline_name, GetInputFILE(),
GetOutputFILE(), GetErrorFILE(),
m_color_prompts));
- m_editline_ap->SetIsInputCompleteCallback(IsInputCompleteCallback, this);
- m_editline_ap->SetAutoCompleteCallback(AutoCompleteCallback, this);
+ m_editline_up->SetIsInputCompleteCallback(IsInputCompleteCallback, this);
+ m_editline_up->SetAutoCompleteCallback(AutoCompleteCallback, this);
// See if the delegate supports fixing indentation
const char *indent_chars = delegate.IOHandlerGetFixIndentationCharacters();
if (indent_chars) {
// The delegate does support indentation, hook it up so when any
// indentation character is typed, the delegate gets a chance to fix it
- m_editline_ap->SetFixIndentationCallback(FixIndentationCallback, this,
+ m_editline_up->SetFixIndentationCallback(FixIndentationCallback, this,
indent_chars);
}
}
@@ -322,13 +325,13 @@ IOHandlerEditline::IOHandlerEditline(
IOHandlerEditline::~IOHandlerEditline() {
#ifndef LLDB_DISABLE_LIBEDIT
- m_editline_ap.reset();
+ m_editline_up.reset();
#endif
}
void IOHandlerEditline::Activate() {
IOHandler::Activate();
- m_delegate.IOHandlerActivated(*this);
+ m_delegate.IOHandlerActivated(*this, GetIsInteractive());
}
void IOHandlerEditline::Deactivate() {
@@ -338,8 +341,11 @@ void IOHandlerEditline::Deactivate() {
bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap) {
- return m_editline_ap->GetLine(line, interrupted);
+ if (m_editline_up) {
+ bool b = m_editline_up->GetLine(line, interrupted);
+ if (m_data_recorder)
+ m_data_recorder->Record(line, true);
+ return b;
} else {
#endif
line.clear();
@@ -368,7 +374,18 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
bool got_line = false;
m_editing = true;
while (!done) {
+#ifdef _WIN32
+ // ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED
+ // according to the docs on MSDN. However, this has evidently been a
+ // known bug since Windows 8. Therefore, we can't detect if a signal
+ // interrupted in the fgets. So pressing ctrl-c causes the repl to end
+ // and the process to exit. A temporary workaround is just to attempt to
+ // fgets twice until this bug is fixed.
+ if (fgets(buffer, sizeof(buffer), in) == nullptr &&
+ fgets(buffer, sizeof(buffer), in) == nullptr) {
+#else
if (fgets(buffer, sizeof(buffer), in) == nullptr) {
+#endif
const int saved_errno = errno;
if (feof(in))
done = true;
@@ -395,6 +412,8 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
}
}
m_editing = false;
+ if (m_data_recorder && got_line)
+ m_data_recorder->Record(line, true);
// We might have gotten a newline on a line by itself make sure to return
// true in this case.
return got_line;
@@ -441,8 +460,8 @@ int IOHandlerEditline::AutoCompleteCallback(
const char *IOHandlerEditline::GetPrompt() {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap) {
- return m_editline_ap->GetPrompt();
+ if (m_editline_up) {
+ return m_editline_up->GetPrompt();
} else {
#endif
if (m_prompt.empty())
@@ -457,8 +476,8 @@ bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) {
m_prompt = prompt;
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str());
+ if (m_editline_up)
+ m_editline_up->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str());
#endif
return true;
}
@@ -472,8 +491,8 @@ void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) {
m_continuation_prompt = prompt;
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->SetContinuationPrompt(m_continuation_prompt.empty()
+ if (m_editline_up)
+ m_editline_up->SetContinuationPrompt(m_continuation_prompt.empty()
? nullptr
: m_continuation_prompt.c_str());
#endif
@@ -485,8 +504,8 @@ void IOHandlerEditline::SetBaseLineNumber(uint32_t line) {
uint32_t IOHandlerEditline::GetCurrentLineIndex() const {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- return m_editline_ap->GetCurrentLine();
+ if (m_editline_up)
+ return m_editline_up->GetCurrentLine();
#endif
return m_curr_line_idx;
}
@@ -496,8 +515,8 @@ bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) {
bool success = false;
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap) {
- return m_editline_ap->GetLines(m_base_line_number, lines, interrupted);
+ if (m_editline_up) {
+ return m_editline_up->GetLines(m_base_line_number, lines, interrupted);
} else {
#endif
bool done = false;
@@ -565,8 +584,8 @@ void IOHandlerEditline::Run() {
void IOHandlerEditline::Cancel() {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->Cancel();
+ if (m_editline_up)
+ m_editline_up->Cancel();
#endif
}
@@ -576,23 +595,23 @@ bool IOHandlerEditline::Interrupt() {
return true;
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- return m_editline_ap->Interrupt();
+ if (m_editline_up)
+ return m_editline_up->Interrupt();
#endif
return false;
}
void IOHandlerEditline::GotEOF() {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->Interrupt();
+ if (m_editline_up)
+ m_editline_up->Interrupt();
#endif
}
void IOHandlerEditline::PrintAsync(Stream *stream, const char *s, size_t len) {
#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->PrintAsync(stream, s, len);
+ if (m_editline_up)
+ m_editline_up->PrintAsync(stream, s, len);
else
#endif
{
@@ -994,20 +1013,15 @@ public:
WindowSP CreateSubWindow(const char *name, const Rect &bounds,
bool make_active) {
- WindowSP subwindow_sp;
- if (m_window) {
- subwindow_sp.reset(new Window(
- name, ::subwin(m_window, bounds.size.height, bounds.size.width,
- bounds.origin.y, bounds.origin.x),
- true));
- subwindow_sp->m_is_subwin = true;
- } else {
- subwindow_sp.reset(
- new Window(name, ::newwin(bounds.size.height, bounds.size.width,
- bounds.origin.y, bounds.origin.x),
- true));
- subwindow_sp->m_is_subwin = false;
- }
+ auto get_window = [this, &bounds]() {
+ return m_window
+ ? ::subwin(m_window, bounds.size.height, bounds.size.width,
+ bounds.origin.y, bounds.origin.x)
+ : ::newwin(bounds.size.height, bounds.size.width,
+ bounds.origin.y, bounds.origin.x);
+ };
+ WindowSP subwindow_sp = std::make_shared<Window>(name, get_window(), true);
+ subwindow_sp->m_is_subwin = subwindow_sp.operator bool();
subwindow_sp->m_parent = this;
if (make_active) {
m_prev_active_window_idx = m_curr_active_window_idx;
@@ -1075,9 +1089,7 @@ public:
operator WINDOW *() { return m_window; }
- //----------------------------------------------------------------------
// Window drawing utilities
- //----------------------------------------------------------------------
void DrawTitleBox(const char *title, const char *bottom_message = nullptr) {
attr_t attr = 0;
if (IsActive())
@@ -1128,10 +1140,10 @@ public:
const char *text = m_delegate_sp->WindowDelegateGetHelpText();
KeyHelp *key_help = m_delegate_sp->WindowDelegateGetKeyHelp();
if ((text && text[0]) || key_help) {
- std::unique_ptr<HelpDialogDelegate> help_delegate_ap(
+ std::unique_ptr<HelpDialogDelegate> help_delegate_up(
new HelpDialogDelegate(text, key_help));
- const size_t num_lines = help_delegate_ap->GetNumLines();
- const size_t max_length = help_delegate_ap->GetMaxLineLength();
+ const size_t num_lines = help_delegate_up->GetNumLines();
+ const size_t max_length = help_delegate_up->GetMaxLineLength();
Rect bounds = GetBounds();
bounds.Inset(1, 1);
if (max_length + 4 < static_cast<size_t>(bounds.size.width)) {
@@ -1162,7 +1174,7 @@ public:
else
help_window_sp = CreateSubWindow("Help", bounds, true);
help_window_sp->SetDelegate(
- WindowDelegateSP(help_delegate_ap.release()));
+ WindowDelegateSP(help_delegate_up.release()));
return true;
}
}
@@ -1882,7 +1894,7 @@ public:
WindowSP &GetMainWindow() {
if (!m_window_sp)
- m_window_sp.reset(new Window("main", stdscr, false));
+ m_window_sp = std::make_shared<Window>("main", stdscr, false);
return m_window_sp;
}
@@ -2509,7 +2521,7 @@ public:
return; // Children are already up to date
if (!m_frame_delegate_sp) {
// Always expand the thread item the first time we show it
- m_frame_delegate_sp.reset(new FrameTreeDelegate());
+ m_frame_delegate_sp = std::make_shared<FrameTreeDelegate>();
}
m_stop_id = process_sp->GetStopID();
@@ -2601,7 +2613,8 @@ public:
if (!m_thread_delegate_sp) {
// Always expand the thread item the first time we show it
// item.Expand();
- m_thread_delegate_sp.reset(new ThreadTreeDelegate(m_debugger));
+ m_thread_delegate_sp =
+ std::make_shared<ThreadTreeDelegate>(m_debugger);
}
TreeItem t(&item, *m_thread_delegate_sp, false);
@@ -3934,12 +3947,10 @@ public:
m_debugger.GetSourceManager().GetFile(m_sc.line_entry.file);
if (m_file_sp) {
const size_t num_lines = m_file_sp->GetNumLines();
- int m_line_width = 1;
+ m_line_width = 1;
for (size_t n = num_lines; n >= 10; n = n / 10)
++m_line_width;
- snprintf(m_line_format, sizeof(m_line_format), " %%%iu ",
- m_line_width);
if (num_lines < num_visible_lines ||
m_selected_line < num_visible_lines)
m_first_visible_line = 0;
@@ -4056,7 +4067,7 @@ public:
if (bp_attr)
window.AttributeOn(bp_attr);
- window.Printf(m_line_format, curr_line + 1);
+ window.Printf(" %*u ", m_line_width, curr_line + 1);
if (bp_attr)
window.AttributeOff(bp_attr);
@@ -4482,7 +4493,6 @@ protected:
AddressRange m_disassembly_range;
StreamString m_title;
lldb::user_id_t m_tid;
- char m_line_format[8];
int m_line_width;
uint32_t m_selected_line; // The selected line
uint32_t m_pc_line; // The line with the PC
diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp
index 943df008edadd..c6759cc944ca9 100644
--- a/source/Core/Mangled.cpp
+++ b/source/Core/Mangled.cpp
@@ -1,9 +1,8 @@
//===-- Mangled.cpp ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -73,7 +72,7 @@ static inline bool cstring_is_mangled(const char *s) {
return cstring_mangling_scheme(s) != Mangled::eManglingSchemeNone;
}
-static const ConstString &
+static ConstString
get_demangled_name_without_arguments(ConstString mangled,
ConstString demangled) {
// This pair is <mangled name, demangled name without function arguments>
@@ -125,16 +124,12 @@ get_demangled_name_without_arguments(ConstString mangled,
}
#pragma mark Mangled
-//----------------------------------------------------------------------
// Default constructor
-//----------------------------------------------------------------------
Mangled::Mangled() : m_mangled(), m_demangled() {}
-//----------------------------------------------------------------------
// Constructor with an optional string and a boolean indicating if it is the
// mangled version.
-//----------------------------------------------------------------------
-Mangled::Mangled(const ConstString &s, bool mangled)
+Mangled::Mangled(ConstString s, bool mangled)
: m_mangled(), m_demangled() {
if (s)
SetValue(s, mangled);
@@ -145,7 +140,7 @@ Mangled::Mangled(llvm::StringRef name, bool is_mangled) {
SetValue(ConstString(name), is_mangled);
}
-Mangled::Mangled(const ConstString &s) : m_mangled(), m_demangled() {
+Mangled::Mangled(ConstString s) : m_mangled(), m_demangled() {
if (s)
SetValue(s);
}
@@ -155,55 +150,43 @@ Mangled::Mangled(llvm::StringRef name) {
SetValue(ConstString(name));
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
Mangled::~Mangled() {}
-//----------------------------------------------------------------------
// Convert to pointer operator. This allows code to check any Mangled objects
// to see if they contain anything valid using code such as:
//
// Mangled mangled(...);
// if (mangled)
// { ...
-//----------------------------------------------------------------------
Mangled::operator void *() const {
- return (m_mangled) ? const_cast<Mangled *>(this) : NULL;
+ return (m_mangled) ? const_cast<Mangled *>(this) : nullptr;
}
-//----------------------------------------------------------------------
// Logical NOT operator. This allows code to check any Mangled objects to see
// if they are invalid using code such as:
//
// Mangled mangled(...);
// if (!file_spec)
// { ...
-//----------------------------------------------------------------------
bool Mangled::operator!() const { return !m_mangled; }
-//----------------------------------------------------------------------
// Clear the mangled and demangled values.
-//----------------------------------------------------------------------
void Mangled::Clear() {
m_mangled.Clear();
m_demangled.Clear();
}
-//----------------------------------------------------------------------
// Compare the string values.
-//----------------------------------------------------------------------
int Mangled::Compare(const Mangled &a, const Mangled &b) {
return ConstString::Compare(
a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled),
b.GetName(lldb::eLanguageTypeUnknown, ePreferMangled));
}
-//----------------------------------------------------------------------
// Set the string value in this objects. If "mangled" is true, then the mangled
// named is set with the new value in "s", else the demangled name is set.
-//----------------------------------------------------------------------
-void Mangled::SetValue(const ConstString &s, bool mangled) {
+void Mangled::SetValue(ConstString s, bool mangled) {
if (s) {
if (mangled) {
m_demangled.Clear();
@@ -218,7 +201,7 @@ void Mangled::SetValue(const ConstString &s, bool mangled) {
}
}
-void Mangled::SetValue(const ConstString &name) {
+void Mangled::SetValue(ConstString name) {
if (name) {
if (cstring_is_mangled(name.GetCString())) {
m_demangled.Clear();
@@ -233,9 +216,7 @@ void Mangled::SetValue(const ConstString &name) {
}
}
-//----------------------------------------------------------------------
// Local helpers for different demangling implementations.
-//----------------------------------------------------------------------
static char *GetMSVCDemangledStr(const char *M) {
#if defined(_MSC_VER)
const size_t demangled_length = 2048;
@@ -288,10 +269,8 @@ static char *GetItaniumDemangledStr(const char *M) {
return demangled_cstr;
}
-//----------------------------------------------------------------------
// Explicit demangling for scheduled requests during batch processing. This
// makes use of ItaniumPartialDemangler's rich demangle info
-//----------------------------------------------------------------------
bool Mangled::DemangleWithRichManglingInfo(
RichManglingContext &context, SkipMangledNameFn *skip_mangled_name) {
// We need to generate and cache the demangled name.
@@ -357,13 +336,11 @@ bool Mangled::DemangleWithRichManglingInfo(
llvm_unreachable("Fully covered switch above!");
}
-//----------------------------------------------------------------------
// Generate the demangled name on demand using this accessor. Code in this
// class will need to use this accessor if it wishes to decode the demangled
// name. The result is cached and will be kept until a new string value is
// supplied to this object, or until the end of the object's lifetime.
-//----------------------------------------------------------------------
-const ConstString &
+ConstString
Mangled::GetDemangledName(lldb::LanguageType language) const {
// Check to make sure we have a valid mangled name and that we haven't
// already decoded our mangled name.
@@ -422,9 +399,7 @@ bool Mangled::NameMatches(const RegularExpression &regex,
return demangled && regex.Execute(demangled.AsCString());
}
-//----------------------------------------------------------------------
// Get the demangled name if there is one, else return the mangled name.
-//----------------------------------------------------------------------
ConstString Mangled::GetName(lldb::LanguageType language,
Mangled::NamePreference preference) const {
if (preference == ePreferMangled && m_mangled)
@@ -445,10 +420,8 @@ ConstString Mangled::GetName(lldb::LanguageType language,
return demangled;
}
-//----------------------------------------------------------------------
// Dump a Mangled object to stream "s". We don't force our demangled name to be
// computed currently (we don't use the accessor).
-//----------------------------------------------------------------------
void Mangled::Dump(Stream *s) const {
if (m_mangled) {
*s << ", mangled = " << m_mangled;
@@ -459,10 +432,8 @@ void Mangled::Dump(Stream *s) const {
}
}
-//----------------------------------------------------------------------
// Dumps a debug version of this string with extra object and state information
// to stream "s".
-//----------------------------------------------------------------------
void Mangled::DumpDebug(Stream *s) const {
s->Printf("%*p: Mangled mangled = ", static_cast<int>(sizeof(void *) * 2),
static_cast<const void *>(this));
@@ -471,33 +442,27 @@ void Mangled::DumpDebug(Stream *s) const {
m_demangled.DumpDebug(s);
}
-//----------------------------------------------------------------------
// Return the size in byte that this object takes in memory. The size includes
// the size of the objects it owns, and not the strings that it references
// because they are shared strings.
-//----------------------------------------------------------------------
size_t Mangled::MemorySize() const {
return m_mangled.MemorySize() + m_demangled.MemorySize();
}
-//----------------------------------------------------------------------
// We "guess" the language because we can't determine a symbol's language from
// it's name. For example, a Pascal symbol can be mangled using the C++
// Itanium scheme, and defined in a compilation unit within the same module as
// other C++ units. In addition, different targets could have different ways
// of mangling names from a given language, likewise the compilation units
// within those targets.
-//----------------------------------------------------------------------
lldb::LanguageType Mangled::GuessLanguage() const {
ConstString mangled = GetMangledName();
if (mangled) {
- if (GetDemangledName(lldb::eLanguageTypeUnknown)) {
- const char *mangled_name = mangled.GetCString();
- if (CPlusPlusLanguage::IsCPPMangledName(mangled_name))
- return lldb::eLanguageTypeC_plus_plus;
- else if (ObjCLanguage::IsPossibleObjCMethodName(mangled_name))
- return lldb::eLanguageTypeObjC;
- }
+ const char *mangled_name = mangled.GetCString();
+ if (CPlusPlusLanguage::IsCPPMangledName(mangled_name))
+ return lldb::eLanguageTypeC_plus_plus;
+ else if (ObjCLanguage::IsPossibleObjCMethodName(mangled_name))
+ return lldb::eLanguageTypeObjC;
} else {
// ObjC names aren't really mangled, so they won't necessarily be in the
// mangled name slot.
@@ -510,14 +475,12 @@ lldb::LanguageType Mangled::GuessLanguage() const {
return lldb::eLanguageTypeUnknown;
}
-//----------------------------------------------------------------------
// Dump OBJ to the supplied stream S.
-//----------------------------------------------------------------------
Stream &operator<<(Stream &s, const Mangled &obj) {
if (obj.GetMangledName())
s << "mangled = '" << obj.GetMangledName() << "'";
- const ConstString &demangled =
+ ConstString demangled =
obj.GetDemangledName(lldb::eLanguageTypeUnknown);
if (demangled)
s << ", demangled = '" << demangled << '\'';
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index b48d3cca092b7..153d5a7409367 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -1,9 +1,8 @@
//===-- Module.cpp ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -278,8 +277,8 @@ Module::~Module() {
// function calls back into this module object. The ordering is important
// here because symbol files can require the module object file. So we tear
// down the symbol file first, then the object file.
- m_sections_ap.reset();
- m_symfile_ap.reset();
+ m_sections_up.reset();
+ m_symfile_up.reset();
m_objfile_sp.reset();
}
@@ -292,13 +291,13 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (process_sp) {
m_did_load_objfile = true;
- auto data_ap = llvm::make_unique<DataBufferHeap>(size_to_read, 0);
+ auto data_up = llvm::make_unique<DataBufferHeap>(size_to_read, 0);
Status readmem_error;
const size_t bytes_read =
- process_sp->ReadMemory(header_addr, data_ap->GetBytes(),
- data_ap->GetByteSize(), readmem_error);
+ process_sp->ReadMemory(header_addr, data_up->GetBytes(),
+ data_up->GetByteSize(), readmem_error);
if (bytes_read == size_to_read) {
- DataBufferSP data_sp(data_ap.release());
+ DataBufferSP data_sp(data_up.release());
m_objfile_sp = ObjectFile::FindPlugin(shared_from_this(), process_sp,
header_addr, data_sp);
if (m_objfile_sp) {
@@ -310,6 +309,10 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
// file's architecture since it might differ in vendor/os if some
// parts were unknown.
m_arch = m_objfile_sp->GetArchitecture();
+
+ // Augment the arch with the target's information in case
+ // we are unable to extract the os/environment from memory.
+ m_arch.MergeFrom(process_sp->GetTarget().GetArchitecture());
} else {
error.SetErrorString("unable to find suitable object file plug-in");
}
@@ -331,7 +334,7 @@ const lldb_private::UUID &Module::GetUUID() {
ObjectFile *obj_file = GetObjectFile();
if (obj_file != nullptr) {
- obj_file->GetUUID(&m_uuid);
+ m_uuid = obj_file->GetUUID();
m_did_set_uuid = true;
}
}
@@ -595,7 +598,7 @@ uint32_t Module::ResolveSymbolContextsForFileSpec(
return sc_list.GetSize() - initial_count;
}
-size_t Module::FindGlobalVariables(const ConstString &name,
+size_t Module::FindGlobalVariables(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches,
VariableList &variables) {
@@ -635,7 +638,7 @@ size_t Module::FindCompileUnits(const FileSpec &path, bool append,
return sc_list.GetSize() - start_size;
}
-Module::LookupInfo::LookupInfo(const ConstString &name,
+Module::LookupInfo::LookupInfo(ConstString name,
FunctionNameType name_type_mask,
LanguageType language)
: m_name(name), m_lookup_name(), m_language(language),
@@ -795,7 +798,7 @@ void Module::LookupInfo::Prune(SymbolContextList &sc_list,
}
}
-size_t Module::FindFunctions(const ConstString &name,
+size_t Module::FindFunctions(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
FunctionNameType name_type_mask,
bool include_symbols, bool include_inlines,
@@ -943,7 +946,7 @@ void Module::FindAddressesForLine(const lldb::TargetSP target_sp,
}
size_t Module::FindTypes_Impl(
- const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+ ConstString name, const CompilerDeclContext *parent_decl_ctx,
bool append, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types) {
@@ -956,7 +959,7 @@ size_t Module::FindTypes_Impl(
return 0;
}
-size_t Module::FindTypesInNamespace(const ConstString &type_name,
+size_t Module::FindTypesInNamespace(ConstString type_name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches, TypeList &type_list) {
const bool append = true;
@@ -974,7 +977,7 @@ size_t Module::FindTypesInNamespace(const ConstString &type_name,
}
lldb::TypeSP Module::FindFirstType(const SymbolContext &sc,
- const ConstString &name, bool exact_match) {
+ ConstString name, bool exact_match) {
TypeList type_list;
llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
const size_t num_matches =
@@ -985,7 +988,7 @@ lldb::TypeSP Module::FindFirstType(const SymbolContext &sc,
}
size_t Module::FindTypes(
- const ConstString &name, bool exact_match, size_t max_matches,
+ ConstString name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeList &types) {
size_t num_matches = 0;
@@ -1050,17 +1053,17 @@ SymbolVendor *Module::GetSymbolVendor(bool can_create,
if (obj_file != nullptr) {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
- m_symfile_ap.reset(
+ m_symfile_up.reset(
SymbolVendor::FindPlugin(shared_from_this(), feedback_strm));
m_did_load_symbol_vendor = true;
}
}
}
- return m_symfile_ap.get();
+ return m_symfile_up.get();
}
void Module::SetFileSpecAndObjectName(const FileSpec &file,
- const ConstString &object_name) {
+ ConstString object_name) {
// Container objects whose paths do not specify a file directly can call this
// function to correct the file and object names.
m_file = file;
@@ -1117,7 +1120,7 @@ void Module::ReportError(const char *format, ...) {
const int format_len = strlen(format);
if (format_len > 0) {
const char last_char = format[format_len - 1];
- if (last_char != '\n' || last_char != '\r')
+ if (last_char != '\n' && last_char != '\r')
strm.EOL();
}
Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
@@ -1149,7 +1152,7 @@ void Module::ReportErrorIfModifyDetected(const char *format, ...) {
const int format_len = strlen(format);
if (format_len > 0) {
const char last_char = format[format_len - 1];
- if (last_char != '\n' || last_char != '\r')
+ if (last_char != '\n' && last_char != '\r')
strm.EOL();
}
strm.PutCString("The debug session should be aborted as the original "
@@ -1175,7 +1178,7 @@ void Module::ReportWarning(const char *format, ...) {
const int format_len = strlen(format);
if (format_len > 0) {
const char last_char = format[format_len - 1];
- if (last_char != '\n' || last_char != '\r')
+ if (last_char != '\n' && last_char != '\r')
strm.EOL();
}
Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetData());
@@ -1243,7 +1246,7 @@ TypeList *Module::GetTypeList() {
return nullptr;
}
-const ConstString &Module::GetObjectName() const { return m_object_name; }
+ConstString Module::GetObjectName() const { return m_object_name; }
ObjectFile *Module::GetObjectFile() {
if (!m_did_load_objfile.load()) {
@@ -1279,13 +1282,13 @@ ObjectFile *Module::GetObjectFile() {
}
SectionList *Module::GetSectionList() {
- // Populate m_sections_ap with sections from objfile.
- if (!m_sections_ap) {
+ // Populate m_sections_up with sections from objfile.
+ if (!m_sections_up) {
ObjectFile *obj_file = GetObjectFile();
if (obj_file != nullptr)
obj_file->CreateSections(*GetUnifiedSectionList());
}
- return m_sections_ap.get();
+ return m_sections_up.get();
}
void Module::SectionFileAddressesChanged() {
@@ -1297,13 +1300,19 @@ void Module::SectionFileAddressesChanged() {
sym_vendor->SectionFileAddressesChanged();
}
+UnwindTable &Module::GetUnwindTable() {
+ if (!m_unwind_table)
+ m_unwind_table.emplace(*this);
+ return *m_unwind_table;
+}
+
SectionList *Module::GetUnifiedSectionList() {
- if (!m_sections_ap)
- m_sections_ap = llvm::make_unique<SectionList>();
- return m_sections_ap.get();
+ if (!m_sections_up)
+ m_sections_up = llvm::make_unique<SectionList>();
+ return m_sections_up.get();
}
-const Symbol *Module::FindFirstSymbolWithNameAndType(const ConstString &name,
+const Symbol *Module::FindFirstSymbolWithNameAndType(ConstString name,
SymbolType symbol_type) {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(
@@ -1336,7 +1345,7 @@ void Module::SymbolIndicesToSymbolContextList(
}
}
-size_t Module::FindFunctionSymbols(const ConstString &name,
+size_t Module::FindFunctionSymbols(ConstString name,
uint32_t name_type_mask,
SymbolContextList &sc_list) {
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
@@ -1352,7 +1361,7 @@ size_t Module::FindFunctionSymbols(const ConstString &name,
return 0;
}
-size_t Module::FindSymbolsWithNameAndType(const ConstString &name,
+size_t Module::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
SymbolContextList &sc_list) {
// No need to protect this call using m_mutex all other method calls are
@@ -1420,11 +1429,11 @@ void Module::PreloadSymbols() {
void Module::SetSymbolFileFileSpec(const FileSpec &file) {
if (!FileSystem::Instance().Exists(file))
return;
- if (m_symfile_ap) {
+ if (m_symfile_up) {
// Remove any sections in the unified section list that come from the
// current symbol vendor.
SectionList *section_list = GetSectionList();
- SymbolFile *symbol_file = m_symfile_ap->GetSymbolFile();
+ SymbolFile *symbol_file = m_symfile_up->GetSymbolFile();
if (section_list && symbol_file) {
ObjectFile *obj_file = symbol_file->GetObjectFile();
// Make sure we have an object file and that the symbol vendor's objfile
@@ -1443,6 +1452,10 @@ void Module::SetSymbolFileFileSpec(const FileSpec &file) {
// one
obj_file->ClearSymtab();
+ // Clear the unwind table too, as that may also be affected by the
+ // symbol file information.
+ m_unwind_table.reset();
+
// The symbol file might be a directory bundle ("/tmp/a.out.dSYM")
// instead of a full path to the symbol file within the bundle
// ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to
@@ -1472,10 +1485,10 @@ void Module::SetSymbolFileFileSpec(const FileSpec &file) {
}
// Keep all old symbol files around in case there are any lingering type
// references in any SBValue objects that might have been handed out.
- m_old_symfiles.push_back(std::move(m_symfile_ap));
+ m_old_symfiles.push_back(std::move(m_symfile_up));
}
m_symfile_spec = file;
- m_symfile_ap.reset();
+ m_symfile_up.reset();
m_did_load_symbol_vendor = false;
}
@@ -1532,8 +1545,7 @@ bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
const uint32_t num_specs = file_specs.GetSize();
if (num_specs) {
- ScriptInterpreter *script_interpreter =
- debugger.GetCommandInterpreter().GetScriptInterpreter();
+ ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
if (script_interpreter) {
for (uint32_t i = 0; i < num_specs; ++i) {
FileSpec scripting_fspec(file_specs.GetFileSpecAtIndex(i));
@@ -1622,7 +1634,7 @@ bool Module::MatchesModuleSpec(const ModuleSpec &module_ref) {
return false;
}
- const ConstString &object_name = module_ref.GetObjectName();
+ ConstString object_name = module_ref.GetObjectName();
if (object_name) {
if (object_name != GetObjectName())
return false;
diff --git a/source/Core/ModuleChild.cpp b/source/Core/ModuleChild.cpp
index 86495742754d8..2fcb2ffca137c 100644
--- a/source/Core/ModuleChild.cpp
+++ b/source/Core/ModuleChild.cpp
@@ -1,9 +1,8 @@
//===-- ModuleChild.cpp -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -14,9 +13,6 @@ using namespace lldb_private;
ModuleChild::ModuleChild(const lldb::ModuleSP &module_sp)
: m_module_wp(module_sp) {}
-ModuleChild::ModuleChild(const ModuleChild &rhs)
- : m_module_wp(rhs.m_module_wp) {}
-
ModuleChild::~ModuleChild() {}
const ModuleChild &ModuleChild::operator=(const ModuleChild &rhs) {
diff --git a/source/Core/ModuleList.cpp b/source/Core/ModuleList.cpp
index b8de86f4eadca..9d795f9e55869 100644
--- a/source/Core/ModuleList.cpp
+++ b/source/Core/ModuleList.cpp
@@ -1,9 +1,8 @@
//===-- ModuleList.cpp ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -12,10 +11,10 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/FileSystem.h"
-#include "lldb/Host/Symbols.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/Property.h"
+#include "lldb/Symbol/LocateSymbolFile.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/VariableList.h"
@@ -88,7 +87,8 @@ enum { ePropertyEnableExternalLookup, ePropertyClangModulesCachePath };
} // namespace
ModuleListProperties::ModuleListProperties() {
- m_collection_sp.reset(new OptionValueProperties(ConstString("symbols")));
+ m_collection_sp =
+ std::make_shared<OptionValueProperties>(ConstString("symbols"));
m_collection_sp->Initialize(g_properties);
llvm::SmallString<128> path;
@@ -102,6 +102,11 @@ bool ModuleListProperties::GetEnableExternalLookup() const {
nullptr, idx, g_properties[idx].default_uint_value != 0);
}
+bool ModuleListProperties::SetEnableExternalLookup(bool new_value) {
+ return m_collection_sp->SetPropertyAtIndexAsBoolean(
+ nullptr, ePropertyEnableExternalLookup, new_value);
+}
+
FileSpec ModuleListProperties::GetClangModulesCachePath() const {
return m_collection_sp
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
@@ -114,7 +119,6 @@ bool ModuleListProperties::SetClangModulesCachePath(llvm::StringRef path) {
nullptr, ePropertyClangModulesCachePath, path);
}
-
ModuleList::ModuleList()
: m_modules(), m_modules_mutex(), m_notifier(nullptr) {}
@@ -130,25 +134,12 @@ ModuleList::ModuleList(ModuleList::Notifier *notifier)
const ModuleList &ModuleList::operator=(const ModuleList &rhs) {
if (this != &rhs) {
- // That's probably me nit-picking, but in theoretical situation:
- //
- // * that two threads A B and
- // * two ModuleList's x y do opposite assignments ie.:
- //
- // in thread A: | in thread B:
- // x = y; | y = x;
- //
- // This establishes correct(same) lock taking order and thus avoids
- // priority inversion.
- if (uintptr_t(this) > uintptr_t(&rhs)) {
- std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
- std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
- m_modules = rhs.m_modules;
- } else {
- std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
- std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
- m_modules = rhs.m_modules;
- }
+ std::lock(m_modules_mutex, rhs.m_modules_mutex);
+ std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex,
+ std::adopt_lock);
+ std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex,
+ std::adopt_lock);
+ m_modules = rhs.m_modules;
}
return *this;
}
@@ -160,11 +151,13 @@ void ModuleList::AppendImpl(const ModuleSP &module_sp, bool use_notifier) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
m_modules.push_back(module_sp);
if (use_notifier && m_notifier)
- m_notifier->ModuleAdded(*this, module_sp);
+ m_notifier->NotifyModuleAdded(*this, module_sp);
}
}
-void ModuleList::Append(const ModuleSP &module_sp) { AppendImpl(module_sp); }
+void ModuleList::Append(const ModuleSP &module_sp, bool notify) {
+ AppendImpl(module_sp, notify);
+}
void ModuleList::ReplaceEquivalent(const ModuleSP &module_sp) {
if (module_sp) {
@@ -190,7 +183,7 @@ void ModuleList::ReplaceEquivalent(const ModuleSP &module_sp) {
}
}
-bool ModuleList::AppendIfNeeded(const ModuleSP &module_sp) {
+bool ModuleList::AppendIfNeeded(const ModuleSP &module_sp, bool notify) {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
collection::iterator pos, end = m_modules.end();
@@ -199,7 +192,7 @@ bool ModuleList::AppendIfNeeded(const ModuleSP &module_sp) {
return false; // Already in the list
}
// Only push module_sp on the list if it wasn't already in there.
- Append(module_sp);
+ Append(module_sp, notify);
return true;
}
return false;
@@ -227,7 +220,7 @@ bool ModuleList::RemoveImpl(const ModuleSP &module_sp, bool use_notifier) {
if (pos->get() == module_sp.get()) {
m_modules.erase(pos);
if (use_notifier && m_notifier)
- m_notifier->ModuleRemoved(*this, module_sp);
+ m_notifier->NotifyModuleRemoved(*this, module_sp);
return true;
}
}
@@ -241,12 +234,12 @@ ModuleList::RemoveImpl(ModuleList::collection::iterator pos,
ModuleSP module_sp(*pos);
collection::iterator retval = m_modules.erase(pos);
if (use_notifier && m_notifier)
- m_notifier->ModuleRemoved(*this, module_sp);
+ m_notifier->NotifyModuleRemoved(*this, module_sp);
return retval;
}
-bool ModuleList::Remove(const ModuleSP &module_sp) {
- return RemoveImpl(module_sp);
+bool ModuleList::Remove(const ModuleSP &module_sp, bool notify) {
+ return RemoveImpl(module_sp, notify);
}
bool ModuleList::ReplaceModule(const lldb::ModuleSP &old_module_sp,
@@ -255,7 +248,7 @@ bool ModuleList::ReplaceModule(const lldb::ModuleSP &old_module_sp,
return false;
AppendImpl(new_module_sp, false);
if (m_notifier)
- m_notifier->ModuleUpdated(*this, old_module_sp, new_module_sp);
+ m_notifier->NotifyModuleUpdated(*this, old_module_sp, new_module_sp);
return true;
}
@@ -304,9 +297,11 @@ size_t ModuleList::Remove(ModuleList &module_list) {
size_t num_removed = 0;
collection::iterator pos, end = module_list.m_modules.end();
for (pos = module_list.m_modules.begin(); pos != end; ++pos) {
- if (Remove(*pos))
+ if (Remove(*pos, false /* notify */))
++num_removed;
}
+ if (m_notifier)
+ m_notifier->NotifyModulesRemoved(module_list);
return num_removed;
}
@@ -317,7 +312,7 @@ void ModuleList::Destroy() { ClearImpl(); }
void ModuleList::ClearImpl(bool use_notifier) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
if (use_notifier && m_notifier)
- m_notifier->WillClearList(*this);
+ m_notifier->NotifyWillClearList(*this);
m_modules.clear();
}
@@ -344,7 +339,7 @@ ModuleSP ModuleList::GetModuleAtIndexUnlocked(size_t idx) const {
return module_sp;
}
-size_t ModuleList::FindFunctions(const ConstString &name,
+size_t ModuleList::FindFunctions(ConstString name,
FunctionNameType name_type_mask,
bool include_symbols, bool include_inlines,
bool append,
@@ -380,7 +375,7 @@ size_t ModuleList::FindFunctions(const ConstString &name,
return sc_list.GetSize() - old_size;
}
-size_t ModuleList::FindFunctionSymbols(const ConstString &name,
+size_t ModuleList::FindFunctionSymbols(ConstString name,
lldb::FunctionNameType name_type_mask,
SymbolContextList &sc_list) {
const size_t old_size = sc_list.GetSize();
@@ -439,7 +434,7 @@ size_t ModuleList::FindCompileUnits(const FileSpec &path, bool append,
return sc_list.GetSize();
}
-size_t ModuleList::FindGlobalVariables(const ConstString &name,
+size_t ModuleList::FindGlobalVariables(ConstString name,
size_t max_matches,
VariableList &variable_list) const {
size_t initial_size = variable_list.GetSize();
@@ -463,7 +458,7 @@ size_t ModuleList::FindGlobalVariables(const RegularExpression &regex,
return variable_list.GetSize() - initial_size;
}
-size_t ModuleList::FindSymbolsWithNameAndType(const ConstString &name,
+size_t ModuleList::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
SymbolContextList &sc_list,
bool append) const {
@@ -542,7 +537,7 @@ ModuleSP ModuleList::FindModule(const UUID &uuid) const {
}
size_t
-ModuleList::FindTypes(Module *search_first, const ConstString &name,
+ModuleList::FindTypes(Module *search_first, ConstString name,
bool name_is_fully_qualified, size_t max_matches,
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
TypeList &types) const {
@@ -830,7 +825,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
if (module_sp)
return error;
- module_sp.reset(new Module(module_spec));
+ module_sp = std::make_shared<Module>(module_spec);
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file. By
// getting the object file we can guarantee that the architecture matches
@@ -872,7 +867,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
auto resolved_module_spec(module_spec);
resolved_module_spec.GetFileSpec() = search_path_spec;
- module_sp.reset(new Module(resolved_module_spec));
+ module_sp = std::make_shared<Module>(resolved_module_spec);
if (module_sp->GetObjectFile()) {
// If we get in here we got the correct arch, now we just need to
// verify the UUID if one was given
@@ -971,7 +966,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
}
if (!module_sp) {
- module_sp.reset(new Module(platform_module_spec));
+ module_sp = std::make_shared<Module>(platform_module_spec);
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture
diff --git a/source/Core/Opcode.cpp b/source/Core/Opcode.cpp
index ed8be78a6d675..6ca46de40de24 100644
--- a/source/Core/Opcode.cpp
+++ b/source/Core/Opcode.cpp
@@ -1,9 +1,8 @@
//===-- Opcode.cpp ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/PluginManager.cpp b/source/Core/PluginManager.cpp
index fbb2580398821..24cadcd85bf51 100644
--- a/source/Core/PluginManager.cpp
+++ b/source/Core/PluginManager.cpp
@@ -1,9 +1,8 @@
//===-- PluginManager.cpp ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -220,7 +219,7 @@ static ABIInstances &GetABIInstances() {
return g_instances;
}
-bool PluginManager::RegisterPlugin(const ConstString &name,
+bool PluginManager::RegisterPlugin(ConstString name,
const char *description,
ABICreateInstance create_callback) {
if (create_callback) {
@@ -262,7 +261,7 @@ ABICreateInstance PluginManager::GetABICreateCallbackAtIndex(uint32_t idx) {
}
ABICreateInstance
-PluginManager::GetABICreateCallbackForPluginName(const ConstString &name) {
+PluginManager::GetABICreateCallbackForPluginName(ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
ABIInstances &instances = GetABIInstances();
@@ -296,7 +295,7 @@ static ArchitectureInstances &GetArchitectureInstances() {
return g_instances;
}
-void PluginManager::RegisterPlugin(const ConstString &name,
+void PluginManager::RegisterPlugin(ConstString name,
llvm::StringRef description,
ArchitectureCreateInstance create_callback) {
std::lock_guard<std::mutex> guard(GetArchitectureMutex());
@@ -349,7 +348,7 @@ static DisassemblerInstances &GetDisassemblerInstances() {
return g_instances;
}
-bool PluginManager::RegisterPlugin(const ConstString &name,
+bool PluginManager::RegisterPlugin(ConstString name,
const char *description,
DisassemblerCreateInstance create_callback) {
if (create_callback) {
@@ -394,7 +393,7 @@ PluginManager::GetDisassemblerCreateCallbackAtIndex(uint32_t idx) {
DisassemblerCreateInstance
PluginManager::GetDisassemblerCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetDisassemblerMutex());
DisassemblerInstances &instances = GetDisassemblerInstances();
@@ -434,7 +433,7 @@ static DynamicLoaderInstances &GetDynamicLoaderInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
DynamicLoaderCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -479,7 +478,7 @@ PluginManager::GetDynamicLoaderCreateCallbackAtIndex(uint32_t idx) {
DynamicLoaderCreateInstance
PluginManager::GetDynamicLoaderCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
DynamicLoaderInstances &instances = GetDynamicLoaderInstances();
@@ -519,7 +518,7 @@ static JITLoaderInstances &GetJITLoaderInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
JITLoaderCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -562,7 +561,7 @@ PluginManager::GetJITLoaderCreateCallbackAtIndex(uint32_t idx) {
}
JITLoaderCreateInstance PluginManager::GetJITLoaderCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
JITLoaderInstances &instances = GetJITLoaderInstances();
@@ -600,7 +599,7 @@ static EmulateInstructionInstances &GetEmulateInstructionInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
EmulateInstructionCreateInstance create_callback) {
if (create_callback) {
EmulateInstructionInstance instance;
@@ -643,7 +642,7 @@ PluginManager::GetEmulateInstructionCreateCallbackAtIndex(uint32_t idx) {
EmulateInstructionCreateInstance
PluginManager::GetEmulateInstructionCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetEmulateInstructionMutex());
EmulateInstructionInstances &instances = GetEmulateInstructionInstances();
@@ -683,7 +682,7 @@ static OperatingSystemInstances &GetOperatingSystemInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
OperatingSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -728,7 +727,7 @@ PluginManager::GetOperatingSystemCreateCallbackAtIndex(uint32_t idx) {
OperatingSystemCreateInstance
PluginManager::GetOperatingSystemCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
OperatingSystemInstances &instances = GetOperatingSystemInstances();
@@ -764,7 +763,7 @@ static LanguageInstances &GetLanguageInstances() {
return g_instances;
}
-bool PluginManager::RegisterPlugin(const ConstString &name,
+bool PluginManager::RegisterPlugin(ConstString name,
const char *description,
LanguageCreateInstance create_callback) {
if (create_callback) {
@@ -806,7 +805,7 @@ PluginManager::GetLanguageCreateCallbackAtIndex(uint32_t idx) {
}
LanguageCreateInstance
-PluginManager::GetLanguageCreateCallbackForPluginName(const ConstString &name) {
+PluginManager::GetLanguageCreateCallbackForPluginName(ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
LanguageInstances &instances = GetLanguageInstances();
@@ -829,6 +828,7 @@ struct LanguageRuntimeInstance {
std::string description;
LanguageRuntimeCreateInstance create_callback;
LanguageRuntimeGetCommandObject command_callback;
+ LanguageRuntimeGetExceptionPrecondition precondition_callback;
};
typedef std::vector<LanguageRuntimeInstance> LanguageRuntimeInstances;
@@ -844,9 +844,10 @@ static LanguageRuntimeInstances &GetLanguageRuntimeInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
LanguageRuntimeCreateInstance create_callback,
- LanguageRuntimeGetCommandObject command_callback) {
+ LanguageRuntimeGetCommandObject command_callback,
+ LanguageRuntimeGetExceptionPrecondition precondition_callback) {
if (create_callback) {
LanguageRuntimeInstance instance;
assert((bool)name);
@@ -855,6 +856,7 @@ bool PluginManager::RegisterPlugin(
instance.description = description;
instance.create_callback = create_callback;
instance.command_callback = command_callback;
+ instance.precondition_callback = precondition_callback;
std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
GetLanguageRuntimeInstances().push_back(instance);
}
@@ -896,9 +898,18 @@ PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx) {
return nullptr;
}
+LanguageRuntimeGetExceptionPrecondition
+PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx) {
+ std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
+ LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances();
+ if (idx < instances.size())
+ return instances[idx].precondition_callback;
+ return nullptr;
+}
+
LanguageRuntimeCreateInstance
PluginManager::GetLanguageRuntimeCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances();
@@ -935,7 +946,7 @@ static SystemRuntimeInstances &GetSystemRuntimeInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
SystemRuntimeCreateInstance create_callback) {
if (create_callback) {
SystemRuntimeInstance instance;
@@ -978,7 +989,7 @@ PluginManager::GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx) {
SystemRuntimeCreateInstance
PluginManager::GetSystemRuntimeCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
SystemRuntimeInstances &instances = GetSystemRuntimeInstances();
@@ -1021,7 +1032,7 @@ static ObjectFileInstances &GetObjectFileInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
ObjectFileCreateInstance create_callback,
ObjectFileCreateMemoryInstance create_memory_callback,
ObjectFileGetModuleSpecifications get_module_specifications,
@@ -1088,7 +1099,7 @@ PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(
ObjectFileCreateInstance
PluginManager::GetObjectFileCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
ObjectFileInstances &instances = GetObjectFileInstances();
@@ -1104,7 +1115,7 @@ PluginManager::GetObjectFileCreateCallbackForPluginName(
ObjectFileCreateMemoryInstance
PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
ObjectFileInstances &instances = GetObjectFileInstances();
@@ -1160,7 +1171,7 @@ static ObjectContainerInstances &GetObjectContainerInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
ObjectContainerCreateInstance create_callback,
ObjectFileGetModuleSpecifications get_module_specifications) {
if (create_callback) {
@@ -1205,7 +1216,7 @@ PluginManager::GetObjectContainerCreateCallbackAtIndex(uint32_t idx) {
ObjectContainerCreateInstance
PluginManager::GetObjectContainerCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
ObjectContainerInstances &instances = GetObjectContainerInstances();
@@ -1255,7 +1266,7 @@ static PlatformInstances &GetPlatformInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
PlatformCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -1316,7 +1327,7 @@ PluginManager::GetPlatformCreateCallbackAtIndex(uint32_t idx) {
}
PlatformCreateInstance
-PluginManager::GetPlatformCreateCallbackForPluginName(const ConstString &name) {
+PluginManager::GetPlatformCreateCallbackForPluginName(ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
PlatformInstances &instances = GetPlatformInstances();
@@ -1374,7 +1385,7 @@ static ProcessInstances &GetProcessInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
ProcessCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -1433,7 +1444,7 @@ PluginManager::GetProcessCreateCallbackAtIndex(uint32_t idx) {
}
ProcessCreateInstance
-PluginManager::GetProcessCreateCallbackForPluginName(const ConstString &name) {
+PluginManager::GetProcessCreateCallbackForPluginName(ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
ProcessInstances &instances = GetProcessInstances();
@@ -1473,7 +1484,7 @@ static ScriptInterpreterInstances &GetScriptInterpreterInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
lldb::ScriptLanguage script_language,
ScriptInterpreterCreateInstance create_callback) {
if (!create_callback)
@@ -1517,8 +1528,9 @@ PluginManager::GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx) {
return nullptr;
}
-lldb::ScriptInterpreterSP PluginManager::GetScriptInterpreterForLanguage(
- lldb::ScriptLanguage script_lang, CommandInterpreter &interpreter) {
+lldb::ScriptInterpreterSP
+PluginManager::GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
+ Debugger &debugger) {
std::lock_guard<std::recursive_mutex> guard(GetScriptInterpreterMutex());
ScriptInterpreterInstances &instances = GetScriptInterpreterInstances();
@@ -1529,20 +1541,18 @@ lldb::ScriptInterpreterSP PluginManager::GetScriptInterpreterForLanguage(
none_instance = pos->create_callback;
if (script_lang == pos->language)
- return pos->create_callback(interpreter);
+ return pos->create_callback(debugger);
}
// If we didn't find one, return the ScriptInterpreter for the null language.
assert(none_instance != nullptr);
- return none_instance(interpreter);
+ return none_instance(debugger);
}
#pragma mark -
#pragma mark StructuredDataPlugin
-// -----------------------------------------------------------------------------
// StructuredDataPlugin
-// -----------------------------------------------------------------------------
struct StructuredDataPluginInstance {
StructuredDataPluginInstance()
@@ -1569,7 +1579,7 @@ static StructuredDataPluginInstances &GetStructuredDataPluginInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
StructuredDataPluginCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback,
StructuredDataFilterLaunchInfo filter_callback) {
@@ -1617,7 +1627,7 @@ PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx) {
StructuredDataPluginCreateInstance
PluginManager::GetStructuredDataPluginCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetStructuredDataPluginMutex());
StructuredDataPluginInstances &instances =
@@ -1672,7 +1682,7 @@ static SymbolFileInstances &GetSymbolFileInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
SymbolFileCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
if (create_callback) {
@@ -1716,7 +1726,7 @@ PluginManager::GetSymbolFileCreateCallbackAtIndex(uint32_t idx) {
SymbolFileCreateInstance
PluginManager::GetSymbolFileCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
SymbolFileInstances &instances = GetSymbolFileInstances();
@@ -1752,7 +1762,7 @@ static SymbolVendorInstances &GetSymbolVendorInstances() {
return g_instances;
}
-bool PluginManager::RegisterPlugin(const ConstString &name,
+bool PluginManager::RegisterPlugin(ConstString name,
const char *description,
SymbolVendorCreateInstance create_callback) {
if (create_callback) {
@@ -1796,7 +1806,7 @@ PluginManager::GetSymbolVendorCreateCallbackAtIndex(uint32_t idx) {
SymbolVendorCreateInstance
PluginManager::GetSymbolVendorCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetSymbolVendorMutex());
SymbolVendorInstances &instances = GetSymbolVendorInstances();
@@ -1833,7 +1843,7 @@ static UnwindAssemblyInstances &GetUnwindAssemblyInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
UnwindAssemblyCreateInstance create_callback) {
if (create_callback) {
UnwindAssemblyInstance instance;
@@ -1876,7 +1886,7 @@ PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx) {
UnwindAssemblyCreateInstance
PluginManager::GetUnwindAssemblyCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances();
@@ -1913,7 +1923,7 @@ static MemoryHistoryInstances &GetMemoryHistoryInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
MemoryHistoryCreateInstance create_callback) {
if (create_callback) {
MemoryHistoryInstance instance;
@@ -1956,7 +1966,7 @@ PluginManager::GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx) {
MemoryHistoryCreateInstance
PluginManager::GetMemoryHistoryCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
MemoryHistoryInstances &instances = GetMemoryHistoryInstances();
@@ -1996,7 +2006,7 @@ static InstrumentationRuntimeInstances &GetInstrumentationRuntimeInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
InstrumentationRuntimeCreateInstance create_callback,
InstrumentationRuntimeGetType get_type_callback) {
if (create_callback) {
@@ -2055,7 +2065,7 @@ PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx) {
InstrumentationRuntimeCreateInstance
PluginManager::GetInstrumentationRuntimeCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(
GetInstrumentationRuntimeMutex());
@@ -2094,7 +2104,7 @@ static TypeSystemInstances &GetTypeSystemInstances() {
return g_instances;
}
-bool PluginManager::RegisterPlugin(const ConstString &name,
+bool PluginManager::RegisterPlugin(ConstString name,
const char *description,
TypeSystemCreateInstance create_callback,
TypeSystemEnumerateSupportedLanguages
@@ -2140,7 +2150,7 @@ PluginManager::GetTypeSystemCreateCallbackAtIndex(uint32_t idx) {
TypeSystemCreateInstance
PluginManager::GetTypeSystemCreateCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
TypeSystemInstances &instances = GetTypeSystemInstances();
@@ -2166,7 +2176,7 @@ PluginManager::GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(
TypeSystemEnumerateSupportedLanguages
PluginManager::GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
TypeSystemInstances &instances = GetTypeSystemInstances();
@@ -2204,7 +2214,7 @@ static REPLInstances &GetREPLInstances() {
}
bool PluginManager::RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
REPLCreateInstance create_callback,
REPLEnumerateSupportedLanguages enumerate_languages_callback) {
if (create_callback) {
@@ -2246,7 +2256,7 @@ REPLCreateInstance PluginManager::GetREPLCreateCallbackAtIndex(uint32_t idx) {
}
REPLCreateInstance
-PluginManager::GetREPLCreateCallbackForPluginName(const ConstString &name) {
+PluginManager::GetREPLCreateCallbackForPluginName(ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
REPLInstances &instances = GetREPLInstances();
@@ -2271,7 +2281,7 @@ PluginManager::GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx) {
REPLEnumerateSupportedLanguages
PluginManager::GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
- const ConstString &name) {
+ ConstString name) {
if (name) {
std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
REPLInstances &instances = GetREPLInstances();
@@ -2368,8 +2378,8 @@ void PluginManager::DebuggerInitialize(Debugger &debugger) {
// This will put a plugin's settings under e.g.
// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(
- Debugger &debugger, const ConstString &plugin_type_name,
- const ConstString &plugin_type_desc, bool can_create) {
+ Debugger &debugger, ConstString plugin_type_name,
+ ConstString plugin_type_desc, bool can_create) {
lldb::OptionValuePropertiesSP parent_properties_sp(
debugger.GetValueProperties());
if (parent_properties_sp) {
@@ -2404,8 +2414,8 @@ static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(
// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
// generic settings would be under "platform.SETTINGNAME".
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(
- Debugger &debugger, const ConstString &plugin_type_name,
- const ConstString &plugin_type_desc, bool can_create) {
+ Debugger &debugger, ConstString plugin_type_name,
+ ConstString plugin_type_desc, bool can_create) {
static ConstString g_property_name("plugin");
lldb::OptionValuePropertiesSP parent_properties_sp(
debugger.GetValueProperties());
@@ -2438,12 +2448,12 @@ static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(
namespace {
typedef lldb::OptionValuePropertiesSP
-GetDebuggerPropertyForPluginsPtr(Debugger &, const ConstString &,
- const ConstString &, bool can_create);
+GetDebuggerPropertyForPluginsPtr(Debugger &, ConstString ,
+ ConstString , bool can_create);
lldb::OptionValuePropertiesSP
-GetSettingForPlugin(Debugger &debugger, const ConstString &setting_name,
- const ConstString &plugin_type_name,
+GetSettingForPlugin(Debugger &debugger, ConstString setting_name,
+ ConstString plugin_type_name,
GetDebuggerPropertyForPluginsPtr get_debugger_property =
GetDebuggerPropertyForPlugins) {
lldb::OptionValuePropertiesSP properties_sp;
@@ -2458,10 +2468,10 @@ GetSettingForPlugin(Debugger &debugger, const ConstString &setting_name,
}
bool CreateSettingForPlugin(
- Debugger &debugger, const ConstString &plugin_type_name,
- const ConstString &plugin_type_desc,
+ Debugger &debugger, ConstString plugin_type_name,
+ ConstString plugin_type_desc,
const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property,
+ ConstString description, bool is_global_property,
GetDebuggerPropertyForPluginsPtr get_debugger_property =
GetDebuggerPropertyForPlugins) {
if (properties_sp) {
@@ -2488,14 +2498,14 @@ const char *kStructuredDataPluginName("structured-data");
} // anonymous namespace
lldb::OptionValuePropertiesSP PluginManager::GetSettingForDynamicLoaderPlugin(
- Debugger &debugger, const ConstString &setting_name) {
+ Debugger &debugger, ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kDynamicLoaderPluginName));
}
bool PluginManager::CreateSettingForDynamicLoaderPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(
debugger, ConstString(kDynamicLoaderPluginName),
ConstString("Settings for dynamic loader plug-ins"), properties_sp,
@@ -2504,7 +2514,7 @@ bool PluginManager::CreateSettingForDynamicLoaderPlugin(
lldb::OptionValuePropertiesSP
PluginManager::GetSettingForPlatformPlugin(Debugger &debugger,
- const ConstString &setting_name) {
+ ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kPlatformPluginName),
GetDebuggerPropertyForPluginsOldStyle);
@@ -2512,7 +2522,7 @@ PluginManager::GetSettingForPlatformPlugin(Debugger &debugger,
bool PluginManager::CreateSettingForPlatformPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(debugger, ConstString(kPlatformPluginName),
ConstString("Settings for platform plug-ins"),
properties_sp, description, is_global_property,
@@ -2521,14 +2531,14 @@ bool PluginManager::CreateSettingForPlatformPlugin(
lldb::OptionValuePropertiesSP
PluginManager::GetSettingForProcessPlugin(Debugger &debugger,
- const ConstString &setting_name) {
+ ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kProcessPluginName));
}
bool PluginManager::CreateSettingForProcessPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(debugger, ConstString(kProcessPluginName),
ConstString("Settings for process plug-ins"),
properties_sp, description, is_global_property);
@@ -2536,14 +2546,14 @@ bool PluginManager::CreateSettingForProcessPlugin(
lldb::OptionValuePropertiesSP
PluginManager::GetSettingForSymbolFilePlugin(Debugger &debugger,
- const ConstString &setting_name) {
+ ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kSymbolFilePluginName));
}
bool PluginManager::CreateSettingForSymbolFilePlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(
debugger, ConstString(kSymbolFilePluginName),
ConstString("Settings for symbol file plug-ins"), properties_sp,
@@ -2552,14 +2562,14 @@ bool PluginManager::CreateSettingForSymbolFilePlugin(
lldb::OptionValuePropertiesSP
PluginManager::GetSettingForJITLoaderPlugin(Debugger &debugger,
- const ConstString &setting_name) {
+ ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kJITLoaderPluginName));
}
bool PluginManager::CreateSettingForJITLoaderPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(debugger, ConstString(kJITLoaderPluginName),
ConstString("Settings for JIT loader plug-ins"),
properties_sp, description, is_global_property);
@@ -2568,7 +2578,7 @@ bool PluginManager::CreateSettingForJITLoaderPlugin(
static const char *kOperatingSystemPluginName("os");
lldb::OptionValuePropertiesSP PluginManager::GetSettingForOperatingSystemPlugin(
- Debugger &debugger, const ConstString &setting_name) {
+ Debugger &debugger, ConstString setting_name) {
lldb::OptionValuePropertiesSP properties_sp;
lldb::OptionValuePropertiesSP plugin_type_properties_sp(
GetDebuggerPropertyForPlugins(
@@ -2583,7 +2593,7 @@ lldb::OptionValuePropertiesSP PluginManager::GetSettingForOperatingSystemPlugin(
bool PluginManager::CreateSettingForOperatingSystemPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
if (properties_sp) {
lldb::OptionValuePropertiesSP plugin_type_properties_sp(
GetDebuggerPropertyForPlugins(
@@ -2600,14 +2610,14 @@ bool PluginManager::CreateSettingForOperatingSystemPlugin(
}
lldb::OptionValuePropertiesSP PluginManager::GetSettingForStructuredDataPlugin(
- Debugger &debugger, const ConstString &setting_name) {
+ Debugger &debugger, ConstString setting_name) {
return GetSettingForPlugin(debugger, setting_name,
ConstString(kStructuredDataPluginName));
}
bool PluginManager::CreateSettingForStructuredDataPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property) {
+ ConstString description, bool is_global_property) {
return CreateSettingForPlugin(
debugger, ConstString(kStructuredDataPluginName),
ConstString("Settings for structured data plug-ins"), properties_sp,
diff --git a/source/Core/RichManglingContext.cpp b/source/Core/RichManglingContext.cpp
index f5fbe38a49fb4..3d1941ebdd269 100644
--- a/source/Core/RichManglingContext.cpp
+++ b/source/Core/RichManglingContext.cpp
@@ -1,9 +1,8 @@
//===-- RichManglingContext.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,9 +18,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// RichManglingContext
-//----------------------------------------------------------------------
void RichManglingContext::ResetProvider(InfoProvider new_provider) {
// If we want to support parsers for other languages some day, we need a
// switch here to delete the correct parser type.
@@ -35,7 +32,7 @@ void RichManglingContext::ResetProvider(InfoProvider new_provider) {
m_provider = new_provider;
}
-bool RichManglingContext::FromItaniumName(const ConstString &mangled) {
+bool RichManglingContext::FromItaniumName(ConstString mangled) {
bool err = m_ipd.partialDemangle(mangled.GetCString());
if (!err) {
ResetProvider(ItaniumPartialDemangler);
@@ -54,7 +51,7 @@ bool RichManglingContext::FromItaniumName(const ConstString &mangled) {
return !err; // true == success
}
-bool RichManglingContext::FromCxxMethodName(const ConstString &demangled) {
+bool RichManglingContext::FromCxxMethodName(ConstString demangled) {
ResetProvider(PluginCxxLanguage);
m_cxx_method_parser = new CPlusPlusLanguage::MethodName(demangled);
return true;
diff --git a/source/Core/SearchFilter.cpp b/source/Core/SearchFilter.cpp
index 5d26c715bec6a..531fa078de292 100644
--- a/source/Core/SearchFilter.cpp
+++ b/source/Core/SearchFilter.cpp
@@ -1,9 +1,8 @@
//===-- SearchFilter.cpp ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -73,10 +72,6 @@ void Searcher::GetDescription(Stream *s) {}
SearchFilter::SearchFilter(const TargetSP &target_sp, unsigned char filterType)
: m_target_sp(target_sp), SubclassID(filterType) {}
-SearchFilter::SearchFilter(const SearchFilter &rhs) = default;
-
-SearchFilter &SearchFilter::operator=(const SearchFilter &rhs) = default;
-
SearchFilter::~SearchFilter() = default;
SearchFilterSP SearchFilter::CreateFromStructuredData(
@@ -172,9 +167,7 @@ lldb::SearchFilterSP SearchFilter::CopyForBreakpoint(Breakpoint &breakpoint) {
return ret_sp;
}
-//----------------------------------------------------------------------
// Helper functions for serialization.
-//----------------------------------------------------------------------
StructuredData::DictionarySP
SearchFilter::WrapOptionsDict(StructuredData::DictionarySP options_dict_sp) {
@@ -205,10 +198,8 @@ void SearchFilter::SerializeFileSpecList(
options_dict_sp->AddItem(GetKey(name), module_array_sp);
}
-//----------------------------------------------------------------------
// UTILITY Functions to help iterate down through the elements of the
// SymbolContext.
-//----------------------------------------------------------------------
void SearchFilter::Search(Searcher &searcher) {
SymbolContext empty_sc;
@@ -364,11 +355,9 @@ Searcher::CallbackReturn SearchFilter::DoFunctionIteration(
return Searcher::eCallbackReturnContinue;
}
-//----------------------------------------------------------------------
// SearchFilterForUnconstrainedSearches:
// Selects a shared library matching a given file spec, consulting the targets
// "black list".
-//----------------------------------------------------------------------
SearchFilterSP SearchFilterForUnconstrainedSearches::CreateFromStructuredData(
Target &target, const StructuredData::Dictionary &data_dict,
Status &error) {
@@ -404,25 +393,13 @@ lldb::SearchFilterSP SearchFilterForUnconstrainedSearches::DoCopyForBreakpoint(
return std::make_shared<SearchFilterForUnconstrainedSearches>(*this);
}
-//----------------------------------------------------------------------
// SearchFilterByModule:
// Selects a shared library matching a given file spec
-//----------------------------------------------------------------------
SearchFilterByModule::SearchFilterByModule(const lldb::TargetSP &target_sp,
const FileSpec &module)
: SearchFilter(target_sp, FilterTy::ByModule), m_module_spec(module) {}
-SearchFilterByModule::SearchFilterByModule(const SearchFilterByModule &rhs) =
- default;
-
-SearchFilterByModule &SearchFilterByModule::
-operator=(const SearchFilterByModule &rhs) {
- m_target_sp = rhs.m_target_sp;
- m_module_spec = rhs.m_module_spec;
- return *this;
-}
-
SearchFilterByModule::~SearchFilterByModule() = default;
bool SearchFilterByModule::ModulePasses(const ModuleSP &module_sp) {
@@ -534,10 +511,8 @@ StructuredData::ObjectSP SearchFilterByModule::SerializeToStructuredData() {
return WrapOptionsDict(options_dict_sp);
}
-//----------------------------------------------------------------------
// SearchFilterByModuleList:
// Selects a shared library matching a given file spec
-//----------------------------------------------------------------------
SearchFilterByModuleList::SearchFilterByModuleList(
const lldb::TargetSP &target_sp, const FileSpecList &module_list)
@@ -549,9 +524,6 @@ SearchFilterByModuleList::SearchFilterByModuleList(
enum FilterTy filter_ty)
: SearchFilter(target_sp, filter_ty), m_module_spec_list(module_list) {}
-SearchFilterByModuleList::SearchFilterByModuleList(
- const SearchFilterByModuleList &rhs) = default;
-
SearchFilterByModuleList &SearchFilterByModuleList::
operator=(const SearchFilterByModuleList &rhs) {
m_target_sp = rhs.m_target_sp;
@@ -688,10 +660,8 @@ StructuredData::ObjectSP SearchFilterByModuleList::SerializeToStructuredData() {
return WrapOptionsDict(options_dict_sp);
}
-//----------------------------------------------------------------------
// SearchFilterByModuleListAndCU:
// Selects a shared library matching a given file spec
-//----------------------------------------------------------------------
SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU(
const lldb::TargetSP &target_sp, const FileSpecList &module_list,
diff --git a/source/Core/Section.cpp b/source/Core/Section.cpp
index 87f75e1f50ac4..f30ddd2c18c37 100644
--- a/source/Core/Section.cpp
+++ b/source/Core/Section.cpp
@@ -1,9 +1,8 @@
//===-- Section.cpp ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -105,6 +104,8 @@ const char *Section::GetTypeAsCString() const {
return "dwarf-str-offsets-dwo";
case eSectionTypeDWARFDebugTypes:
return "dwarf-types";
+ case eSectionTypeDWARFDebugTypesDwo:
+ return "dwarf-types-dwo";
case eSectionTypeDWARFDebugNames:
return "dwarf-names";
case eSectionTypeELFSymbolTable:
@@ -144,7 +145,7 @@ const char *Section::GetTypeAsCString() const {
}
Section::Section(const ModuleSP &module_sp, ObjectFile *obj_file,
- user_id_t sect_id, const ConstString &name,
+ user_id_t sect_id, ConstString name,
SectionType sect_type, addr_t file_addr, addr_t byte_size,
lldb::offset_t file_offset, lldb::offset_t file_size,
uint32_t log2align, uint32_t flags,
@@ -166,7 +167,7 @@ Section::Section(const ModuleSP &module_sp, ObjectFile *obj_file,
Section::Section(const lldb::SectionSP &parent_section_sp,
const ModuleSP &module_sp, ObjectFile *obj_file,
- user_id_t sect_id, const ConstString &name,
+ user_id_t sect_id, ConstString name,
SectionType sect_type, addr_t file_addr, addr_t byte_size,
lldb::offset_t file_offset, lldb::offset_t file_size,
uint32_t log2align, uint32_t flags,
@@ -343,7 +344,7 @@ void Section::DumpName(Stream *s) const {
s->PutChar('.');
} else {
// The top most section prints the module basename
- const char *name = NULL;
+ const char *name = nullptr;
ModuleSP module_sp(GetModule());
if (m_obj_file) {
@@ -382,9 +383,7 @@ bool Section::Slide(addr_t slide_amount, bool slide_children) {
return false;
}
-//------------------------------------------------------------------
/// Get the permissions as OR'ed bits from lldb::Permissions
-//------------------------------------------------------------------
uint32_t Section::GetPermissions() const {
uint32_t permissions = 0;
if (m_readable)
@@ -396,9 +395,7 @@ uint32_t Section::GetPermissions() const {
return permissions;
}
-//------------------------------------------------------------------
/// Set the permissions using bits OR'ed from lldb::Permissions
-//------------------------------------------------------------------
void Section::SetPermissions(uint32_t permissions) {
m_readable = (permissions & ePermissionsReadable) != 0;
m_writable = (permissions & ePermissionsWritable) != 0;
@@ -507,14 +504,14 @@ SectionSP SectionList::GetSectionAtIndex(size_t idx) const {
}
SectionSP
-SectionList::FindSectionByName(const ConstString &section_dstr) const {
+SectionList::FindSectionByName(ConstString section_dstr) const {
SectionSP sect_sp;
// Check if we have a valid section string
if (section_dstr && !m_sections.empty()) {
const_iterator sect_iter;
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin();
- sect_iter != end && sect_sp.get() == NULL; ++sect_iter) {
+ sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
Section *child_section = sect_iter->get();
if (child_section) {
if (child_section->GetName() == section_dstr) {
@@ -535,7 +532,7 @@ SectionSP SectionList::FindSectionByID(user_id_t sect_id) const {
const_iterator sect_iter;
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin();
- sect_iter != end && sect_sp.get() == NULL; ++sect_iter) {
+ sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
if ((*sect_iter)->GetID() == sect_id) {
sect_sp = *sect_iter;
break;
@@ -572,7 +569,7 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr,
const_iterator sect_iter;
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin();
- sect_iter != end && sect_sp.get() == NULL; ++sect_iter) {
+ sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) {
Section *sect = sect_iter->get();
if (sect->ContainsFileAddress(vm_addr)) {
// The file address is in this section. We need to make sure one of our
@@ -582,7 +579,7 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr,
sect_sp = sect->GetChildren().FindSectionContainingFileAddress(
vm_addr, depth - 1);
- if (sect_sp.get() == NULL && !sect->IsFake())
+ if (sect_sp.get() == nullptr && !sect->IsFake())
sect_sp = *sect_iter;
}
}
@@ -590,7 +587,7 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr,
}
bool SectionList::ContainsSection(user_id_t sect_id) const {
- return FindSectionByID(sect_id).get() != NULL;
+ return FindSectionByID(sect_id).get() != nullptr;
}
void SectionList::Dump(Stream *s, Target *target, bool show_header,
@@ -613,7 +610,7 @@ void SectionList::Dump(Stream *s, Target *target, bool show_header,
const_iterator sect_iter;
const_iterator end = m_sections.end();
for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) {
- (*sect_iter)->Dump(s, target_has_loaded_sections ? target : NULL, depth);
+ (*sect_iter)->Dump(s, target_has_loaded_sections ? target : nullptr, depth);
}
if (show_header && !m_sections.empty())
diff --git a/source/Core/SourceManager.cpp b/source/Core/SourceManager.cpp
index fe603c5a44e61..87065ab624251 100644
--- a/source/Core/SourceManager.cpp
+++ b/source/Core/SourceManager.cpp
@@ -1,9 +1,8 @@
//===-- SourceManager.cpp ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -50,9 +49,7 @@ using namespace lldb_private;
static inline bool is_newline_char(char ch) { return ch == '\n' || ch == '\r'; }
-//----------------------------------------------------------------------
// SourceManager constructor
-//----------------------------------------------------------------------
SourceManager::SourceManager(const TargetSP &target_sp)
: m_last_file_sp(), m_last_line(0), m_last_count(0), m_default_set(false),
m_target_wp(target_sp),
@@ -62,9 +59,7 @@ SourceManager::SourceManager(const DebuggerSP &debugger_sp)
: m_last_file_sp(), m_last_line(0), m_last_count(0), m_default_set(false),
m_target_wp(), m_debugger_wp(debugger_sp) {}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
SourceManager::~SourceManager() {}
SourceManager::FileSP SourceManager::GetFile(const FileSpec &file_spec) {
@@ -331,7 +326,7 @@ bool SourceManager::GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line) {
bool inlines_okay = true;
bool append = false;
size_t num_matches = executable_ptr->FindFunctions(
- main_name, NULL, lldb::eFunctionNameTypeBase, inlines_okay,
+ main_name, nullptr, lldb::eFunctionNameTypeBase, inlines_okay,
symbols_okay, append, sc_list);
for (size_t idx = 0; idx < num_matches; idx++) {
SymbolContext sc;
@@ -404,7 +399,7 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
if (num_matches != 0) {
if (num_matches > 1) {
SymbolContext sc;
- FileSpec *test_cu_spec = NULL;
+ FileSpec *test_cu_spec = nullptr;
for (unsigned i = 0; i < num_matches; i++) {
sc_list.GetContextAtIndex(i, sc);
@@ -466,12 +461,12 @@ uint32_t SourceManager::File::GetNumLines() {
const char *SourceManager::File::PeekLineData(uint32_t line) {
if (!LineIsValid(line))
- return NULL;
+ return nullptr;
size_t line_offset = GetLineOffset(line);
if (line_offset < m_data_sp->GetByteSize())
return (const char *)m_data_sp->GetBytes() + line_offset;
- return NULL;
+ return nullptr;
}
uint32_t SourceManager::File::GetLineLength(uint32_t line,
@@ -626,7 +621,7 @@ bool SourceManager::File::CalculateLineOffsets(uint32_t line) {
return true;
if (m_offsets.empty()) {
- if (m_data_sp.get() == NULL)
+ if (m_data_sp.get() == nullptr)
return false;
const char *start = (char *)m_data_sp->GetBytes();
diff --git a/source/Core/StreamAsynchronousIO.cpp b/source/Core/StreamAsynchronousIO.cpp
index b8938bd3fc4e3..d283749144e1e 100644
--- a/source/Core/StreamAsynchronousIO.cpp
+++ b/source/Core/StreamAsynchronousIO.cpp
@@ -1,9 +1,8 @@
//===-- StreamAsynchronousIO.cpp --------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/StreamFile.cpp b/source/Core/StreamFile.cpp
index d24634598c36a..ce6e1ea2c18f5 100644
--- a/source/Core/StreamFile.cpp
+++ b/source/Core/StreamFile.cpp
@@ -1,9 +1,8 @@
//===-- StreamFile.cpp ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -15,9 +14,7 @@
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// StreamFile constructor
-//----------------------------------------------------------------------
StreamFile::StreamFile() : Stream(), m_file() {}
StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order)
diff --git a/source/Core/UserSettingsController.cpp b/source/Core/UserSettingsController.cpp
index 4406057ca6b9a..3a656766dceca 100644
--- a/source/Core/UserSettingsController.cpp
+++ b/source/Core/UserSettingsController.cpp
@@ -1,9 +1,8 @@
//====-- UserSettingsController.cpp ------------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -95,7 +94,7 @@ Properties::Apropos(llvm::StringRef keyword,
lldb::OptionValuePropertiesSP
Properties::GetSubProperty(const ExecutionContext *exe_ctx,
- const ConstString &name) {
+ ConstString name) {
OptionValuePropertiesSP properties_sp(GetValueProperties());
if (properties_sp)
return properties_sp->GetSubProperty(exe_ctx, name);
diff --git a/source/Core/Value.cpp b/source/Core/Value.cpp
index 8e18458b90c20..fdb4adb5f4314 100644
--- a/source/Core/Value.cpp
+++ b/source/Core/Value.cpp
@@ -1,9 +1,8 @@
//===-- Value.cpp -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -40,17 +39,17 @@ using namespace lldb;
using namespace lldb_private;
Value::Value()
- : m_value(), m_vector(), m_compiler_type(), m_context(NULL),
+ : m_value(), m_vector(), m_compiler_type(), m_context(nullptr),
m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid),
m_data_buffer() {}
Value::Value(const Scalar &scalar)
- : m_value(scalar), m_vector(), m_compiler_type(), m_context(NULL),
+ : m_value(scalar), m_vector(), m_compiler_type(), m_context(nullptr),
m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid),
m_data_buffer() {}
Value::Value(const void *bytes, int len)
- : m_value(), m_vector(), m_compiler_type(), m_context(NULL),
+ : m_value(), m_vector(), m_compiler_type(), m_context(nullptr),
m_value_type(eValueTypeHostAddress), m_context_type(eContextTypeInvalid),
m_data_buffer() {
SetBytes(bytes, len);
@@ -132,13 +131,13 @@ AddressType Value::GetValueAddressType() const {
RegisterInfo *Value::GetRegisterInfo() const {
if (m_context_type == eContextTypeRegisterInfo)
return static_cast<RegisterInfo *>(m_context);
- return NULL;
+ return nullptr;
}
Type *Value::GetType() {
if (m_context_type == eContextTypeLLDBType)
return static_cast<Type *>(m_context);
- return NULL;
+ return nullptr;
}
size_t Value::AppendDataToHostBuffer(const Value &rhs) {
@@ -354,11 +353,11 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
break;
}
case eValueTypeLoadAddress:
- if (exe_ctx == NULL) {
+ if (exe_ctx == nullptr) {
error.SetErrorString("can't read load address (no execution context)");
} else {
Process *process = exe_ctx->GetProcessPtr();
- if (process == NULL || !process->IsAlive()) {
+ if (process == nullptr || !process->IsAlive()) {
Target *target = exe_ctx->GetTargetPtr();
if (target) {
// Allow expressions to run and evaluate things when the target has
@@ -391,16 +390,16 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
break;
case eValueTypeFileAddress:
- if (exe_ctx == NULL) {
+ if (exe_ctx == nullptr) {
error.SetErrorString("can't read file address (no execution context)");
- } else if (exe_ctx->GetTargetPtr() == NULL) {
+ } else if (exe_ctx->GetTargetPtr() == nullptr) {
error.SetErrorString("can't read file address (invalid target)");
} else {
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (address == LLDB_INVALID_ADDRESS) {
error.SetErrorString("invalid file address");
} else {
- if (module == NULL) {
+ if (module == nullptr) {
// The only thing we can currently lock down to a module so that we
// can resolve a file address, is a variable.
Variable *variable = GetVariable();
@@ -515,6 +514,10 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
if (error.Fail())
return error;
+ // No memory to read for zero-sized types.
+ if (byte_size == 0)
+ return error;
+
// Make sure we have enough room within "data", and if we don't make
// something large enough that does
if (!data.ValidOffsetForDataOfSize(data_offset, byte_size)) {
@@ -524,7 +527,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
}
uint8_t *dst = const_cast<uint8_t *>(data.PeekData(data_offset, byte_size));
- if (dst != NULL) {
+ if (dst != nullptr) {
if (address_type == eAddressTypeHost) {
// The address is an address in this process, so just copy it.
if (address == 0) {
@@ -594,7 +597,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
{
DataExtractor data;
lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
- Status error(GetValueAsData(exe_ctx, data, 0, NULL));
+ Status error(GetValueAsData(exe_ctx, data, 0, nullptr));
if (error.Success()) {
Scalar scalar;
if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(),
@@ -622,7 +625,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
Variable *Value::GetVariable() {
if (m_context_type == eContextTypeVariable)
return static_cast<Variable *>(m_context);
- return NULL;
+ return nullptr;
}
void Value::Clear() {
@@ -630,7 +633,7 @@ void Value::Clear() {
m_vector.Clear();
m_compiler_type.Clear();
m_value_type = eValueTypeScalar;
- m_context = NULL;
+ m_context = nullptr;
m_context_type = eContextTypeInvalid;
m_data_buffer.Clear();
}
@@ -699,7 +702,7 @@ Value *ValueList::GetValueAtIndex(size_t idx) {
if (idx < GetSize()) {
return &(m_values[idx]);
} else
- return NULL;
+ return nullptr;
}
void ValueList::Clear() { m_values.clear(); }
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 95e944b22b873..297365b4ecbd6 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -1,9 +1,8 @@
//===-- ValueObject.cpp -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -32,10 +31,10 @@
#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/Variable.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
@@ -78,17 +77,16 @@ using namespace lldb_utility;
static user_id_t g_value_obj_uid = 0;
-//----------------------------------------------------------------------
// ValueObject constructor
-//----------------------------------------------------------------------
ValueObject::ValueObject(ValueObject &parent)
: UserID(++g_value_obj_uid), // Unique identifier for every value object
- m_parent(&parent), m_root(NULL), m_update_point(parent.GetUpdatePoint()),
- m_name(), m_data(), m_value(), m_error(), m_value_str(),
- m_old_value_str(), m_location_str(), m_summary_str(), m_object_desc_str(),
- m_validation_result(), m_manager(parent.GetManager()), m_children(),
- m_synthetic_children(), m_dynamic_value(NULL), m_synthetic_value(NULL),
- m_deref_valobj(NULL), m_format(eFormatDefault),
+ m_parent(&parent), m_root(nullptr),
+ m_update_point(parent.GetUpdatePoint()), m_name(), m_data(), m_value(),
+ m_error(), m_value_str(), m_old_value_str(), m_location_str(),
+ m_summary_str(), m_object_desc_str(), m_validation_result(),
+ m_manager(parent.GetManager()), m_children(), m_synthetic_children(),
+ m_dynamic_value(nullptr), m_synthetic_value(nullptr),
+ m_deref_valobj(nullptr), m_format(eFormatDefault),
m_last_format(eFormatDefault), m_last_format_mgr_revision(0),
m_type_summary_sp(), m_type_format_sp(), m_synthetic_children_sp(),
m_type_validator_sp(), m_user_id_of_forced_summary(),
@@ -106,21 +104,19 @@ ValueObject::ValueObject(ValueObject &parent)
m_manager->ManageObject(this);
}
-//----------------------------------------------------------------------
// ValueObject constructor
-//----------------------------------------------------------------------
ValueObject::ValueObject(ExecutionContextScope *exe_scope,
AddressType child_ptr_or_ref_addr_type)
: UserID(++g_value_obj_uid), // Unique identifier for every value object
- m_parent(NULL), m_root(NULL), m_update_point(exe_scope), m_name(),
+ m_parent(nullptr), m_root(nullptr), m_update_point(exe_scope), m_name(),
m_data(), m_value(), m_error(), m_value_str(), m_old_value_str(),
m_location_str(), m_summary_str(), m_object_desc_str(),
m_validation_result(), m_manager(), m_children(), m_synthetic_children(),
- m_dynamic_value(NULL), m_synthetic_value(NULL), m_deref_valobj(NULL),
- m_format(eFormatDefault), m_last_format(eFormatDefault),
- m_last_format_mgr_revision(0), m_type_summary_sp(), m_type_format_sp(),
- m_synthetic_children_sp(), m_type_validator_sp(),
- m_user_id_of_forced_summary(),
+ m_dynamic_value(nullptr), m_synthetic_value(nullptr),
+ m_deref_valobj(nullptr), m_format(eFormatDefault),
+ m_last_format(eFormatDefault), m_last_format_mgr_revision(0),
+ m_type_summary_sp(), m_type_format_sp(), m_synthetic_children_sp(),
+ m_type_validator_sp(), m_user_id_of_forced_summary(),
m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
m_value_checksum(),
m_preferred_display_language(lldb::eLanguageTypeUnknown),
@@ -135,9 +131,7 @@ ValueObject::ValueObject(ExecutionContextScope *exe_scope,
m_manager->ManageObject(this);
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
ValueObject::~ValueObject() {}
bool ValueObject::UpdateValueIfNeeded(bool update_format) {
@@ -285,51 +279,21 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
return compiler_type;
}
- CompilerType class_type;
- bool is_pointer_type = false;
-
- if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
- is_pointer_type = true;
- } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
- class_type = compiler_type;
- } else {
- return compiler_type;
- }
-
m_did_calculate_complete_objc_class_type = true;
- if (class_type) {
- ConstString class_name(class_type.GetConstTypeName());
-
- if (class_name) {
- ProcessSP process_sp(
- GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-
- if (process_sp) {
- ObjCLanguageRuntime *objc_language_runtime(
- process_sp->GetObjCLanguageRuntime());
+ ProcessSP process_sp(
+ GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
- if (objc_language_runtime) {
- TypeSP complete_objc_class_type_sp =
- objc_language_runtime->LookupInCompleteClassCache(class_name);
-
- if (complete_objc_class_type_sp) {
- CompilerType complete_class(
- complete_objc_class_type_sp->GetFullCompilerType());
-
- if (complete_class.GetCompleteType()) {
- if (is_pointer_type) {
- m_override_type = complete_class.GetPointerType();
- } else {
- m_override_type = complete_class;
- }
+ if (!process_sp)
+ return compiler_type;
- if (m_override_type.IsValid())
- return m_override_type;
- }
- }
- }
- }
+ if (auto *runtime =
+ process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
+ if (llvm::Optional<CompilerType> complete_type =
+ runtime->GetRuntimeType(compiler_type)) {
+ m_override_type = complete_type.getValue();
+ if (m_override_type.IsValid())
+ return m_override_type;
}
}
return compiler_type;
@@ -351,7 +315,7 @@ const Status &ValueObject::GetError() {
return m_error;
}
-const ConstString &ValueObject::GetName() const { return m_name; }
+ConstString ValueObject::GetName() const { return m_name; }
const char *ValueObject::GetLocationAsCString() {
return GetLocationAsCStringImpl(m_value, m_data);
@@ -471,7 +435,7 @@ ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) {
}
ValueObject *child = m_children.GetChildAtIndex(idx);
- if (child != NULL)
+ if (child != nullptr)
return child->GetSP();
}
return child_sp;
@@ -544,13 +508,13 @@ lldb::ValueObjectSP ValueObject::GetChildAtNamePath(
return root;
}
-size_t ValueObject::GetIndexOfChildWithName(const ConstString &name) {
+size_t ValueObject::GetIndexOfChildWithName(ConstString name) {
bool omit_empty_base_classes = true;
return GetCompilerType().GetIndexOfChildWithName(name.GetCString(),
omit_empty_base_classes);
}
-ValueObjectSP ValueObject::GetChildMemberWithName(const ConstString &name,
+ValueObjectSP ValueObject::GetChildMemberWithName(ConstString name,
bool can_create) {
// when getting a child by name, it could be buried inside some base classes
// (which really aren't part of the expression path), so we need a vector of
@@ -618,12 +582,12 @@ void ValueObject::SetNumChildren(size_t num_children) {
m_children.SetChildrenCount(num_children);
}
-void ValueObject::SetName(const ConstString &name) { m_name = name; }
+void ValueObject::SetName(ConstString name) { m_name = name; }
ValueObject *ValueObject::CreateChildAtIndex(size_t idx,
bool synthetic_array_member,
int32_t synthetic_index) {
- ValueObject *valobj = NULL;
+ ValueObject *valobj = nullptr;
bool omit_empty_base_classes = true;
bool ignore_array_bounds = synthetic_array_member;
@@ -716,7 +680,7 @@ const char *ValueObject::GetSummaryAsCString(lldb::LanguageType lang) {
summary_options);
}
if (m_summary_str.empty())
- return NULL;
+ return nullptr;
return m_summary_str.c_str();
}
@@ -769,12 +733,12 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
if (is_pointer_type) {
Status error;
ValueObjectSP pointee_sp = Dereference(error);
- if (error.Fail() || pointee_sp.get() == NULL)
+ if (error.Fail() || pointee_sp.get() == nullptr)
return 0;
return pointee_sp->GetData(data, error);
} else {
ValueObjectSP child_sp = GetChildAtIndex(0, true);
- if (child_sp.get() == NULL)
+ if (child_sp.get() == nullptr)
return 0;
Status error;
return child_sp->GetData(data, error);
@@ -783,7 +747,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
} else /* (items > 1) */
{
Status error;
- lldb_private::DataBufferHeap *heap_buf_ptr = NULL;
+ lldb_private::DataBufferHeap *heap_buf_ptr = nullptr;
lldb::DataBufferSP data_sp(heap_buf_ptr =
new lldb_private::DataBufferHeap());
@@ -929,7 +893,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
static bool CopyStringDataToBufferSP(const StreamString &source,
lldb::DataBufferSP &destination) {
- destination.reset(new DataBufferHeap(source.GetSize() + 1, 0));
+ destination = std::make_shared<DataBufferHeap>(source.GetSize() + 1, 0);
memcpy(destination->GetBytes(), source.GetString().data(), source.GetSize());
return true;
}
@@ -970,7 +934,7 @@ ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
if (is_array) {
// We have an array
uint64_t array_size = 0;
- if (compiler_type.IsArrayType(NULL, &array_size, NULL)) {
+ if (compiler_type.IsArrayType(nullptr, &array_size, nullptr)) {
cstr_len = array_size;
if (cstr_len > max_length) {
capped_data = true;
@@ -992,7 +956,7 @@ ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
CopyStringDataToBufferSP(s, buffer_sp);
return {0, was_capped};
}
- buffer_sp.reset(new DataBufferHeap(cstr_len, 0));
+ buffer_sp = std::make_shared<DataBufferHeap>(cstr_len, 0);
memcpy(buffer_sp->GetBytes(), cstr, cstr_len);
return {cstr_len, was_capped};
} else {
@@ -1092,44 +1056,40 @@ std::pair<TypeValidatorResult, std::string> ValueObject::GetValidationStatus() {
}
const char *ValueObject::GetObjectDescription() {
-
if (!UpdateValueIfNeeded(true))
- return NULL;
+ return nullptr;
+ // Return cached value.
if (!m_object_desc_str.empty())
return m_object_desc_str.c_str();
ExecutionContext exe_ctx(GetExecutionContextRef());
Process *process = exe_ctx.GetProcessPtr();
- if (process == NULL)
- return NULL;
-
- StreamString s;
-
- LanguageType language = GetObjectRuntimeLanguage();
- LanguageRuntime *runtime = process->GetLanguageRuntime(language);
+ if (!process)
+ return nullptr;
- if (runtime == NULL) {
- // Aw, hell, if the things a pointer, or even just an integer, let's try
- // ObjC anyway...
- CompilerType compiler_type = GetCompilerType();
- if (compiler_type) {
- bool is_signed;
- if (compiler_type.IsIntegerType(is_signed) ||
- compiler_type.IsPointerType()) {
- runtime = process->GetLanguageRuntime(eLanguageTypeObjC);
+ // Returns the object description produced by one language runtime.
+ auto get_object_description = [&](LanguageType language) -> const char * {
+ if (LanguageRuntime *runtime = process->GetLanguageRuntime(language)) {
+ StreamString s;
+ if (runtime->GetObjectDescription(s, *this)) {
+ m_object_desc_str.append(s.GetString());
+ return m_object_desc_str.c_str();
}
}
- }
+ return nullptr;
+ };
- if (runtime && runtime->GetObjectDescription(s, *this)) {
- m_object_desc_str.append(s.GetString());
- }
+ // Try the native language runtime first.
+ LanguageType native_language = GetObjectRuntimeLanguage();
+ if (const char *desc = get_object_description(native_language))
+ return desc;
- if (m_object_desc_str.empty())
- return NULL;
- else
- return m_object_desc_str.c_str();
+ // Try the Objective-C language runtime. This fallback is necessary
+ // for Objective-C++ and mixed Objective-C / C++ programs.
+ if (Language::LanguageIsCFamily(native_language))
+ return get_object_description(eLanguageTypeObjC);
+ return nullptr;
}
bool ValueObject::GetValueAsCString(const lldb_private::TypeFormatImpl &format,
@@ -1169,7 +1129,7 @@ const char *ValueObject::GetValueAsCString() {
if (my_format != m_last_format || m_value_str.empty()) {
m_last_format = my_format;
if (!format_sp)
- format_sp.reset(new TypeFormatImpl_Format(my_format));
+ format_sp = std::make_shared<TypeFormatImpl_Format>(my_format);
if (GetValueAsCString(*format_sp.get(), m_value_str)) {
if (!m_value_did_change && m_old_value_valid) {
// The value was gotten successfully, so we consider the value as
@@ -1180,7 +1140,7 @@ const char *ValueObject::GetValueAsCString() {
}
}
if (m_value_str.empty())
- return NULL;
+ return nullptr;
return m_value_str.c_str();
}
@@ -1291,7 +1251,7 @@ bool ValueObject::DumpPrintableRepresentation(
buffer_sp, lldb::eByteOrderInvalid,
8)); // none of this matters for a string - pass some defaults
options.SetStream(&s);
- options.SetPrefixToken(0);
+ options.SetPrefixToken(nullptr);
options.SetQuote('"');
options.SetSourceSize(buffer_sp->GetByteSize());
options.SetIsTruncated(read_string.second);
@@ -1658,12 +1618,12 @@ LanguageType ValueObject::GetObjectRuntimeLanguage() {
return GetCompilerType().GetMinimumLanguage();
}
-void ValueObject::AddSyntheticChild(const ConstString &key,
+void ValueObject::AddSyntheticChild(ConstString key,
ValueObject *valobj) {
m_synthetic_children[key] = valobj;
}
-ValueObjectSP ValueObject::GetSyntheticChild(const ConstString &key) const {
+ValueObjectSP ValueObject::GetSyntheticChild(ConstString key) const {
ValueObjectSP synthetic_child_sp;
std::map<ConstString, ValueObject *>::const_iterator pos =
m_synthetic_children.find(key);
@@ -1680,7 +1640,7 @@ ValueObject::GetTypeInfo(CompilerType *pointee_or_element_compiler_type) {
bool ValueObject::IsPointerType() { return GetCompilerType().IsPointerType(); }
bool ValueObject::IsArrayType() {
- return GetCompilerType().IsArrayType(NULL, NULL, NULL);
+ return GetCompilerType().IsArrayType(nullptr, nullptr, nullptr);
}
bool ValueObject::IsScalarType() { return GetCompilerType().IsScalarType(); }
@@ -1699,20 +1659,33 @@ bool ValueObject::IsPossibleDynamicType() {
if (process)
return process->IsPossibleDynamicValue(*this);
else
- return GetCompilerType().IsPossibleDynamicType(NULL, true, true);
+ return GetCompilerType().IsPossibleDynamicType(nullptr, true, true);
}
bool ValueObject::IsRuntimeSupportValue() {
Process *process(GetProcessSP().get());
- if (process) {
- LanguageRuntime *runtime =
- process->GetLanguageRuntime(GetObjectRuntimeLanguage());
- if (!runtime)
- runtime = process->GetObjCLanguageRuntime();
- if (runtime)
- return runtime->IsRuntimeSupportValue(*this);
+ if (!process)
+ return false;
+
+ // We trust the the compiler did the right thing and marked runtime support
+ // values as artificial.
+ if (!GetVariable() || !GetVariable()->IsArtificial())
+ return false;
+
+ LanguageType lang = eLanguageTypeUnknown;
+ if (auto *sym_ctx_scope = GetSymbolContextScope()) {
+ if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
+ lang = func->GetLanguage();
+ else if (auto *comp_unit =
+ sym_ctx_scope->CalculateSymbolContextCompileUnit())
+ lang = comp_unit->GetLanguage();
}
- return false;
+
+ if (auto *runtime = process->GetLanguageRuntime(lang))
+ if (runtime->IsWhitelistedRuntimeValue(GetName()))
+ return false;
+
+ return true;
}
bool ValueObject::IsNilReference() {
@@ -1907,7 +1880,7 @@ ValueObject::GetSyntheticExpressionPathChild(const char *expression,
// We haven't made a synthetic array member for expression yet, so lets
// make one and cache it for any future reference.
synthetic_child_sp = GetValueForExpressionPath(
- expression, NULL, NULL,
+ expression, nullptr, nullptr,
GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
None));
@@ -1930,7 +1903,7 @@ void ValueObject::CalculateSyntheticValue(bool use_synthetic) {
TargetSP target_sp(GetTargetSP());
if (target_sp && !target_sp->GetEnableSyntheticValue()) {
- m_synthetic_value = NULL;
+ m_synthetic_value = nullptr;
return;
}
@@ -1939,7 +1912,7 @@ void ValueObject::CalculateSyntheticValue(bool use_synthetic) {
if (!UpdateFormatsIfNeeded() && m_synthetic_value)
return;
- if (m_synthetic_children_sp.get() == NULL)
+ if (m_synthetic_children_sp.get() == nullptr)
return;
if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value)
@@ -1966,7 +1939,7 @@ ValueObjectSP ValueObject::GetDynamicValue(DynamicValueType use_dynamic) {
if (use_dynamic == eNoDynamicValues)
return ValueObjectSP();
- if (!IsDynamic() && m_dynamic_value == NULL) {
+ if (!IsDynamic() && m_dynamic_value == nullptr) {
CalculateDynamicValue(use_dynamic);
}
if (m_dynamic_value)
@@ -1994,7 +1967,7 @@ ValueObjectSP ValueObject::GetSyntheticValue(bool use_synthetic) {
bool ValueObject::HasSyntheticValue() {
UpdateFormatsIfNeeded();
- if (m_synthetic_children_sp.get() == NULL)
+ if (m_synthetic_children_sp.get() == nullptr)
return false;
CalculateSyntheticValue(true);
@@ -2027,7 +2000,7 @@ ValueObject *ValueObject::GetNonBaseClassParent() {
else
return GetParent();
}
- return NULL;
+ return nullptr;
}
bool ValueObject::IsBaseClass(uint32_t &depth) {
@@ -2741,7 +2714,7 @@ void ValueObject::Dump(Stream &s, const DumpValueObjectOptions &options) {
printer.PrintValueObject();
}
-ValueObjectSP ValueObject::CreateConstantValue(const ConstString &name) {
+ValueObjectSP ValueObject::CreateConstantValue(ConstString name) {
ValueObjectSP valobj_sp;
if (UpdateValueIfNeeded(false) && m_error.Success()) {
@@ -2917,7 +2890,7 @@ ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) {
return ValueObjectCast::Create(*this, GetName(), compiler_type);
}
-lldb::ValueObjectSP ValueObject::Clone(const ConstString &new_name) {
+lldb::ValueObjectSP ValueObject::Clone(ConstString new_name) {
return ValueObjectCast::Create(*this, new_name, GetCompilerType());
}
@@ -3012,12 +2985,12 @@ bool ValueObject::EvaluationPoint::SyncWithProcessState(
ExecutionContext exe_ctx(
m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
- if (exe_ctx.GetTargetPtr() == NULL)
+ if (exe_ctx.GetTargetPtr() == nullptr)
return false;
// If we don't have a process nothing can change.
Process *process = exe_ctx.GetProcessPtr();
- if (process == NULL)
+ if (process == nullptr)
return false;
// If our stop id is the current stop ID, nothing has changed:
@@ -3098,7 +3071,7 @@ void ValueObject::ClearUserVisibleData(uint32_t clear_mask) {
if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) ==
eClearUserVisibleDataItemsSyntheticChildren) {
if (m_synthetic_value)
- m_synthetic_value = NULL;
+ m_synthetic_value = nullptr;
}
if ((clear_mask & eClearUserVisibleDataItemsValidator) ==
@@ -3111,7 +3084,7 @@ SymbolContextScope *ValueObject::GetSymbolContextScope() {
if (!m_parent->IsPointerOrReferenceType())
return m_parent->GetSymbolContextScope();
}
- return NULL;
+ return nullptr;
}
lldb::ValueObjectSP
@@ -3405,4 +3378,3 @@ lldb::StackFrameSP ValueObjectManager::GetFrameSP() const {
return m_root_valobj_sp->GetFrameSP();
return lldb::StackFrameSP();
}
-
diff --git a/source/Core/ValueObjectCast.cpp b/source/Core/ValueObjectCast.cpp
index fb0b55b6efdf9..6ccda8c32915e 100644
--- a/source/Core/ValueObjectCast.cpp
+++ b/source/Core/ValueObjectCast.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectCast.cpp -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,14 +22,14 @@ class ConstString;
using namespace lldb_private;
lldb::ValueObjectSP ValueObjectCast::Create(ValueObject &parent,
- const ConstString &name,
+ ConstString name,
const CompilerType &cast_type) {
ValueObjectCast *cast_valobj_ptr =
new ValueObjectCast(parent, name, cast_type);
return cast_valobj_ptr->GetSP();
}
-ValueObjectCast::ValueObjectCast(ValueObject &parent, const ConstString &name,
+ValueObjectCast::ValueObjectCast(ValueObject &parent, ConstString name,
const CompilerType &cast_type)
: ValueObject(parent), m_cast_type(cast_type) {
SetName(name);
diff --git a/source/Core/ValueObjectChild.cpp b/source/Core/ValueObjectChild.cpp
index 0f7be8317dec7..01f2e20dd0bcd 100644
--- a/source/Core/ValueObjectChild.cpp
+++ b/source/Core/ValueObjectChild.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectChild.cpp ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -29,7 +28,7 @@ using namespace lldb_private;
ValueObjectChild::ValueObjectChild(
ValueObject &parent, const CompilerType &compiler_type,
- const ConstString &name, uint64_t byte_size, int32_t byte_offset,
+ ConstString name, uint64_t byte_size, int32_t byte_offset,
uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
bool is_base_class, bool is_deref_of_parent,
AddressType child_ptr_or_ref_addr_type, uint64_t language_flags)
diff --git a/source/Core/ValueObjectConstResult.cpp b/source/Core/ValueObjectConstResult.cpp
index f6e32c03b0eb3..a1b2cac96874f 100644
--- a/source/Core/ValueObjectConstResult.cpp
+++ b/source/Core/ValueObjectConstResult.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResult.cpp ------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -50,7 +49,7 @@ ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name,
+ ConstString name,
const DataExtractor &data,
lldb::addr_t address) {
return (new ValueObjectConstResult(exe_scope, compiler_type, name, data,
@@ -60,7 +59,7 @@ ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
ValueObjectConstResult::ValueObjectConstResult(
ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, const DataExtractor &data, lldb::addr_t address)
+ ConstString name, const DataExtractor &data, lldb::addr_t address)
: ValueObject(exe_scope), m_type_name(), m_byte_size(0),
m_impl(this, address) {
m_data = data;
@@ -82,7 +81,7 @@ ValueObjectConstResult::ValueObjectConstResult(
ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name,
+ ConstString name,
const lldb::DataBufferSP &data_sp,
lldb::ByteOrder data_byte_order,
uint32_t data_addr_size,
@@ -94,14 +93,14 @@ ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
Value &value,
- const ConstString &name,
+ ConstString name,
Module *module) {
return (new ValueObjectConstResult(exe_scope, value, name, module))->GetSP();
}
ValueObjectConstResult::ValueObjectConstResult(
ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, const lldb::DataBufferSP &data_sp,
+ ConstString name, const lldb::DataBufferSP &data_sp,
lldb::ByteOrder data_byte_order, uint32_t data_addr_size,
lldb::addr_t address)
: ValueObject(exe_scope), m_type_name(), m_byte_size(0),
@@ -121,7 +120,7 @@ ValueObjectConstResult::ValueObjectConstResult(
ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name,
+ ConstString name,
lldb::addr_t address,
AddressType address_type,
uint32_t addr_byte_size) {
@@ -132,7 +131,7 @@ ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
ValueObjectConstResult::ValueObjectConstResult(
ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, lldb::addr_t address, AddressType address_type,
+ ConstString name, lldb::addr_t address, AddressType address_type,
uint32_t addr_byte_size)
: ValueObject(exe_scope), m_type_name(), m_byte_size(0),
m_impl(this, address) {
@@ -176,7 +175,7 @@ ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
const Value &value,
- const ConstString &name,
+ ConstString name,
Module *module)
: ValueObject(exe_scope), m_type_name(), m_byte_size(0), m_impl(this) {
m_value = value;
diff --git a/source/Core/ValueObjectConstResultCast.cpp b/source/Core/ValueObjectConstResultCast.cpp
index c04043264af10..b47e699e30f10 100644
--- a/source/Core/ValueObjectConstResultCast.cpp
+++ b/source/Core/ValueObjectConstResultCast.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultCast.cpp --------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -22,7 +21,7 @@ class ValueObject;
using namespace lldb_private;
ValueObjectConstResultCast::ValueObjectConstResultCast(
- ValueObject &parent, const ConstString &name, const CompilerType &cast_type,
+ ValueObject &parent, ConstString name, const CompilerType &cast_type,
lldb::addr_t live_address)
: ValueObjectCast(parent, name, cast_type), m_impl(this, live_address) {
m_name = name;
diff --git a/source/Core/ValueObjectConstResultChild.cpp b/source/Core/ValueObjectConstResultChild.cpp
index 441c16479f2c6..4e0b303b69d59 100644
--- a/source/Core/ValueObjectConstResultChild.cpp
+++ b/source/Core/ValueObjectConstResultChild.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultChild.cpp --------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,7 +23,7 @@ using namespace lldb_private;
ValueObjectConstResultChild::ValueObjectConstResultChild(
ValueObject &parent, const CompilerType &compiler_type,
- const ConstString &name, uint32_t byte_size, int32_t byte_offset,
+ ConstString name, uint32_t byte_size, int32_t byte_offset,
uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
bool is_base_class, bool is_deref_of_parent, lldb::addr_t live_address,
uint64_t language_flags)
diff --git a/source/Core/ValueObjectConstResultImpl.cpp b/source/Core/ValueObjectConstResultImpl.cpp
index 6bf8e62db0679..de51735736b9c 100644
--- a/source/Core/ValueObjectConstResultImpl.cpp
+++ b/source/Core/ValueObjectConstResultImpl.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultImpl.cpp ---------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -40,7 +39,7 @@ ValueObjectConstResultImpl::ValueObjectConstResultImpl(
m_address_of_backend() {}
lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) {
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return lldb::ValueObjectSP();
return m_impl_backend->ValueObject::Dereference(error);
@@ -48,12 +47,12 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) {
ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex(
size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
- if (m_impl_backend == NULL)
- return NULL;
+ if (m_impl_backend == nullptr)
+ return nullptr;
m_impl_backend->UpdateValueIfNeeded(false);
- ValueObjectConstResultChild *valobj = NULL;
+ ValueObjectConstResultChild *valobj = nullptr;
bool omit_empty_base_classes = true;
bool ignore_array_bounds = synthetic_array_member;
@@ -107,7 +106,7 @@ ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex(
lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset(
uint32_t offset, const CompilerType &type, bool can_create,
ConstString name_const_str) {
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return lldb::ValueObjectSP();
return m_impl_backend->ValueObject::GetSyntheticChildAtOffset(
@@ -115,10 +114,10 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset(
}
lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) {
- if (m_address_of_backend.get() != NULL)
+ if (m_address_of_backend.get() != nullptr)
return m_address_of_backend;
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return lldb::ValueObjectSP();
if (m_live_address != LLDB_INVALID_ADDRESS) {
CompilerType compiler_type(m_impl_backend->GetCompilerType());
@@ -144,7 +143,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) {
lldb::ValueObjectSP
ValueObjectConstResultImpl::Cast(const CompilerType &compiler_type) {
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return lldb::ValueObjectSP();
ValueObjectConstResultCast *result_cast =
@@ -157,7 +156,7 @@ lldb::addr_t
ValueObjectConstResultImpl::GetAddressOf(bool scalar_is_load_address,
AddressType *address_type) {
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return 0;
if (m_live_address == LLDB_INVALID_ADDRESS) {
@@ -174,7 +173,7 @@ ValueObjectConstResultImpl::GetAddressOf(bool scalar_is_load_address,
size_t ValueObjectConstResultImpl::GetPointeeData(DataExtractor &data,
uint32_t item_idx,
uint32_t item_count) {
- if (m_impl_backend == NULL)
+ if (m_impl_backend == nullptr)
return 0;
return m_impl_backend->ValueObject::GetPointeeData(data, item_idx,
item_count);
diff --git a/source/Core/ValueObjectDynamicValue.cpp b/source/Core/ValueObjectDynamicValue.cpp
index 161b6e49e0dda..90b46d1f170de 100644
--- a/source/Core/ValueObjectDynamicValue.cpp
+++ b/source/Core/ValueObjectDynamicValue.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectDynamicValue.cpp ------------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/source/Core/ValueObjectList.cpp b/source/Core/ValueObjectList.cpp
index 7a7e0d8417b7e..358a1b14517b9 100644
--- a/source/Core/ValueObjectList.cpp
+++ b/source/Core/ValueObjectList.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectList.cpp -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -18,13 +17,6 @@
using namespace lldb;
using namespace lldb_private;
-ValueObjectList::ValueObjectList() : m_value_objects() {}
-
-ValueObjectList::ValueObjectList(const ValueObjectList &rhs)
- : m_value_objects(rhs.m_value_objects) {}
-
-ValueObjectList::~ValueObjectList() {}
-
const ValueObjectList &ValueObjectList::operator=(const ValueObjectList &rhs) {
if (this != &rhs)
m_value_objects = rhs.m_value_objects;
diff --git a/source/Core/ValueObjectMemory.cpp b/source/Core/ValueObjectMemory.cpp
index 24103204ee47e..95d4330ee0c6b 100644
--- a/source/Core/ValueObjectMemory.cpp
+++ b/source/Core/ValueObjectMemory.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectMemory.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -50,7 +49,7 @@ ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
: ValueObject(exe_scope), m_address(address), m_type_sp(type_sp),
m_compiler_type() {
// Do not attempt to construct one of these objects with no variable!
- assert(m_type_sp.get() != NULL);
+ assert(m_type_sp.get() != nullptr);
SetName(ConstString(name));
m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
TargetSP target_sp(GetTargetSP());
@@ -137,10 +136,8 @@ size_t ValueObjectMemory::CalculateNumChildren(uint32_t max) {
uint64_t ValueObjectMemory::GetByteSize() {
if (m_type_sp)
- return m_type_sp->GetByteSize();
- if (llvm::Optional<uint64_t> size = m_compiler_type.GetByteSize(nullptr))
- return *size;
- return 0;
+ return m_type_sp->GetByteSize().getValueOr(0);
+ return m_compiler_type.GetByteSize(nullptr).getValueOr(0);
}
lldb::ValueType ValueObjectMemory::GetValueType() const {
diff --git a/source/Core/ValueObjectRegister.cpp b/source/Core/ValueObjectRegister.cpp
index 41d1c27f73619..75a254fbbc21d 100644
--- a/source/Core/ValueObjectRegister.cpp
+++ b/source/Core/ValueObjectRegister.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectRegister.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -77,7 +76,7 @@ bool ValueObjectRegisterContext::UpdateValue() {
else
m_reg_ctx_sp.reset();
- if (m_reg_ctx_sp.get() == NULL) {
+ if (m_reg_ctx_sp.get() == nullptr) {
SetValueIsValid(false);
m_error.SetErrorToGenericError();
} else
@@ -88,7 +87,7 @@ bool ValueObjectRegisterContext::UpdateValue() {
ValueObject *ValueObjectRegisterContext::CreateChildAtIndex(
size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
- ValueObject *new_valobj = NULL;
+ ValueObject *new_valobj = nullptr;
const size_t num_children = GetNumChildren();
if (idx < num_children) {
@@ -113,7 +112,7 @@ ValueObjectRegisterSet::Create(ExecutionContextScope *exe_scope,
ValueObjectRegisterSet::ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
lldb::RegisterContextSP &reg_ctx,
uint32_t reg_set_idx)
- : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_set(NULL),
+ : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_set(nullptr),
m_reg_set_idx(reg_set_idx) {
assert(reg_ctx);
m_reg_set = reg_ctx->GetRegisterSet(m_reg_set_idx);
@@ -150,13 +149,13 @@ bool ValueObjectRegisterSet::UpdateValue() {
SetValueDidChange(false);
ExecutionContext exe_ctx(GetExecutionContextRef());
StackFrame *frame = exe_ctx.GetFramePtr();
- if (frame == NULL)
+ if (frame == nullptr)
m_reg_ctx_sp.reset();
else {
m_reg_ctx_sp = frame->GetRegisterContext();
if (m_reg_ctx_sp) {
const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx);
- if (reg_set == NULL)
+ if (reg_set == nullptr)
m_reg_ctx_sp.reset();
else if (m_reg_set != reg_set) {
SetValueDidChange(true);
@@ -176,7 +175,7 @@ bool ValueObjectRegisterSet::UpdateValue() {
ValueObject *ValueObjectRegisterSet::CreateChildAtIndex(
size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
- ValueObject *valobj = NULL;
+ ValueObject *valobj = nullptr;
if (m_reg_ctx_sp && m_reg_set) {
const size_t num_children = GetNumChildren();
if (idx < num_children)
@@ -187,13 +186,13 @@ ValueObject *ValueObjectRegisterSet::CreateChildAtIndex(
}
lldb::ValueObjectSP
-ValueObjectRegisterSet::GetChildMemberWithName(const ConstString &name,
+ValueObjectRegisterSet::GetChildMemberWithName(ConstString name,
bool can_create) {
- ValueObject *valobj = NULL;
+ ValueObject *valobj = nullptr;
if (m_reg_ctx_sp && m_reg_set) {
const RegisterInfo *reg_info =
m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString());
- if (reg_info != NULL)
+ if (reg_info != nullptr)
valobj = new ValueObjectRegister(*this, m_reg_ctx_sp,
reg_info->kinds[eRegisterKindLLDB]);
}
@@ -204,11 +203,11 @@ ValueObjectRegisterSet::GetChildMemberWithName(const ConstString &name,
}
size_t
-ValueObjectRegisterSet::GetIndexOfChildWithName(const ConstString &name) {
+ValueObjectRegisterSet::GetIndexOfChildWithName(ConstString name) {
if (m_reg_ctx_sp && m_reg_set) {
const RegisterInfo *reg_info =
m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString());
- if (reg_info != NULL)
+ if (reg_info != nullptr)
return reg_info->kinds[eRegisterKindLLDB];
}
return UINT32_MAX;
@@ -290,7 +289,7 @@ bool ValueObjectRegister::UpdateValue() {
m_error.Clear();
ExecutionContext exe_ctx(GetExecutionContextRef());
StackFrame *frame = exe_ctx.GetFramePtr();
- if (frame == NULL) {
+ if (frame == nullptr) {
m_reg_ctx_sp.reset();
m_reg_value.Clear();
}
diff --git a/source/Core/ValueObjectSyntheticFilter.cpp b/source/Core/ValueObjectSyntheticFilter.cpp
index d22b1dc1c57d6..4004732357592 100644
--- a/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/source/Core/ValueObjectSyntheticFilter.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectSyntheticFilter.cpp --------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -37,7 +36,7 @@ public:
return m_backend.GetChildAtIndex(idx, true);
}
- size_t GetIndexOfChildWithName(const ConstString &name) override {
+ size_t GetIndexOfChildWithName(ConstString name) override {
return m_backend.GetIndexOfChildWithName(name);
}
@@ -73,7 +72,7 @@ ConstString ValueObjectSynthetic::GetQualifiedTypeName() {
}
ConstString ValueObjectSynthetic::GetDisplayTypeName() {
- if (ConstString synth_name = m_synth_filter_ap->GetSyntheticTypeName())
+ if (ConstString synth_name = m_synth_filter_up->GetSyntheticTypeName())
return synth_name;
return m_parent->GetDisplayTypeName();
@@ -87,7 +86,7 @@ size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
return m_synthetic_children_count <= max ? m_synthetic_children_count : max;
if (max < UINT32_MAX) {
- size_t num_children = m_synth_filter_ap->CalculateNumChildren(max);
+ size_t num_children = m_synth_filter_up->CalculateNumChildren(max);
if (log)
log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
"%s and type %s, the filter returned %zu child values",
@@ -96,7 +95,7 @@ size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
return num_children;
} else {
size_t num_children = (m_synthetic_children_count =
- m_synth_filter_ap->CalculateNumChildren(max));
+ m_synth_filter_up->CalculateNumChildren(max));
if (log)
log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
"%s and type %s, the filter returned %zu child values",
@@ -118,7 +117,7 @@ ValueObjectSynthetic::GetDynamicValue(lldb::DynamicValueType valueType) {
bool ValueObjectSynthetic::MightHaveChildren() {
if (m_might_have_children == eLazyBoolCalculate)
m_might_have_children =
- (m_synth_filter_ap->MightHaveChildren() ? eLazyBoolYes : eLazyBoolNo);
+ (m_synth_filter_up->MightHaveChildren() ? eLazyBoolYes : eLazyBoolNo);
return (m_might_have_children != eLazyBoolNo);
}
@@ -141,9 +140,9 @@ void ValueObjectSynthetic::CreateSynthFilter() {
valobj_for_frontend = deref_sp.get();
}
}
- m_synth_filter_ap = (m_synth_sp->GetFrontEnd(*valobj_for_frontend));
- if (!m_synth_filter_ap.get())
- m_synth_filter_ap = llvm::make_unique<DummySyntheticFrontEnd>(*m_parent);
+ m_synth_filter_up = (m_synth_sp->GetFrontEnd(*valobj_for_frontend));
+ if (!m_synth_filter_up)
+ m_synth_filter_up = llvm::make_unique<DummySyntheticFrontEnd>(*m_parent);
}
bool ValueObjectSynthetic::UpdateValue() {
@@ -174,7 +173,7 @@ bool ValueObjectSynthetic::UpdateValue() {
}
// let our backend do its update
- if (!m_synth_filter_ap->Update()) {
+ if (!m_synth_filter_up->Update()) {
if (log)
log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
"filter said caches are stale - clearing",
@@ -199,7 +198,7 @@ bool ValueObjectSynthetic::UpdateValue() {
m_provides_value = eLazyBoolCalculate;
- lldb::ValueObjectSP synth_val(m_synth_filter_ap->GetSyntheticValue());
+ lldb::ValueObjectSP synth_val(m_synth_filter_up->GetSyntheticValue());
if (synth_val && synth_val->CanProvideValue()) {
if (log)
@@ -236,13 +235,13 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
ValueObject *valobj;
if (!m_children_byindex.GetValueForKey(idx, valobj)) {
- if (can_create && m_synth_filter_ap.get() != nullptr) {
+ if (can_create && m_synth_filter_up != nullptr) {
if (log)
log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
"index %zu not cached and will be created",
GetName().AsCString(), idx);
- lldb::ValueObjectSP synth_guy = m_synth_filter_ap->GetChildAtIndex(idx);
+ lldb::ValueObjectSP synth_guy = m_synth_filter_up->GetChildAtIndex(idx);
if (log)
log->Printf(
@@ -269,7 +268,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
"index %zu not cached and cannot "
"be created (can_create = %s, synth_filter = %p)",
GetName().AsCString(), idx, can_create ? "yes" : "no",
- static_cast<void *>(m_synth_filter_ap.get()));
+ static_cast<void *>(m_synth_filter_up.get()));
return lldb::ValueObjectSP();
}
@@ -284,7 +283,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
}
lldb::ValueObjectSP
-ValueObjectSynthetic::GetChildMemberWithName(const ConstString &name,
+ValueObjectSynthetic::GetChildMemberWithName(ConstString name,
bool can_create) {
UpdateValueIfNeeded();
@@ -296,19 +295,19 @@ ValueObjectSynthetic::GetChildMemberWithName(const ConstString &name,
return GetChildAtIndex(index, can_create);
}
-size_t ValueObjectSynthetic::GetIndexOfChildWithName(const ConstString &name) {
+size_t ValueObjectSynthetic::GetIndexOfChildWithName(ConstString name) {
UpdateValueIfNeeded();
uint32_t found_index = UINT32_MAX;
bool did_find = m_name_toindex.GetValueForKey(name.GetCString(), found_index);
- if (!did_find && m_synth_filter_ap.get() != nullptr) {
- uint32_t index = m_synth_filter_ap->GetIndexOfChildWithName(name);
+ if (!did_find && m_synth_filter_up != nullptr) {
+ uint32_t index = m_synth_filter_up->GetIndexOfChildWithName(name);
if (index == UINT32_MAX)
return index;
m_name_toindex.SetValueForKey(name.GetCString(), index);
return index;
- } else if (!did_find && m_synth_filter_ap.get() == nullptr)
+ } else if (!did_find && m_synth_filter_up == nullptr)
return UINT32_MAX;
else /*if (iter != m_name_toindex.end())*/
return found_index;
diff --git a/source/Core/ValueObjectVariable.cpp b/source/Core/ValueObjectVariable.cpp
index 4d401c56249cb..5aee82493b28f 100644
--- a/source/Core/ValueObjectVariable.cpp
+++ b/source/Core/ValueObjectVariable.cpp
@@ -1,9 +1,8 @@
//===-- ValueObjectVariable.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -58,7 +57,7 @@ ValueObjectVariable::ValueObjectVariable(ExecutionContextScope *exe_scope,
const lldb::VariableSP &var_sp)
: ValueObject(exe_scope), m_variable_sp(var_sp) {
// Do not attempt to construct one of these objects with no variable!
- assert(m_variable_sp.get() != NULL);
+ assert(m_variable_sp.get() != nullptr);
m_name = var_sp->GetName();
}
@@ -136,7 +135,7 @@ bool ValueObjectVariable::UpdateValue() {
else
m_error.SetErrorString("empty constant data");
// constant bytes can't be edited - sorry
- m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
+ m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr);
} else {
lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx(GetExecutionContextRef());
@@ -262,7 +261,7 @@ bool ValueObjectVariable::UpdateValue() {
SetValueIsValid(m_error.Success());
} else {
// could not find location, won't allow editing
- m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
+ m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr);
}
}
return m_error.Success();
@@ -299,7 +298,7 @@ lldb::ModuleSP ValueObjectVariable::GetModule() {
SymbolContextScope *ValueObjectVariable::GetSymbolContextScope() {
if (m_variable_sp)
return m_variable_sp->GetSymbolContextScope();
- return NULL;
+ return nullptr;
}
bool ValueObjectVariable::GetDeclaration(Declaration &decl) {