Author: Jim Ingham Date: 2019-12-04T17:40:57-08:00 New Revision: 3151d7af72bee375c06318195870942d4bc12002
URL: https://github.com/llvm/llvm-project/commit/3151d7af72bee375c06318195870942d4bc12002 DIFF: https://github.com/llvm/llvm-project/commit/3151d7af72bee375c06318195870942d4bc12002.diff LOG: Clear out the python class name in OptionParsingStarted for the OptionGroupPythonClassWithDict options class. This value was hanging around so for instance if you made a scripted breakpoint resolver, then went to set another breakpoint, it would still think you had passed in a class name and the breakpoint wouldn't do what you expected. Added: Modified: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py index 4842bc094551..817d7de6bb96 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py @@ -33,8 +33,7 @@ def test_search_depths(self): @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") def test_command_line(self): - """ Make sure we are called at the right depths depending on what we return - from __get_depth__""" + """ Test setting a resolver breakpoint from the command line """ self.build() self.do_test_cli() @@ -202,6 +201,23 @@ def do_test_cli(self): lldbutil.run_break_set_by_script(self, "resolver.Resolver", extra_options="-k symbol -v break_on_me") + # Make sure setting a resolver breakpoint doesn't pollute further breakpoint setting + # by checking the description of a regular file & line breakpoint to make sure it + # doesn't mention the Python Resolver function: + bkpt_no = lldbutil.run_break_set_by_file_and_line(self, "main.c", 12) + bkpt = target.FindBreakpointByID(bkpt_no) + strm = lldb.SBStream() + bkpt.GetDescription(strm, False) + used_resolver = "I am a python breakpoint resolver" in strm.GetData() + self.assertFalse(used_resolver, "Found the resolver description in the file & line breakpoint description.") + + # Also make sure the breakpoint was where we expected: + bp_loc = bkpt.GetLocationAtIndex(0) + bp_sc = bp_loc.GetAddress().GetSymbolContext(lldb.eSymbolContextEverything) + bp_se = bp_sc.GetLineEntry() + self.assertEqual(bp_se.GetLine(), 12, "Got the right line number") + self.assertEqual(bp_se.GetFileSpec().GetFilename(), "main.c", "Got the right filename") + def do_test_bad_options(self): target = self.make_target_and_import() diff --git a/lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp b/lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp index 20a7ed1f76ca..e41f9d7b40ee 100644 --- a/lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp +++ b/lldb/source/Interpreter/OptionGroupPythonClassWithDict.cpp @@ -127,6 +127,7 @@ void OptionGroupPythonClassWithDict::OptionParsingStarting( // the user didn't pass any -k -v pairs. We want to be able to warn if these // were passed when the function they passed won't use them. m_dict_sp.reset(); + m_name.clear(); } Status OptionGroupPythonClassWithDict::OptionParsingFinished( _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits