aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp13
-rw-r--r--lldb/source/Commands/CommandObjectDWIMPrint.cpp47
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp2
5 files changed, 41 insertions, 28 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 3e22309..b2fc893 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -571,7 +571,7 @@ void CommandCompletions::ModuleUUIDs(CommandInterpreter &interpreter,
lldb::eDescriptionLevelInitial);
request.TryCompleteCurrentArg(module->GetUUID().GetAsString(),
strm.GetString());
- return true;
+ return IterationAction::Continue;
});
}
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 10dc273..3049eb8 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -25,6 +25,7 @@
#include "lldb/Utility/Args.h"
#include "lldb/Utility/StringList.h"
#include "llvm/ADT/StringRef.h"
+#include <memory>
#include <optional>
using namespace lldb;
@@ -467,7 +468,7 @@ protected:
// Verify & handle any options/arguments passed to the alias command
OptionArgVectorSP option_arg_vector_sp =
- OptionArgVectorSP(new OptionArgVector);
+ std::make_shared<OptionArgVector>();
const bool include_aliases = true;
// Look up the command using command's name first. This is to resolve
@@ -543,7 +544,7 @@ protected:
CommandObject *cmd_obj = command_obj_sp.get();
CommandObject *sub_cmd_obj = nullptr;
OptionArgVectorSP option_arg_vector_sp =
- OptionArgVectorSP(new OptionArgVector);
+ std::make_shared<OptionArgVector>();
while (cmd_obj->IsMultiwordObject() && !args.empty()) {
auto sub_command = args[0].ref();
@@ -2504,9 +2505,9 @@ protected:
CommandObjectSP new_cmd_sp;
if (m_options.m_class_name.empty()) {
- new_cmd_sp.reset(new CommandObjectPythonFunction(
+ new_cmd_sp = std::make_shared<CommandObjectPythonFunction>(
m_interpreter, m_cmd_name, m_options.m_funct_name,
- m_options.m_short_help, m_synchronicity, m_completion_type));
+ m_options.m_short_help, m_synchronicity, m_completion_type);
} else {
ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
if (!interpreter) {
@@ -2528,9 +2529,9 @@ protected:
if (!result.Succeeded())
return;
} else
- new_cmd_sp.reset(new CommandObjectScriptingObjectRaw(
+ new_cmd_sp = std::make_shared<CommandObjectScriptingObjectRaw>(
m_interpreter, m_cmd_name, cmd_obj_sp, m_synchronicity,
- m_completion_type));
+ m_completion_type);
}
// Assume we're going to succeed...
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index a2c004d..d7589cc 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -18,11 +18,14 @@
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
#include "lldb/ValueObject/ValueObject.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-forward.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
#include <regex>
@@ -132,27 +135,22 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
};
// Dump `valobj` according to whether `po` was requested or not.
- auto dump_val_object = [&](ValueObject &valobj) {
+ auto dump_val_object = [&](ValueObject &valobj) -> Error {
if (is_po) {
StreamString temp_result_stream;
- if (llvm::Error error = valobj.Dump(temp_result_stream, dump_options)) {
- result.AppendError(toString(std::move(error)));
- return;
- }
+ if (Error err = valobj.Dump(temp_result_stream, dump_options))
+ return err;
llvm::StringRef output = temp_result_stream.GetString();
maybe_add_hint(output);
result.GetOutputStream() << output;
} else {
- llvm::Error error =
- valobj.Dump(result.GetOutputStream(), dump_options);
- if (error) {
- result.AppendError(toString(std::move(error)));
- return;
- }
+ if (Error err = valobj.Dump(result.GetOutputStream(), dump_options))
+ return err;
}
m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
m_cmd_name);
result.SetStatus(eReturnStatusSuccessFinishResult);
+ return Error::success();
};
// First, try `expr` as a _limited_ frame variable expression path: only the
@@ -186,8 +184,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
expr);
}
- dump_val_object(*valobj_sp);
- return;
+ Error err = dump_val_object(*valobj_sp);
+ if (!err)
+ return;
+
+ // Dump failed, continue on to expression evaluation.
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), std::move(err),
+ "could not print frame variable '{1}': {0}", expr);
}
}
@@ -196,8 +199,14 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
if (auto *state = target.GetPersistentExpressionStateForLanguage(language))
if (auto var_sp = state->GetVariable(expr))
if (auto valobj_sp = var_sp->GetValueObject()) {
- dump_val_object(*valobj_sp);
- return;
+ Error err = dump_val_object(*valobj_sp);
+ if (!err)
+ return;
+
+ // Dump failed, continue on to expression evaluation.
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Expressions), std::move(err),
+ "could not print persistent variable '{1}': {0}",
+ expr);
}
// Third, and lastly, try `expr` as a source expression to evaluate.
@@ -248,10 +257,12 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
result.AppendNoteWithFormatv("ran `expression {0}{1}`", flags, expr);
}
- if (valobj_sp->GetError().GetError() != UserExpression::kNoResult)
- dump_val_object(*valobj_sp);
- else
+ if (valobj_sp->GetError().GetError() != UserExpression::kNoResult) {
+ if (Error err = dump_val_object(*valobj_sp))
+ result.SetError(std::move(err));
+ } else {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ }
if (suppress_result)
if (auto result_var_sp =
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 7e42ef2..5692699 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -901,10 +901,9 @@ void CommandObjectFrameRecognizerAdd::DoExecute(Args &command,
StackFrameRecognizerSP(new ScriptedStackFrameRecognizer(
interpreter, m_options.m_class_name.c_str()));
if (m_options.m_regex) {
- auto module =
- RegularExpressionSP(new RegularExpression(m_options.m_module));
+ auto module = std::make_shared<RegularExpression>(m_options.m_module);
auto func =
- RegularExpressionSP(new RegularExpression(m_options.m_symbols.front()));
+ std::make_shared<RegularExpression>(m_options.m_symbols.front());
GetTarget().GetFrameRecognizerManager().AddRecognizer(
recognizer_sp, module, func, Mangled::NamePreference::ePreferDemangled,
m_options.m_first_instruction_only);
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 5792c13..af1ff3e 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -156,6 +156,7 @@ public:
case eFormatBinary:
case eFormatFloat:
+ case eFormatFloat128:
case eFormatOctal:
case eFormatDecimal:
case eFormatEnum:
@@ -1356,6 +1357,7 @@ protected:
switch (m_format_options.GetFormat()) {
case kNumFormats:
case eFormatFloat: // TODO: add support for floats soon
+ case eFormatFloat128:
case eFormatCharPrintable:
case eFormatBytesWithASCII:
case eFormatComplex: