From 65045f216817dba87f45fa105bf76ae05b21c02e Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 8 Oct 2010 17:21:27 +0000 Subject: [PATCH] o TestStdCXXDisassembly.py: Update the expected match string. o lldbtest.py: Indicate when a command fails, even if there is nothing in the error stream. o TestHelp.py: Add a regression test case for 'help image dump symtab'. o CommandObjectHelp.cpp: Some of the logic branches with successful help command results were not tagged with a Success Status. They are fixed now. This is important for Python interaction. llvm-svn: 116062 --- lldb/source/Commands/CommandObjectHelp.cpp | 4 ++++ lldb/test/help/TestHelp.py | 8 +++++++- lldb/test/lldbtest.py | 1 + lldb/test/stl/TestStdCXXDisassembly.py | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp index ff6663986385..c7aa2b4f1a7f 100644 --- a/lldb/source/Commands/CommandObjectHelp.cpp +++ b/lldb/source/Commands/CommandObjectHelp.cpp @@ -121,6 +121,8 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) if ((long_help != NULL) && (strlen (long_help) > 0)) output_strm.Printf ("\n%s", long_help); + // Mark this help command with a success status. + result.SetStatus (eReturnStatusSuccessFinishNoResult); } else if (sub_cmd_obj->IsMultiwordObject()) { @@ -149,6 +151,8 @@ CommandObjectHelp::Execute (Args& command, CommandReturnObject &result) else m_interpreter.OutputFormattedHelpText (output_strm, "", "", sub_cmd_obj->GetHelp(), 1); output_strm.Printf ("\nSyntax: %s\n", sub_cmd_obj->GetSyntax()); + // Mark this help command with a success status. + result.SetStatus (eReturnStatusSuccessFinishNoResult); } } } diff --git a/lldb/test/help/TestHelp.py b/lldb/test/help/TestHelp.py index 49d857aa6602..84b1eb0d3027 100644 --- a/lldb/test/help/TestHelp.py +++ b/lldb/test/help/TestHelp.py @@ -1,5 +1,5 @@ """ -Test lldb help command. +Test some lldb help commands. See also CommandInterpreter::OutputFormattedHelpText(). """ @@ -24,6 +24,12 @@ class HelpCommandTestCase(TestBase): self.expect("help", startstr = 'The following is a list of built-in, permanent debugger commands') + def test_help_image_dump_symtab_should_not_crash(self): + """Command 'help image dump symtab' should not crash lldb.""" + self.expect("help image dump symtab", + substrs = ['image dump symtab', + 'sort-order']) + if __name__ == '__main__': import atexit diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 3876cae36664..2d02d11b1d7d 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -392,6 +392,7 @@ class TestBase(unittest2.TestCase): if self.res.Succeeded(): print >> sys.stderr, "output:", self.res.GetOutput() else: + print >> sys.stderr, "runCmd failed!" print >> sys.stderr, self.res.GetError() if running: diff --git a/lldb/test/stl/TestStdCXXDisassembly.py b/lldb/test/stl/TestStdCXXDisassembly.py index 93849607e722..e47c3c97b086 100644 --- a/lldb/test/stl/TestStdCXXDisassembly.py +++ b/lldb/test/stl/TestStdCXXDisassembly.py @@ -33,7 +33,7 @@ class StdCXXDisassembleTestCase(TestBase): # The process should be in a 'Stopped' state. self.expect(repr(process), STOPPED_DUE_TO_BREAKPOINT, exe=False, substrs = ["a.out", - "state: Stopped"]) + "Stopped"]) # Disassemble the functions on the call stack. self.runCmd("thread backtrace")