[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)
José Lira Junior via lldb-commits
lldb-commits at lists.llvm.org
Sun Oct 1 08:53:47 PDT 2023
https://github.com/junior-jl updated https://github.com/llvm/llvm-project/pull/67019
>From c2396253b9584af9eabe1e67ed922f5f5f0e879c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= <jljuniorpb at gmail.com>
Date: Thu, 21 Sep 2023 11:12:58 -0300
Subject: [PATCH 1/2] [lldb] add stop-at-user-entry option to process launch
[lldb] add command start
[lldb] add stop-at-main option to process launch
Revert "[lldb] add command start"
This reverts commit 11270775865a8415e00b4d899703f84717344967.
[lldb] remove shell modification | make bp one-shot
add GetUserEntryPointName method | changed bp creating method
use clang-format
change option description | using set for entrypoint names
use SetVector | change comments style
replace const char* by StringRef | change if statements to return early
---
lldb/include/lldb/Target/Language.h | 20 ++++++--
.../Commands/CommandOptionsProcessLaunch.cpp | 48 ++++++++++++++++++-
lldb/source/Commands/Options.td | 4 ++
.../Language/CPlusPlus/CPlusPlusLanguage.h | 6 ++-
.../Plugins/Language/ObjC/ObjCLanguage.h | 2 +
.../ObjCPlusPlus/ObjCPlusPlusLanguage.h | 2 +
6 files changed, 73 insertions(+), 9 deletions(-)
diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h
index a6b9ccaf31b3c42..cf781fc0e8dd5ee 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -95,21 +95,24 @@ class Language : public PluginInterface {
class EitherTypeScavenger : public TypeScavenger {
public:
EitherTypeScavenger() : TypeScavenger() {
- for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
+ for (std::shared_ptr<TypeScavenger> scavenger :
+ {std::shared_ptr<TypeScavenger>(new ScavengerTypes())...}) {
if (scavenger)
m_scavengers.push_back(scavenger);
}
}
+
protected:
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
const bool append = false;
- for (auto& scavenger : m_scavengers) {
+ for (auto &scavenger : m_scavengers) {
if (scavenger && scavenger->Find(exe_scope, key, results, append))
return true;
}
return false;
}
+
private:
std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
};
@@ -118,22 +121,25 @@ class Language : public PluginInterface {
class UnionTypeScavenger : public TypeScavenger {
public:
UnionTypeScavenger() : TypeScavenger() {
- for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
+ for (std::shared_ptr<TypeScavenger> scavenger :
+ {std::shared_ptr<TypeScavenger>(new ScavengerTypes())...}) {
if (scavenger)
m_scavengers.push_back(scavenger);
}
}
+
protected:
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
const bool append = true;
bool success = false;
- for (auto& scavenger : m_scavengers) {
+ for (auto &scavenger : m_scavengers) {
if (scavenger)
success = scavenger->Find(exe_scope, key, results, append) || success;
}
return success;
}
+
private:
std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
};
@@ -160,6 +166,10 @@ class Language : public PluginInterface {
virtual lldb::LanguageType GetLanguageType() const = 0;
+ // Implement this function to return the user-defined entry point name
+ // for the language
+ virtual llvm::StringRef GetUserEntryPointName() const { return {}; }
+
virtual bool IsTopLevelFunction(Function &function);
virtual bool IsSourceFile(llvm::StringRef file_path) const = 0;
@@ -232,7 +242,7 @@ class Language : public PluginInterface {
// a match. But we wouldn't want this to match AnotherA::my_function. The
// user is specifying a truncated path, not a truncated set of characters.
// This function does a language-aware comparison for those purposes.
- virtual bool DemangledNameContainsPath(llvm::StringRef path,
+ virtual bool DemangledNameContainsPath(llvm::StringRef path,
ConstString demangled) const;
// if a language has a custom format for printing variable declarations that
diff --git a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
index 85ad8ff5e07132c..2645b7bdd8c4ae6 100644
--- a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
@@ -8,6 +8,7 @@
#include "CommandOptionsProcessLaunch.h"
+#include "lldb/Core/Module.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/OptionParser.h"
@@ -15,11 +16,13 @@
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/CommandOptionArgumentTable.h"
#include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Target.h"
-
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SetVector.h"
using namespace llvm;
using namespace lldb;
@@ -38,7 +41,48 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
case 's': // Stop at program entry point
launch_info.GetFlags().Set(eLaunchFlagStopAtEntry);
break;
-
+ case 'm': // Stop at user entry point
+ {
+ TargetSP target_sp =
+ execution_context ? execution_context->GetTargetSP() : TargetSP();
+ ModuleSP main_module_sp = target_sp->GetExecutableModule();
+ FileSpecList shared_lib_filter;
+ shared_lib_filter.Append(main_module_sp->GetFileSpec());
+ llvm::SetVector<std::string, std::vector<std::string>,
+ std::unordered_set<std::string>>
+ entryPointNamesSet;
+ for (LanguageType lang_type : Language::GetSupportedLanguages()) {
+ Language *lang = Language::FindPlugin(lang_type);
+ if (!lang) {
+ error.SetErrorString("Language not found\n");
+ break;
+ }
+ std::string entryPointName = lang->GetUserEntryPointName().str();
+ if (!entryPointName.empty())
+ entryPointNamesSet.insert(entryPointName);
+ }
+ if (entryPointNamesSet.empty()) {
+ error.SetErrorString("No entry point name found\n");
+ break;
+ }
+ BreakpointSP bp_sp = target_sp->CreateBreakpoint(
+ &shared_lib_filter,
+ nullptr, // containingSourceFiles
+ entryPointNamesSet.takeVector(),
+ eFunctionNameTypeFull, // func_name_type_mask
+ eLanguageTypeUnknown, // language
+ 0, // offset
+ eLazyBoolNo, // skip_prologue
+ false, // internal
+ false // hardware
+ );
+ if (!bp_sp) {
+ error.SetErrorString("Breakpoint creation failed.\n");
+ break;
+ }
+ bp_sp->SetOneShot(true);
+ break;
+ }
case 'i': // STDIN for read only
{
FileAction action;
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 04830b8b990efae..dd4cf5c4dc043e7 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -675,6 +675,10 @@ let Command = "platform shell" in {
let Command = "process launch" in {
def process_launch_stop_at_entry : Option<"stop-at-entry", "s">,
Desc<"Stop at the entry point of the program when launching a process.">;
+ def process_launch_stop_at_user_entry : Option<"stop-at-user-entry", "m">,
+ Desc<"Stop at the user entry point when launching a process. For C based "
+ "languages this will be the 'main' function, but this might differ for "
+ "other languages.">;
def process_launch_disable_aslr : Option<"disable-aslr", "A">, Arg<"Boolean">,
Desc<"Set whether to disable address space layout randomization when launching a process.">;
def process_launch_plugin : Option<"plugin", "P">, Arg<"Plugin">,
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
index 7712a60b7795951..bde34e710a44d85 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -103,6 +103,8 @@ class CPlusPlusLanguage : public Language {
return lldb::eLanguageTypeC_plus_plus;
}
+ llvm::StringRef GetUserEntryPointName() const override { return "main"; }
+
std::unique_ptr<TypeScavenger> GetTypeScavenger() override;
lldb::TypeCategoryImplSP GetFormatters() override;
@@ -129,8 +131,8 @@ class CPlusPlusLanguage : public Language {
static llvm::StringRef GetPluginNameStatic() { return "cplusplus"; }
bool SymbolNameFitsToLanguage(Mangled mangled) const override;
-
- bool DemangledNameContainsPath(llvm::StringRef path,
+
+ bool DemangledNameContainsPath(llvm::StringRef path,
ConstString demangled) const override;
ConstString
diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
index bb8057846bb7c30..a50f4b036108d7a 100644
--- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -127,6 +127,8 @@ class ObjCLanguage : public Language {
return lldb::eLanguageTypeObjC;
}
+ llvm::StringRef GetUserEntryPointName() const override { return "main"; }
+
// Get all possible names for a method. Examples:
// If method_name is "+[NSString(my_additions) myStringWithCString:]"
// variant_names[0] => "+[NSString myStringWithCString:]"
diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
index b7c71b5dbb1c991..1beab9348eb72e8 100644
--- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
+++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
@@ -27,6 +27,8 @@ class ObjCPlusPlusLanguage : public Language {
return lldb::eLanguageTypeObjC_plus_plus;
}
+ llvm::StringRef GetUserEntryPointName() const override { return "main"; }
+
llvm::StringRef GetNilReferenceSummaryString() override { return "nil"; }
bool IsSourceFile(llvm::StringRef file_path) const override;
>From 0d11a28c461d6f6698204f86947395d915f383db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Junior?= <jljuniorpb at gmail.com>
Date: Sun, 1 Oct 2023 12:53:27 -0300
Subject: [PATCH 2/2] implement CreateBreakpointAtUserEntry in Target.[cpp/h]
---
lldb/include/lldb/Target/Target.h | 4 +-
.../Commands/CommandOptionsProcessLaunch.cpp | 37 +---
lldb/source/Target/Target.cpp | 164 +++++++++++-------
3 files changed, 105 insertions(+), 100 deletions(-)
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index e9e531d0e12640a..00c2f19752af60f 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -654,6 +654,8 @@ class Target : public std::enable_shared_from_this<Target>,
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id);
+ lldb::BreakpointSP CreateBreakpointAtUserEntry();
+
// Use this to create a file and line breakpoint to a given module or all
// module it is nullptr
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules,
@@ -1272,7 +1274,7 @@ class Target : public std::enable_shared_from_this<Target>,
StopHook(const StopHook &rhs);
virtual ~StopHook() = default;
- enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
+ enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased };
enum class StopHookResult : uint32_t {
KeepStopped = 0,
RequestContinue,
diff --git a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
index 2645b7bdd8c4ae6..3055e4ca45bd230 100644
--- a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
@@ -45,42 +45,7 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
{
TargetSP target_sp =
execution_context ? execution_context->GetTargetSP() : TargetSP();
- ModuleSP main_module_sp = target_sp->GetExecutableModule();
- FileSpecList shared_lib_filter;
- shared_lib_filter.Append(main_module_sp->GetFileSpec());
- llvm::SetVector<std::string, std::vector<std::string>,
- std::unordered_set<std::string>>
- entryPointNamesSet;
- for (LanguageType lang_type : Language::GetSupportedLanguages()) {
- Language *lang = Language::FindPlugin(lang_type);
- if (!lang) {
- error.SetErrorString("Language not found\n");
- break;
- }
- std::string entryPointName = lang->GetUserEntryPointName().str();
- if (!entryPointName.empty())
- entryPointNamesSet.insert(entryPointName);
- }
- if (entryPointNamesSet.empty()) {
- error.SetErrorString("No entry point name found\n");
- break;
- }
- BreakpointSP bp_sp = target_sp->CreateBreakpoint(
- &shared_lib_filter,
- nullptr, // containingSourceFiles
- entryPointNamesSet.takeVector(),
- eFunctionNameTypeFull, // func_name_type_mask
- eLanguageTypeUnknown, // language
- 0, // offset
- eLazyBoolNo, // skip_prologue
- false, // internal
- false // hardware
- );
- if (!bp_sp) {
- error.SetErrorString("Breakpoint creation failed.\n");
- break;
- }
- bp_sp->SetOneShot(true);
+ target_sp->CreateBreakpointAtUserEntry();
break;
}
case 'i': // STDIN for read only
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index f197b1b1aa097c3..e4f726a617db099 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -306,7 +306,7 @@ llvm::StringRef Target::GetABIName() const {
if (!abi_sp)
abi_sp = ABI::FindPlugin(ProcessSP(), GetArchitecture());
if (abi_sp)
- return abi_sp->GetPluginName();
+ return abi_sp->GetPluginName();
return {};
}
@@ -335,6 +335,48 @@ BreakpointSP Target::GetBreakpointByID(break_id_t break_id) {
return bp_sp;
}
+lldb::BreakpointSP lldb_private::Target::CreateBreakpointAtUserEntry() {
+ TargetSP target_sp = shared_from_this();
+ Status error;
+ ModuleSP main_module_sp = target_sp->GetExecutableModule();
+ FileSpecList shared_lib_filter;
+ shared_lib_filter.Append(main_module_sp->GetFileSpec());
+ llvm::SetVector<std::string, std::vector<std::string>,
+ std::unordered_set<std::string>>
+ entryPointNamesSet;
+ for (LanguageType lang_type : Language::GetSupportedLanguages()) {
+ Language *lang = Language::FindPlugin(lang_type);
+ if (!lang) {
+ error.SetErrorString("Language not found\n");
+ return lldb::BreakpointSP();
+ }
+ std::string entryPointName = lang->GetUserEntryPointName().str();
+ if (!entryPointName.empty())
+ entryPointNamesSet.insert(entryPointName);
+ }
+ if (entryPointNamesSet.empty()) {
+ error.SetErrorString("No entry point name found\n");
+ return lldb::BreakpointSP();
+ }
+ BreakpointSP bp_sp =
+ target_sp->CreateBreakpoint(&shared_lib_filter,
+ nullptr, // containingSourceFiles
+ entryPointNamesSet.takeVector(),
+ eFunctionNameTypeFull, // func_name_type_mask
+ eLanguageTypeUnknown, // language
+ 0, // offset
+ eLazyBoolNo, // skip_prologue
+ false, // internal
+ false // hardware
+ );
+ if (!bp_sp) {
+ error.SetErrorString("Breakpoint creation failed.\n");
+ return lldb::BreakpointSP();
+ }
+ bp_sp->SetOneShot(true);
+ return bp_sp;
+}
+
BreakpointSP Target::CreateSourceRegexBreakpoint(
const FileSpecList *containingModules,
const FileSpecList *source_file_spec_list,
@@ -782,7 +824,7 @@ void Target::ApplyNameToBreakpoints(BreakpointName &bp_name) {
void Target::GetBreakpointNames(std::vector<std::string> &names) {
names.clear();
- for (const auto& bp_name_entry : m_breakpoint_names) {
+ for (const auto &bp_name_entry : m_breakpoint_names) {
names.push_back(bp_name_entry.first.AsCString());
}
llvm::sort(names);
@@ -2041,9 +2083,9 @@ size_t Target::ReadStringFromMemory(const Address &addr, char *dst,
return total_bytes_read;
}
-size_t Target::ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_size,
- bool is_signed, Scalar &scalar,
- Status &error,
+size_t Target::ReadScalarIntegerFromMemory(const Address &addr,
+ uint32_t byte_size, bool is_signed,
+ Scalar &scalar, Status &error,
bool force_live_memory) {
uint64_t uval;
@@ -2072,7 +2114,8 @@ size_t Target::ReadScalarIntegerFromMemory(const Address &addr, uint32_t byte_si
uint64_t Target::ReadUnsignedIntegerFromMemory(const Address &addr,
size_t integer_byte_size,
- uint64_t fail_value, Status &error,
+ uint64_t fail_value,
+ Status &error,
bool force_live_memory) {
Scalar scalar;
if (ReadScalarIntegerFromMemory(addr, integer_byte_size, false, scalar, error,
@@ -2167,7 +2210,7 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
module_spec.GetFileSpec().GetDirectory(), transformed_dir)) {
transformed_spec.GetFileSpec().SetDirectory(transformed_dir);
transformed_spec.GetFileSpec().SetFilename(
- module_spec.GetFileSpec().GetFilename());
+ module_spec.GetFileSpec().GetFilename());
error = ModuleList::GetSharedModule(transformed_spec, module_sp,
&search_paths, &old_modules,
&did_create_module);
@@ -2426,9 +2469,8 @@ Target::GetScratchTypeSystems(bool create_on_demand) {
"Language '{1}' has expression support but no scratch type "
"system available: {0}",
Language::GetNameForLanguageType(language));
- else
- if (auto ts = *type_system_or_err)
- scratch_type_systems.push_back(ts);
+ else if (auto ts = *type_system_or_err)
+ scratch_type_systems.push_back(ts);
}
std::sort(scratch_type_systems.begin(), scratch_type_systems.end());
@@ -2582,11 +2624,10 @@ llvm::Error Target::SetLabel(llvm::StringRef label) {
for (size_t i = 0; i < targets.GetNumTargets(); i++) {
TargetSP target_sp = targets.GetTargetAtIndex(i);
if (target_sp && target_sp->GetLabel() == label) {
- return llvm::make_error<llvm::StringError>(
- llvm::formatv(
- "Cannot use label '{0}' since it's set in target #{1}.", label,
- i),
- llvm::inconvertibleErrorCode());
+ return llvm::make_error<llvm::StringError>(
+ llvm::formatv("Cannot use label '{0}' since it's set in target #{1}.",
+ label, i),
+ llvm::inconvertibleErrorCode());
}
}
@@ -2644,8 +2685,7 @@ ExpressionResults Target::EvaluateExpression(
// Only check for persistent variables the expression starts with a '$'
lldb::ExpressionVariableSP persistent_var_sp;
if (expr[0] == '$') {
- auto type_system_or_err =
- GetScratchTypeSystemForLanguage(eLanguageTypeC);
+ auto type_system_or_err = GetScratchTypeSystemForLanguage(eLanguageTypeC);
if (auto err = type_system_or_err.takeError()) {
LLDB_LOG_ERROR(GetLog(LLDBLog::Target), std::move(err),
"Unable to get scratch type system");
@@ -2871,7 +2911,8 @@ bool Target::RunStopHooks() {
// because breakpoint commands get run before stop hooks, and one of them
// might have run an expression. You have to ensure you run the stop hooks
// once per natural stop.
- uint32_t last_natural_stop = m_process_sp->GetModIDRef().GetLastNaturalStopID();
+ uint32_t last_natural_stop =
+ m_process_sp->GetModIDRef().GetLastNaturalStopID();
if (last_natural_stop != 0 && m_latest_stop_hook_id == last_natural_stop)
return false;
@@ -3011,8 +3052,7 @@ bool Target::RunStopHooks() {
TargetProperties &Target::GetGlobalProperties() {
// NOTE: intentional leak so we don't crash if global destructor chain gets
// called as other threads still use the result of this function
- static TargetProperties *g_settings_ptr =
- new TargetProperties(nullptr);
+ static TargetProperties *g_settings_ptr = new TargetProperties(nullptr);
return *g_settings_ptr;
}
@@ -3381,7 +3421,7 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
if (!attach_info.ProcessInfoSpecified()) {
if (old_exec_module_sp)
attach_info.GetExecutableFile().SetFilename(
- old_exec_module_sp->GetPlatformFileSpec().GetFilename());
+ old_exec_module_sp->GetPlatformFileSpec().GetFilename());
if (!attach_info.ProcessInfoSpecified()) {
return Status("no process specified, create a target with a file, or "
@@ -3526,28 +3566,28 @@ void Target::FinalizeFileActions(ProcessLaunchInfo &info) {
}
}
-void Target::AddDummySignal(llvm::StringRef name, LazyBool pass, LazyBool notify,
- LazyBool stop) {
- if (name.empty())
- return;
- // Don't add a signal if all the actions are trivial:
- if (pass == eLazyBoolCalculate && notify == eLazyBoolCalculate
- && stop == eLazyBoolCalculate)
- return;
+void Target::AddDummySignal(llvm::StringRef name, LazyBool pass,
+ LazyBool notify, LazyBool stop) {
+ if (name.empty())
+ return;
+ // Don't add a signal if all the actions are trivial:
+ if (pass == eLazyBoolCalculate && notify == eLazyBoolCalculate &&
+ stop == eLazyBoolCalculate)
+ return;
- auto& elem = m_dummy_signals[name];
- elem.pass = pass;
- elem.notify = notify;
- elem.stop = stop;
+ auto &elem = m_dummy_signals[name];
+ elem.pass = pass;
+ elem.notify = notify;
+ elem.stop = stop;
}
bool Target::UpdateSignalFromDummy(UnixSignalsSP signals_sp,
- const DummySignalElement &elem) {
+ const DummySignalElement &elem) {
if (!signals_sp)
return false;
- int32_t signo
- = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
+ int32_t signo =
+ signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
if (signo == LLDB_INVALID_SIGNAL_NUMBER)
return false;
@@ -3569,11 +3609,11 @@ bool Target::UpdateSignalFromDummy(UnixSignalsSP signals_sp,
}
bool Target::ResetSignalFromDummy(UnixSignalsSP signals_sp,
- const DummySignalElement &elem) {
+ const DummySignalElement &elem) {
if (!signals_sp)
return false;
- int32_t signo
- = signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
+ int32_t signo =
+ signals_sp->GetSignalNumberFromName(elem.first().str().c_str());
if (signo == LLDB_INVALID_SIGNAL_NUMBER)
return false;
bool do_pass = elem.second.pass != eLazyBoolCalculate;
@@ -3591,7 +3631,7 @@ void Target::UpdateSignalsFromDummy(UnixSignalsSP signals_sp,
for (const auto &elem : m_dummy_signals) {
if (!UpdateSignalFromDummy(signals_sp, elem))
warning_stream_sp->Printf("Target signal '%s' not found in process\n",
- elem.first().str().c_str());
+ elem.first().str().c_str());
}
}
@@ -3624,11 +3664,14 @@ void Target::PrintDummySignals(Stream &strm, Args &signal_args) {
strm.Printf("NAME PASS STOP NOTIFY\n");
strm.Printf("=========== ======= ======= =======\n");
- auto str_for_lazy = [] (LazyBool lazy) -> const char * {
+ auto str_for_lazy = [](LazyBool lazy) -> const char * {
switch (lazy) {
- case eLazyBoolCalculate: return "not set";
- case eLazyBoolYes: return "true ";
- case eLazyBoolNo: return "false ";
+ case eLazyBoolCalculate:
+ return "not set";
+ case eLazyBoolYes:
+ return "true ";
+ case eLazyBoolNo:
+ return "false ";
}
llvm_unreachable("Fully covered switch above!");
};
@@ -3748,7 +3791,8 @@ void Target::StopHookCommandLine::GetSubclassDescription(
}
// Target::StopHookCommandLine
-void Target::StopHookCommandLine::SetActionFromString(const std::string &string) {
+void Target::StopHookCommandLine::SetActionFromString(
+ const std::string &string) {
GetCommands().SplitIntoLines(string);
}
@@ -3948,20 +3992,14 @@ static constexpr OptionEnumValueElement g_import_std_module_value_types[] = {
"false",
"Never import the 'std' C++ module in the expression parser.",
},
- {
- eImportStdModuleFallback,
- "fallback",
- "Retry evaluating expressions with an imported 'std' C++ module if they"
- " failed to parse without the module. This allows evaluating more "
- "complex expressions involving C++ standard library types."
- },
- {
- eImportStdModuleTrue,
- "true",
- "Always import the 'std' C++ module. This allows evaluating more "
- "complex expressions involving C++ standard library types. This feature"
- " is experimental."
- },
+ {eImportStdModuleFallback, "fallback",
+ "Retry evaluating expressions with an imported 'std' C++ module if they"
+ " failed to parse without the module. This allows evaluating more "
+ "complex expressions involving C++ standard library types."},
+ {eImportStdModuleTrue, "true",
+ "Always import the 'std' C++ module. This allows evaluating more "
+ "complex expressions involving C++ standard library types. This feature"
+ " is experimental."},
};
static constexpr OptionEnumValueElement
@@ -4142,8 +4180,8 @@ TargetProperties::TargetProperties(Target *target)
m_collection_sp->SetValueChangedCallback(
ePropertyDisableSTDIO, [this] { DisableSTDIOValueChangedCallback(); });
- m_collection_sp->SetValueChangedCallback(
- ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
+ m_collection_sp->SetValueChangedCallback(ePropertySaveObjectsDir,
+ [this] { CheckJITObjectsDir(); });
m_experimental_properties_up =
std::make_unique<TargetExperimentalProperties>();
m_collection_sp->AppendProperty(
@@ -4164,8 +4202,8 @@ TargetProperties::TargetProperties(Target *target)
m_collection_sp->AppendProperty(
"process", "Settings specific to processes.", true,
Process::GetGlobalProperties().GetValueProperties());
- m_collection_sp->SetValueChangedCallback(
- ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); });
+ m_collection_sp->SetValueChangedCallback(ePropertySaveObjectsDir,
+ [this] { CheckJITObjectsDir(); });
}
}
More information about the lldb-commits
mailing list