Lines Matching refs:self
18 def test_setting_names(self): argument
20 self.build()
21 self.setup_target()
22 self.do_check_names()
24 def test_illegal_names(self): argument
26 self.build()
27 self.setup_target()
28 self.do_check_illegal_names()
30 def test_using_names(self): argument
32 self.build()
33 self.setup_target()
34 self.do_check_using_names()
36 def test_configuring_names(self): argument
38 self.build()
39 self.make_a_dummy_name()
40 self.setup_target()
41 self.do_check_configuring_names()
43 def test_configuring_permissions_sb(self): argument
45 self.build()
46 self.setup_target()
47 self.do_check_configuring_permissions_sb()
49 def test_configuring_permissions_cli(self): argument
51 self.build()
52 self.setup_target()
53 self.do_check_configuring_permissions_cli()
55 def setup_target(self): argument
56 exe = self.getBuildArtifact("a.out")
59 self.target = self.dbg.CreateTarget(exe)
60 self.assertTrue(self.target, VALID_TARGET)
61 self.main_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "main.c"))
63 def check_name_in_target(self, bkpt_name): argument
65 self.target.GetBreakpointNames(name_list)
71 self.assertTrue(found_it, "Didn't find the name %s in the target's name list:"%(bkpt_name))
73 def setUp(self): argument
75 TestBase.setUp(self)
78 self.bp_name_string = "ABreakpoint"
79 self.is_one_shot = True
80 self.ignore_count = 1000
81 self.condition = "1 == 2"
82 self.auto_continue = True
83 self.tid = 0xaaaa
84 self.tidx = 10
85 self.thread_name = "Fooey"
86 self.queue_name = "Blooey"
87 self.cmd_list = lldb.SBStringList()
88 self.cmd_list.AppendString("frame var")
89 self.cmd_list.AppendString("bt")
90 self.help_string = "I do something interesting"
93 def do_check_names(self): argument
95 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
101 self.assertSuccess(success, "We couldn't add a legal name to a breakpoint.")
104 self.assertTrue(matches, "We didn't match the name we just set")
108 self.assertTrue(not matches, "We matched a name we didn't set.")
111 self.check_name_in_target(bkpt_name)
117 self.assertTrue(matches, "Adding a name means we didn't match the name we just set")
118 self.check_name_in_target(other_bkpt_name)
123 self.assertTrue(not matches,"We still match a name after removing it.")
129 self.assertEquals(num_names, 1, "Name list has %d items, expected 1."%(num_names))
132 …self.assertEquals(name, other_bkpt_name, "Remaining name was: %s expected %s."%(name, other_bkpt_n…
134 def do_check_illegal_names(self): argument
136 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
144 self.assertTrue(success.Fail(), "We allowed an illegal name: %s"%(bad_name))
145 bp_name = lldb.SBBreakpointName(self.target, bad_name)
146 …self.assertFalse(bp_name.IsValid(), "We made a breakpoint name with an illegal name: %s"%(bad_name…
149 … self.dbg.GetCommandInterpreter().HandleCommand("break set -n whatever -N '%s'"%(bad_name), retval)
150 … self.assertTrue(not retval.Succeeded(), "break set succeeded with: illegal name: %s"%(bad_name))
152 def do_check_using_names(self): argument
156 _ = self.target.BreakpointCreateByLocation(self.main_file_spec, 30)
159 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
166 self.assertSuccess(success, "We couldn't add a legal name to a breakpoint.")
168 bkpts = lldb.SBBreakpointList(self.target)
169 self.target.FindBreakpointsByName(bkpt_name, bkpts)
171 self.assertEquals(bkpts.GetSize(), 1, "One breakpoint matched.")
173 self.assertEquals(bkpt.GetID(), found_bkpt.GetID(),"The right breakpoint.")
174 self.assertEquals(bkpt.GetID(), bkpt_id,"With the same ID as before.")
177 self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval)
178 self.assertTrue(retval.Succeeded(), "break disable failed with: %s."%(retval.GetError()))
179 self.assertTrue(not bkpt.IsEnabled(), "We didn't disable the breakpoint.")
182 …self.dbg.GetCommandInterpreter().HandleCommand("break modify --one-shot 1 %s"%(other_bkpt_name), r…
183 self.assertTrue(retval.Succeeded(), "break modify failed with: %s."%(retval.GetError()))
184 self.assertTrue(not bkpt.IsOneShot(), "We applied one-shot to the wrong breakpoint.")
186 def check_option_values(self, bp_object): argument
187 self.assertEqual(bp_object.IsOneShot(), self.is_one_shot, "IsOneShot")
188 self.assertEqual(bp_object.GetIgnoreCount(), self.ignore_count, "IgnoreCount")
189 self.assertEqual(bp_object.GetCondition(), self.condition, "Condition")
190 self.assertEqual(bp_object.GetAutoContinue(), self.auto_continue, "AutoContinue")
191 self.assertEqual(bp_object.GetThreadID(), self.tid, "Thread ID")
192 self.assertEqual(bp_object.GetThreadIndex(), self.tidx, "Thread Index")
193 self.assertEqual(bp_object.GetThreadName(), self.thread_name, "Thread Name")
194 self.assertEqual(bp_object.GetQueueName(), self.queue_name, "Queue Name")
197 … self.assertEqual(set_cmds.GetSize(), self.cmd_list.GetSize(), "Size of command line commands")
199 …self.assertEqual(self.cmd_list.GetStringAtIndex(idx), set_cmds.GetStringAtIndex(idx), "Command %d"…
201 def make_a_dummy_name(self): argument
204 dummy_target = self.dbg.GetDummyTarget()
205 self.assertTrue(dummy_target.IsValid(), "Dummy target was not valid.")
208 self.dbg.GetDummyTarget().DeleteBreakpointName(self.bp_name_string)
211 self.addTearDownHook(cleanup)
214 bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string)
216 … self.assertEqual(bp_name.GetName(), self.bp_name_string, "Wrong bp_name: %s"%(bp_name.GetName()))
217 bp_name.SetOneShot(self.is_one_shot)
218 bp_name.SetIgnoreCount(self.ignore_count)
219 bp_name.SetCondition(self.condition)
220 bp_name.SetAutoContinue(self.auto_continue)
221 bp_name.SetThreadID(self.tid)
222 bp_name.SetThreadIndex(self.tidx)
223 bp_name.SetThreadName(self.thread_name)
224 bp_name.SetQueueName(self.queue_name)
225 bp_name.SetCommandLineCommands(self.cmd_list)
228 bp_name = lldb.SBBreakpointName(dummy_target, self.bp_name_string)
229 self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.")
230 self.check_option_values(bp_name)
232 def do_check_configuring_names(self): argument
238 bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
239 self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name.")
240 self.check_option_values(bp_name)
243 bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
244 success = bkpt.AddNameWithErrorHandling(self.bp_name_string)
245 self.assertSuccess(success, "Couldn't add this name to the breakpoint")
246 self.check_option_values(bkpt)
250 self.assertTrue(new_name.IsValid(), "Couldn't make a valid bp_name from a breakpoint.")
251 self.check_option_values(bkpt)
255 new_auto_continue = not self.auto_continue
257 …self.assertEqual(bp_name.GetAutoContinue(), new_auto_continue, "Couldn't change auto-continue on t…
258 …self.assertEqual(bkpt.GetAutoContinue(), new_auto_continue, "Option didn't propagate to the breakp…
262 self.is_one_shot,
263 self.ignore_count,
264 self.condition,
265 self.auto_continue,
266 self.tid,
267 self.tidx,
268 self.thread_name,
269 self.queue_name,
270 self.help_string)
271 for cmd in self.cmd_list:
274 self.runCmd(cmd_str, check=True)
276 cl_name = lldb.SBBreakpointName(self.target, cl_bp_name_string)
277 self.check_option_values(cl_name)
279 self.assertEqual(self.help_string, cl_name.GetHelpString(), "Help string didn't match")
283 self.assertEqual(new_help, cl_name.GetHelpString(), "SetHelpString didn't")
287 self.target.GetBreakpointNames(name_list)
288 for name_string in [self.bp_name_string, other_bp_name_string, cl_bp_name_string]:
289 self.assertIn(name_string, name_list, "Didn't find %s in names"%(name_string))
293 self.target.DeleteBreakpointName(self.bp_name_string)
295 self.target.GetBreakpointNames(name_list)
296 …self.assertNotIn(self.bp_name_string, name_list, "Didn't delete %s from a real target"%(self.bp_na…
298 …self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoin…
302 dummy_target = self.dbg.GetDummyTarget()
303 dummy_target.DeleteBreakpointName(self.bp_name_string)
306 …self.assertNotIn(self.bp_name_string, name_list, "Didn't delete %s from the dummy target"%(self.bp…
308 …self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoin…
310 def check_permission_results(self, bp_name): argument
311 self.assertEqual(bp_name.GetAllowDelete(), False, "Didn't set allow delete.")
312 protected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
315 unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
318 success = protected_bkpt.AddNameWithErrorHandling(self.bp_name_string)
319 self.assertSuccess(success, "Couldn't add this name to the breakpoint")
321 self.target.DisableAllBreakpoints()
322 … self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled")
323 …self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabli…
328 self.dbg.GetCommandInterpreter().HandleCommand("break disable", result)
329 self.assertTrue(result.Succeeded())
330 … self.assertEqual(protected_bkpt.IsEnabled(), True, "Didnt' keep breakpoint from being disabled")
331 …self.assertEqual(unprotected_bkpt.IsEnabled(), False, "Protected too many breakpoints from disabli…
333 self.target.DeleteAllBreakpoints()
334 bkpt = self.target.FindBreakpointByID(protected_id)
335 self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.")
336 bkpt = self.target.FindBreakpointByID(unprotected_id)
337 self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.")
340 unprotected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
343 self.dbg.GetCommandInterpreter().HandleCommand("break delete -f", result)
344 self.assertTrue(result.Succeeded())
345 bkpt = self.target.FindBreakpointByID(protected_id)
346 self.assertTrue(bkpt.IsValid(), "Didn't keep the breakpoint from being deleted.")
347 bkpt = self.target.FindBreakpointByID(unprotected_id)
348 self.assertFalse(bkpt.IsValid(), "Protected too many breakpoints from deletion.")
350 def do_check_configuring_permissions_sb(self): argument
351 bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
354 bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
355 self.assertTrue(bp_name.IsValid(), "Failed to make breakpoint name for valid name.")
360 self.check_permission_results(bp_name)
362 def do_check_configuring_permissions_cli(self): argument
364 self.runCmd("breakpoint name configure -L 0 -D 0 -A 0 %s"%(self.bp_name_string), check=True)
366 bp_name = lldb.SBBreakpointName(self.target, self.bp_name_string)
367 self.assertTrue(bp_name.IsValid(), "Didn't make a breakpoint name we could find.")
368 self.check_permission_results(bp_name)