[Lldb-commits] [lldb] r200875 - Fixed output to display correctly for "command source" by fixing the correct flags being set.

Greg Clayton gclayton at apple.com
Wed Feb 5 13:03:22 PST 2014


Author: gclayton
Date: Wed Feb  5 15:03:22 2014
New Revision: 200875

URL: http://llvm.org/viewvc/llvm-project?rev=200875&view=rev
Log:
Fixed output to display correctly for "command source" by fixing the correct flags being set.

Also emit the "Executing commands" message so it properly only comes out when desired and so it comes out in the right place.

<rdar://problem/15992208>


Modified:
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=200875&r1=200874&r2=200875&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Feb  5 15:03:22 2014
@@ -378,8 +378,6 @@ protected:
         {
             const char *filename = command.GetArgumentAtIndex(0);
 
-            result.AppendMessageWithFormat ("Executing commands in '%s'.\n", filename);
-
             FileSpec cmd_file (filename, true);
             ExecutionContext *exe_ctx = NULL;  // Just use the default context.
             

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=200875&r1=200874&r2=200875&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Feb  5 15:03:22 2014
@@ -2582,7 +2582,7 @@ CommandInterpreter::HandleCommandsFromFi
             {
                 if (m_command_source_flags.empty())
                 {
-                    // Echo command by default
+                    // Stop on continue by default
                     flags |= eHandleCommandFlagStopOnContinue;
                 }
                 else if (m_command_source_flags.back() & eHandleCommandFlagStopOnContinue)
@@ -2633,26 +2633,32 @@ CommandInterpreter::HandleCommandsFromFi
             {
                 if (m_command_source_flags.empty())
                 {
-                    // Echo command by default
-                    flags |= eHandleCommandFlagEchoCommand;
+                    // Print output by default
+                    flags |= eHandleCommandFlagPrintResult;
                 }
-                else if (m_command_source_flags.back() & eHandleCommandFlagEchoCommand)
+                else if (m_command_source_flags.back() & eHandleCommandFlagPrintResult)
                 {
-                    flags |= eHandleCommandFlagEchoCommand;
+                    flags |= eHandleCommandFlagPrintResult;
                 }
             }
             else if (print_result == eLazyBoolYes)
             {
-                flags |= eHandleCommandFlagEchoCommand;
+                flags |= eHandleCommandFlagPrintResult;
+            }
+
+            if (flags & eHandleCommandFlagPrintResult)
+            {
+                m_debugger.GetOutputFile()->Printf("Executing commands in '%s'.\n", cmd_file_path.c_str());
             }
 
             // Used for inheriting the right settings when "command source" might have
             // nested "command source" commands
+            lldb::StreamFileSP empty_stream_sp;
             m_command_source_flags.push_back(flags);
             IOHandlerSP io_handler_sp (new IOHandlerEditline (debugger,
                                                               input_file_sp,
-                                                              debugger.GetOutputFile(),
-                                                              debugger.GetErrorFile(),
+                                                              empty_stream_sp, // Pass in an empty stream so we inherit the top input reader output stream
+                                                              empty_stream_sp, // Pass in an empty stream so we inherit the top input reader error stream
                                                               flags,
                                                               NULL, // Pass in NULL for "editline_name" so no history is saved, or written
                                                               m_debugger.GetPrompt(),





More information about the lldb-commits mailing list