[Lldb-commits] [lldb] r233034 - Turn off 'quit' confirmation in lldb-mi

Ilia K ki.stfu at gmail.com
Mon Mar 23 15:45:13 PDT 2015


Author: ki.stfu
Date: Mon Mar 23 17:45:13 2015
New Revision: 233034

URL: http://llvm.org/viewvc/llvm-project?rev=233034&view=rev
Log:
Turn off 'quit' confirmation in lldb-mi

Summary:
# Turn off interpreter.prompt-on-quit on startup (MI)
# Add CommandInterpreter::SetPromptOnQuit
# Add SBCommandInterpreter::GetPromptOnQuit/SetPromptOnQuit

All tests pass on OS X.

Test Plan:
```
-file-exec-and-symbols ~/p/hello
-break-insert -f main
-exec-run
-interpreter-exec console quit
```

Reviewers: abidh, clayborg

Reviewed By: abidh, clayborg

Subscribers: lldb-commits, clayborg, abidh

Differential Revision: http://reviews.llvm.org/D8444

Modified:
    lldb/trunk/include/lldb/API/SBCommandInterpreter.h
    lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
    lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
    lldb/trunk/source/API/SBCommandInterpreter.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp

Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Mon Mar 23 17:45:13 2015
@@ -219,6 +219,12 @@ public:
     const char *
     GetIOHandlerControlSequence(char ch);
 
+    bool
+    GetPromptOnQuit();
+
+    void
+    SetPromptOnQuit(bool b);
+
 protected:
 
     lldb_private::CommandInterpreter &

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Mon Mar 23 17:45:13 2015
@@ -625,6 +625,9 @@ public:
     bool
     GetPromptOnQuit () const;
 
+    void
+    SetPromptOnQuit (bool b);
+
     bool
     GetStopCmdSourceOnError () const;
 

Modified: lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i (original)
+++ lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i Mon Mar 23 17:45:13 2015
@@ -150,6 +150,12 @@ public:
     GetIOHandlerControlSequence(char ch);
 
     bool
+    GetPromptOnQuit();
+
+    void
+    SetPromptOnQuit(bool b);
+
+    bool
     CommandExists (const char *cmd);
 
     bool

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Mar 23 17:45:13 2015
@@ -447,6 +447,21 @@ SBCommandInterpreter::GetDebugger ()
     return sb_debugger;
 }
 
+bool
+SBCommandInterpreter::GetPromptOnQuit()
+{
+    if (m_opaque_ptr)
+        return m_opaque_ptr->GetPromptOnQuit();
+    return false;
+}
+
+void
+SBCommandInterpreter::SetPromptOnQuit (bool b)
+{
+    if (m_opaque_ptr)
+        m_opaque_ptr->SetPromptOnQuit(b);
+}
+
 CommandInterpreter *
 SBCommandInterpreter::get ()
 {
@@ -850,4 +865,3 @@ SBCommand::AddCommand (const char* name,
         return lldb::SBCommand(new_command_sp);
     return lldb::SBCommand();
 }
-

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Mar 23 17:45:13 2015
@@ -149,6 +149,13 @@ CommandInterpreter::GetPromptOnQuit () c
     return m_collection_sp->GetPropertyAtIndexAsBoolean (nullptr, idx, g_properties[idx].default_uint_value != 0);
 }
 
+void
+CommandInterpreter::SetPromptOnQuit (bool b)
+{
+    const uint32_t idx = ePropertyPromptOnQuit;
+    m_collection_sp->SetPropertyAtIndexAsBoolean (nullptr, idx, b);
+}
+
 bool
 CommandInterpreter::GetStopCmdSourceOnError () const
 {

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=233034&r1=233033&r2=233034&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Mon Mar 23 17:45:13 2015
@@ -233,11 +233,15 @@ bool
 CMICmnLLDBDebugger::InitSBDebugger(void)
 {
     m_lldbDebugger = lldb::SBDebugger::Create(false);
-    if (m_lldbDebugger.IsValid())
-        return MIstatus::success;
+    if (!m_lldbDebugger.IsValid())
+    {
+        SetErrorDescription(MIRSRC(IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER));
+        return MIstatus::failure;
+    }
 
-    SetErrorDescription(MIRSRC(IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER));
-    return MIstatus::failure;
+    m_lldbDebugger.GetCommandInterpreter().SetPromptOnQuit(false);
+
+    return MIstatus::success;
 }
 
 //++ ------------------------------------------------------------------------------------





More information about the lldb-commits mailing list