From d82ac9e76913b0c02b3f736b1caa680f38a421fd Mon Sep 17 00:00:00 2001 From: Daniel Malea Date: Thu, 21 Feb 2013 21:18:07 +0000 Subject: [PATCH] Fix CommandObjectMultiword to initialize all members, and beef up corresponding test case. llvm-svn: 175798 --- lldb/source/Commands/CommandObjectMultiword.cpp | 3 ++- lldb/test/functionalities/command_script/TestCommandScript.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index aa3a8eb..c87a9d7 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -34,7 +34,8 @@ CommandObjectMultiword::CommandObjectMultiword const char *syntax, uint32_t flags ) : - CommandObject (interpreter, name, help, syntax, flags) + CommandObject (interpreter, name, help, syntax, flags), + m_can_be_removed(false) { } diff --git a/lldb/test/functionalities/command_script/TestCommandScript.py b/lldb/test/functionalities/command_script/TestCommandScript.py index 808f46b..bbc9e78 100644 --- a/lldb/test/functionalities/command_script/TestCommandScript.py +++ b/lldb/test/functionalities/command_script/TestCommandScript.py @@ -111,9 +111,20 @@ class CmdPythonTestCase(TestBase): self.expect("tell_curr", substrs = ['I am running sync']) + # Test that a python command can redefine itself + self.expect('command script add -f foobar welcome') self.runCmd("command script clear") + # Test that re-defining an existing command works + self.runCmd('command script add my_command --function welcome.welcome_impl') + self.expect('my_command Blah', substrs = ['Hello Blah, welcome to LLDB']) + + self.runCmd('command script add my_command --function welcome.target_name_impl') + self.expect('my_command', substrs = ['a.out']) + + self.runCmd("command script clear") + self.expect('command script list', matching=False, substrs = ['targetname', 'longwait']) -- 2.7.4