aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp24
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp7
2 files changed, 25 insertions, 6 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 7a35473..d153e2a 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -98,8 +98,8 @@ SBCommandInterpreter::SBCommandInterpreter(const SBCommandInterpreter &rhs)
SBCommandInterpreter::~SBCommandInterpreter() = default;
-const SBCommandInterpreter &SBCommandInterpreter::
-operator=(const SBCommandInterpreter &rhs) {
+const SBCommandInterpreter &
+SBCommandInterpreter::operator=(const SBCommandInterpreter &rhs) {
LLDB_INSTRUMENT_VA(this, rhs);
m_opaque_ptr = rhs.m_opaque_ptr;
@@ -151,7 +151,7 @@ bool SBCommandInterpreter::WasInterrupted() const {
bool SBCommandInterpreter::InterruptCommand() {
LLDB_INSTRUMENT_VA(this);
-
+
return (IsValid() ? m_opaque_ptr->InterruptCommand() : false);
}
@@ -222,8 +222,7 @@ void SBCommandInterpreter::HandleCommandsFromFile(
if (override_context.get())
m_opaque_ptr->HandleCommandsFromFile(tmp_spec,
override_context.get()->Lock(true),
- options.ref(),
- result.ref());
+ options.ref(), result.ref());
else
m_opaque_ptr->HandleCommandsFromFile(tmp_spec, options.ref(), result.ref());
@@ -649,7 +648,8 @@ SBCommand::operator bool() const {
const char *SBCommand::GetName() {
LLDB_INSTRUMENT_VA(this);
- return (IsValid() ? ConstString(m_opaque_sp->GetCommandName()).AsCString() : nullptr);
+ return (IsValid() ? ConstString(m_opaque_sp->GetCommandName()).AsCString()
+ : nullptr);
}
const char *SBCommand::GetHelp() {
@@ -743,3 +743,15 @@ void SBCommand::SetFlags(uint32_t flags) {
if (IsValid())
m_opaque_sp->GetFlags().Set(flags);
}
+
+void SBCommandInterpreter::SetPrintCallback(
+ lldb::SBCommandPrintCallback callback, void *baton) {
+ LLDB_INSTRUMENT_VA(this, callback, baton);
+
+ if (m_opaque_ptr)
+ m_opaque_ptr->SetPrintCallback(
+ [callback, baton](lldb_private::CommandReturnObject &result) {
+ SBCommandReturnObject sb_result(result);
+ return callback(sb_result, baton);
+ });
+}
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index 9df8aa4..6f54581 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -84,6 +84,13 @@ SBCommandReturnObject::operator bool() const {
return true;
}
+const char *SBCommandReturnObject::GetCommand() {
+ LLDB_INSTRUMENT_VA(this);
+
+ ConstString output(ref().GetCommand());
+ return output.AsCString(/*value_if_empty*/ "");
+}
+
const char *SBCommandReturnObject::GetOutput() {
LLDB_INSTRUMENT_VA(this);