"""Make sure we get appropriate errors when we give invalid key/value
options"""
self.build()
- self.do_test_bad_options()
+ self.do_test_bad_options()
def make_target_and_import(self):
target = lldbutil.run_to_breakpoint_make_target(self)
module_list.Clear()
file_list.Append(lldb.SBFileSpec("noFileOfThisName.xxx"))
wrong.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list))
-
+
# Now make sure the CU level iteration obeys the file filters:
file_list.Clear()
module_list.Clear()
# Now run to main and ensure we hit the breakpoints we should have:
lldbutil.run_to_breakpoint_do_run(self, target, right[0])
-
+
# Test the hit counts:
for i in range(0, len(right)):
self.assertEqual(right[i].GetHitCount(), 1, "Breakpoint %d has the wrong hit count"%(i))
bkpt = target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)
self.assertTrue(bkpt.GetNumLocations() > 0, "Resolver got no locations.")
self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules")
-
+
# Make a breakpoint that asks for modules, check that we didn't get any files:
bkpt = target.BreakpointCreateFromScript("resolver.ResolverModuleDepth", extra_args, module_list, file_list)
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverModuleDepth got no locations.")
self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules")
-
+
# Make a breakpoint that asks for compile units, check that we didn't get any files:
bkpt = target.BreakpointCreateFromScript("resolver.ResolverCUDepth", extra_args, module_list, file_list)
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverCUDepth got no locations.")
bkpt = target.BreakpointCreateFromScript("resolver.ResolverFuncDepth", extra_args, module_list, file_list)
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverFuncDepth got no locations.")
self.expect("script print(resolver.Resolver.got_files)", substrs=["3"], msg="Was only passed modules")
- self.expect("script print(resolver.Resolver.func_list)", substrs=["break_on_me", "main", "test_func"], msg="Saw all the functions")
+ self.expect("script print(resolver.Resolver.func_list)", substrs=['test_func', 'break_on_me', 'main'], msg="Saw all the functions")
def do_test_cli(self):
target = self.make_target_and_import()
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()
- self.expect("break set -P resolver.Resolver -k a_key", error = True, msg="Missing value at end",
+ 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",
+ 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",
+ 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",
+ 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'])
'frame variable',
substrs=[
'(vFloat) valueFL = (1.25, 0, 0.25, 0)',
+ '(vDouble) valueDL = (1.25, 2.25)',
'(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
'(int32_t [4]) valueI32 = (1, 0, 4, 0)',
- '(vDouble) valueDL = (1.25, 2.25)',
'(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
'(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
'(vUInt32) valueU32 = (1, 2, 3, 4)',
- "(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)",
+ '(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)',
'(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)',
'(vSInt32) valueS32 = (4, 3, 2, 1)',
- '(vBool32) valueBool32 = (0, 1, 0, 1)'])
+ '(vBool32) valueBool32 = (0, 1, 0, 1)',
+ ])
fake_a_val = 0x00000100
# check that we get the two real vars and the fake_a variables
- self.expect("frame variable f00_1",
- substrs=['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 1'])
+ self.expect(
+ "frame variable f00_1",
+ substrs=[
+ 'a = 1',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 34',
+ ])
# check that we do not get the extra vars
self.expect("frame variable f00_1", matching=False,
else:
fake_a_val = 0x00000200
- self.expect("frame variable f00_1",
- substrs=['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 2'])
+ self.expect(
+ "frame variable f00_1",
+ substrs=[
+ 'a = 2',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 34',
+ ])
# check that altering the object also alters fake_a
self.runCmd("expr f00_1.a = 280")
else:
fake_a_val = 0x00011800
- self.expect("frame variable f00_1",
- substrs=['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 280'])
+ self.expect(
+ "frame variable f00_1",
+ substrs=[
+ 'a = 280',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 34',
+ ])
# check that expanding a pointer does the right thing
if process.GetByteOrder() == lldb.eByteOrderLittle:
else:
fake_a_val = 0x00000c00
- self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
- self.expect("frame variable --ptr-depth 1 wrapper",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
+ self.expect(
+ "frame variable --ptr-depth 1 f00_ptr",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
+ self.expect(
+ "frame variable --ptr-depth 1 wrapper",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
# now add a filter.. it should fail
self.expect("type filter add foo --child b --child j", error=True,
self.expect('frame variable f00_1', matching=False,
substrs=['b = 1',
'j = 17'])
- self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
- self.expect("frame variable --ptr-depth 1 wrapper",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
+ self.expect(
+ "frame variable --ptr-depth 1 f00_ptr",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
+ self.expect(
+ "frame variable --ptr-depth 1 wrapper",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
# Test that the custom dereference operator for `wrapfoo` works through
# the Python API. The synthetic children provider gets queried at
self.expect('frame variable f00_1', matching=False,
substrs=['b = 2',
'j = 18'])
- self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
- self.expect("frame variable --ptr-depth 1 wrapper",
- substrs=['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
+ self.expect(
+ "frame variable --ptr-depth 1 f00_ptr",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
+ self.expect(
+ "frame variable --ptr-depth 1 wrapper",
+ substrs=[
+ 'a = 12',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 45',
+ ])
# check the listing
self.expect('type synth list',
substrs=[
'4 elements',
'[0]',
+ 'hello',
'[1]',
+ '(int)2',
'[2]',
+ '(int)1',
'[3]',
- 'hello',
'world',
- '(int)1',
- '(int)2'])
+ ])
self.expect(
'frame variable mutable --ptr-depth 1 -d run -T',
substrs=[
substrs=[
'4 elements',
'[0]',
+ '(int)1',
'[1]',
+ '(int)2',
'[2]',
- '[3]',
'hello',
+ '[3]',
'world',
- '(int)1',
- '(int)2'])
+ ])
self.runCmd("next")
- self.expect('frame variable mutable',
- substrs=['4 elements'])
+ self.expect('frame variable mutable', substrs=['4 elements'])
self.expect(
'frame variable mutable --ptr-depth 1 -d run -T',
substrs=[
'4 elements',
'[0]',
+ '(int)1',
'[1]',
+ '(int)2',
'[2]',
- '[3]',
'hello',
+ '[3]',
'world',
- '(int)1',
- '(int)2'])
+ ])
'expr --element-count 3 -d run --ptr-depth=1 -- objects',
substrs=[
'3 elements',
- '2 elements',
- '2 key/value pairs',
'3735928559',
'4276993775',
'3203398366',
+ '2 elements',
'"Hello"',
- '"World"'])
+ '"World"',
+ '2 key/value pairs',
+ ])
# check that the synthetic children work, so we know we are doing the
# right thing
- self.expect("frame variable f00_1",
- substrs=['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 1'])
+ self.expect(
+ "frame variable f00_1",
+ substrs=[
+ 'a = 1',
+ 'fake_a = %d' % fake_a_val,
+ 'r = 34',
+ ])
# check that capping works
self.runCmd("settings set target.max-children-count 2", check=False)
self.expect("frame variable f00_1",
- substrs=['...',
- 'fake_a = %d' % fake_a_val,
- 'a = 1'])
+ substrs=[
+ 'a = 1',
+ 'fake_a = %d' % fake_a_val,
+ '...',
+ ])
self.expect("frame variable f00_1", matching=False,
substrs=['r = 34'])
"thread backtrace all",
substrs=[
stop_reason,
+ 'recursive_function',
'main',
'argc',
'argv',
- 'recursive_function'])
+ ])
# And it should report the correct line number.
self.expect("thread backtrace all",
# of the inferior after a crash.
self.expect("p i",
startstr='(int) $0 =')
-
self.expect(
"thread info -s",
- substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"])
+ substrs=[
+ "api_name",
+ "class_name",
+ "description",
+ "instrumentation_class",
+ "selector"
+ ])
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])