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>

llvm-svn: 200875
This commit is contained in:
Greg Clayton 2014-02-05 21:03:22 +00:00
parent 67a28136ad
commit e4e462c42c
2 changed files with 14 additions and 10 deletions

View File

@ -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.

View File

@ -2582,7 +2582,7 @@ CommandInterpreter::HandleCommandsFromFile (FileSpec &cmd_file,
{
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::HandleCommandsFromFile (FileSpec &cmd_file,
{
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(),