summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2019-10-03 22:18:51 +0000
committerJim Ingham <jingham@apple.com>2019-10-03 22:18:51 +0000
commit943a24812df0bc1993baec7db3a5d3b170118514 (patch)
tree5e89c41befa7c9e113d2db1c32f3afe27c63d09d /lldb/packages/Python/lldbsuite
parenta92b5309e5c715eac2db48b74398606521cb47a2 (diff)
downloadbcm5719-llvm-943a24812df0bc1993baec7db3a5d3b170118514.tar.gz
bcm5719-llvm-943a24812df0bc1993baec7db3a5d3b170118514.zip
Break out the Python class & key/value options into a separate OptionGroup.
Use this in the scripted breakpoint command. Added some tests for parsing the key/value options. This uncovered a bug in handling parsing errors mid-line. I also fixed that bug. Differential Revision: https://reviews.llvm.org/D68363 llvm-svn: 373673
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py18
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py3
2 files changed, 21 insertions, 0 deletions
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 59abad6110e..4842bc09455 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
@@ -38,6 +38,12 @@ class TestScriptedResolver(TestBase):
self.build()
self.do_test_cli()
+ def test_bad_command_lines(self):
+ """Make sure we get appropriate errors when we give invalid key/value
+ options"""
+ self.build()
+ self.do_test_bad_options()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -195,3 +201,15 @@ class TestScriptedResolver(TestBase):
target = self.make_target_and_import()
lldbutil.run_break_set_by_script(self, "resolver.Resolver", extra_options="-k symbol -v break_on_me")
+
+ def do_test_bad_options(self):
+ target = self.make_target_and_import()
+
+ self.expect("break set -P resolver.Resolver -k a_key", error = True, msg="Missing value at end",
+ substrs=['Key: "a_key" missing value'])
+ self.expect("break set -P resolver.Resolver -v a_value", error = True, msg="Missing key at end",
+ substrs=['Value: "a_value" missing matching key'])
+ self.expect("break set -P resolver.Resolver -v a_value -k a_key -v another_value", error = True, msg="Missing key among args",
+ substrs=['Value: "a_value" missing matching key'])
+ self.expect("break set -P resolver.Resolver -k a_key -k a_key -v another_value", error = True, msg="Missing value among args",
+ substrs=['Key: "a_key" missing value'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py
index 61f5f2df20a..f3af7c09f97 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py
@@ -7,6 +7,7 @@ class Resolver:
def __init__(self, bkpt, extra_args, dict):
self.bkpt = bkpt
self.extra_args = extra_args
+
Resolver.func_list = []
Resolver.got_files = 0
@@ -15,6 +16,8 @@ class Resolver:
sym_item = self.extra_args.GetValueForKey("symbol")
if sym_item.IsValid():
sym_name = sym_item.GetStringValue(1000)
+ else:
+ print("Didn't have a value for key 'symbol'")
if sym_ctx.compile_unit.IsValid():
Resolver.got_files = 1
OpenPOWER on IntegriCloud