Fix test in Diff 2 <http://reviews.llvm.org/differential/diff/19652/>
http://reviews.llvm.org/D7468
Files:
include/lldb/Core/Debugger.h
include/lldb/lldb-enumerations.h
source/Core/Debugger.cpp
source/Host/macosx/Host.mm
source/Target/Target.cpp
test/functionalities/tty/TestTerminal.py
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Core/Debugger.h
===================================================================
--- include/lldb/Core/Debugger.h
+++ include/lldb/Core/Debugger.h
@@ -293,6 +293,9 @@
bool
GetAutoConfirm () const;
+ bool
+ GetCloseAfterExit () const;
+
const FormatEntity::Entry *
GetDisassemblyFormat() const;
Index: include/lldb/lldb-enumerations.h
===================================================================
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -52,6 +52,7 @@
eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub should detach rather than killing the debugee
///< if it loses connection with lldb.
eLaunchFlagGlobArguments = (1u << 10), ///< Glob arguments without going through a shell
+ eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the opened TTY on exit
} LaunchFlags;
//----------------------------------------------------------------------
Index: source/Core/Debugger.cpp
===================================================================
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -132,6 +132,7 @@
g_properties[] =
{
{ "auto-confirm", OptionValue::eTypeBoolean , true, false, NULL, NULL, "If true all confirmation prompts will receive their default reply." },
+{ "close-after-exit", OptionValue::eTypeBoolean , true, false, NULL, NULL, "If true, LLDB will automatically close a terminal after exit (default: false)." },
{ "disassembly-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_DISASSEMBLY_FORMAT, NULL, "The default disassembly format string to use when disassembling instruction sequences." },
{ "frame-format", OptionValue::eTypeFormatEntity, true, 0 , DEFAULT_FRAME_FORMAT, NULL, "The default frame format string to use when displaying stack frame information for threads." },
{ "notify-void", OptionValue::eTypeBoolean , true, false, NULL, NULL, "Notify the user explicitly if an expression returns void (default: false)." },
@@ -153,6 +154,7 @@
enum
{
ePropertyAutoConfirm = 0,
+ ePropertyCloseAfterExit,
ePropertyDisassemblyFormat,
ePropertyFrameFormat,
ePropertyNotiftVoid,
@@ -242,6 +244,13 @@
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
+bool
+Debugger::GetCloseAfterExit () const
+{
+ const uint32_t idx = ePropertyCloseAfterExit;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+
const FormatEntity::Entry *
Debugger::GetDisassemblyFormat() const
{
Index: source/Host/macosx/Host.mm
===================================================================
--- source/Host/macosx/Host.mm
+++ source/Host/macosx/Host.mm
@@ -471,6 +471,10 @@
command.Printf(" '%s'", exe_path);
}
command.PutCString (" ; echo Process exited with status $?");
+ if (launch_info.GetFlags().Test(lldb::eLaunchFlagCloseTTYOnExit))
+ {
+ command.PutCString (" ; exit");
+ }
StreamString applescript_source;
Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2447,11 +2447,14 @@
}
launch_info.GetFlags().Set (eLaunchFlagDebug);
-
+
+ Debugger &debugger = GetDebugger();
+ if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY) && debugger.GetCloseAfterExit())
+ launch_info.GetFlags().Set(eLaunchFlagCloseTTYOnExit);
+
// Get the value of synchronous execution here. If you wait till after you have started to
// run, then you could have hit a breakpoint, whose command might switch the value, and
// then you'll pick up that incorrect value.
- Debugger &debugger = GetDebugger();
const bool synchronous_execution = debugger.GetCommandInterpreter().GetSynchronous ();
PlatformSP platform_sp (GetPlatform());
Index: test/functionalities/tty/TestTerminal.py
===================================================================
--- test/functionalities/tty/TestTerminal.py
+++ test/functionalities/tty/TestTerminal.py
@@ -29,6 +29,7 @@
def test_launch_in_terminal (self):
exe = "/bin/ls"
target = self.dbg.CreateTarget(exe)
+ self.dbg.HandleCommand("settings set close-after-exit true")
launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"])
launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY)
error = lldb.SBError()
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits