1""" 2Test the lldb command line completion mechanism. 3""" 4 5 6 7import os 8import lldb 9from lldbsuite.test.decorators import * 10from lldbsuite.test.lldbtest import * 11from lldbsuite.test import lldbplatform 12from lldbsuite.test import lldbutil 13 14 15class CommandLineCompletionTestCase(TestBase): 16 17 mydir = TestBase.compute_mydir(__file__) 18 19 NO_DEBUG_INFO_TESTCASE = True 20 21 @classmethod 22 def classCleanup(cls): 23 """Cleanup the test byproducts.""" 24 try: 25 os.remove("child_send.txt") 26 os.remove("child_read.txt") 27 except: 28 pass 29 30 def test_at(self): 31 """Test that 'at' completes to 'attach '.""" 32 self.complete_from_to('at', 'attach ') 33 34 def test_de(self): 35 """Test that 'de' completes to 'detach '.""" 36 self.complete_from_to('de', 'detach ') 37 38 def test_frame_variable(self): 39 self.build() 40 self.main_source = "main.cpp" 41 self.main_source_spec = lldb.SBFileSpec(self.main_source) 42 43 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, 44 '// Break here', self.main_source_spec) 45 self.assertEquals(process.GetState(), lldb.eStateStopped) 46 47 # Since CommandInterpreter has been corrected to update the current execution 48 # context at the beginning of HandleCompletion, we're here explicitly testing 49 # the scenario where "frame var" is completed without any preceding commands. 50 51 self.complete_from_to('frame variable fo', 52 'frame variable fooo') 53 self.complete_from_to('frame variable fooo.', 54 'frame variable fooo.') 55 self.complete_from_to('frame variable fooo.dd', 56 'frame variable fooo.dd') 57 58 self.complete_from_to('frame variable ptr_fooo->', 59 'frame variable ptr_fooo->') 60 self.complete_from_to('frame variable ptr_fooo->dd', 61 'frame variable ptr_fooo->dd') 62 63 self.complete_from_to('frame variable cont', 64 'frame variable container') 65 self.complete_from_to('frame variable container.', 66 'frame variable container.MemberVar') 67 self.complete_from_to('frame variable container.Mem', 68 'frame variable container.MemberVar') 69 70 self.complete_from_to('frame variable ptr_cont', 71 'frame variable ptr_container') 72 self.complete_from_to('frame variable ptr_container->', 73 'frame variable ptr_container->MemberVar') 74 self.complete_from_to('frame variable ptr_container->Mem', 75 'frame variable ptr_container->MemberVar') 76 77 def test_process_attach_dash_dash_con(self): 78 """Test that 'process attach --con' completes to 'process attach --continue '.""" 79 self.complete_from_to( 80 'process attach --con', 81 'process attach --continue ') 82 83 def test_process_launch_arch(self): 84 self.complete_from_to('process launch --arch ', 85 ['mips', 86 'arm64']) 87 88 def test_process_plugin_completion(self): 89 subcommands = ['attach -P', 'connect -p', 'launch -p'] 90 91 for subcommand in subcommands: 92 self.complete_from_to('process ' + subcommand + ' mac', 93 'process ' + subcommand + ' mach-o-core') 94 95 def test_process_signal(self): 96 # The tab completion for "process signal" won't work without a running process. 97 self.complete_from_to('process signal ', 98 'process signal ') 99 100 # Test with a running process. 101 self.build() 102 self.main_source = "main.cpp" 103 self.main_source_spec = lldb.SBFileSpec(self.main_source) 104 lldbutil.run_to_source_breakpoint(self, '// Break here', self.main_source_spec) 105 106 self.complete_from_to('process signal ', 107 'process signal SIG') 108 self.complete_from_to('process signal SIGA', 109 ['SIGABRT', 110 'SIGALRM']) 111 112 def test_ambiguous_long_opt(self): 113 self.completions_match('breakpoint modify --th', 114 ['--thread-id', 115 '--thread-index', 116 '--thread-name']) 117 118 def test_disassemble_dash_f(self): 119 self.completions_match('disassemble -F ', 120 ['default', 121 'intel', 122 'att']) 123 124 def test_plugin_load(self): 125 self.complete_from_to('plugin load ', []) 126 127 def test_log_enable(self): 128 self.complete_from_to('log enable ll', ['lldb']) 129 self.complete_from_to('log enable dw', ['dwarf']) 130 self.complete_from_to('log enable lldb al', ['all']) 131 self.complete_from_to('log enable lldb sym', ['symbol']) 132 133 def test_log_enable(self): 134 self.complete_from_to('log disable ll', ['lldb']) 135 self.complete_from_to('log disable dw', ['dwarf']) 136 self.complete_from_to('log disable lldb al', ['all']) 137 self.complete_from_to('log disable lldb sym', ['symbol']) 138 139 def test_log_list(self): 140 self.complete_from_to('log list ll', ['lldb']) 141 self.complete_from_to('log list dw', ['dwarf']) 142 self.complete_from_to('log list ll', ['lldb']) 143 self.complete_from_to('log list lldb dwa', ['dwarf']) 144 145 def test_quoted_command(self): 146 self.complete_from_to('"set', 147 ['"settings" ']) 148 149 def test_quoted_arg_with_quoted_command(self): 150 self.complete_from_to('"settings" "repl', 151 ['"replace" ']) 152 153 def test_quoted_arg_without_quoted_command(self): 154 self.complete_from_to('settings "repl', 155 ['"replace" ']) 156 157 def test_single_quote_command(self): 158 self.complete_from_to("'set", 159 ["'settings' "]) 160 161 def test_terminated_quote_command(self): 162 # This should not crash, but we don't get any 163 # reasonable completions from this. 164 self.complete_from_to("'settings'", []) 165 166 def test_process_launch_arch_arm(self): 167 self.complete_from_to('process launch --arch arm', 168 ['arm64']) 169 170 def test_target_symbols_add_shlib(self): 171 # Doesn't seem to work, but at least it shouldn't crash. 172 self.complete_from_to('target symbols add --shlib ', []) 173 174 def test_log_file(self): 175 # Complete in our source directory which contains a 'main.cpp' file. 176 src_dir = os.path.dirname(os.path.realpath(__file__)) + '/' 177 self.complete_from_to('log enable lldb expr -f ' + src_dir, 178 ['main.cpp']) 179 180 def test_log_dir(self): 181 # Complete our source directory. 182 src_dir = os.path.dirname(os.path.realpath(__file__)) 183 self.complete_from_to('log enable lldb expr -f ' + src_dir, 184 [src_dir + os.sep], turn_off_re_match=True) 185 186 # <rdar://problem/11052829> 187 def test_infinite_loop_while_completing(self): 188 """Test that 'process print hello\' completes to itself and does not infinite loop.""" 189 self.complete_from_to('process print hello\\', 'process print hello\\', 190 turn_off_re_match=True) 191 192 def test_watchpoint_co(self): 193 """Test that 'watchpoint co' completes to 'watchpoint command '.""" 194 self.complete_from_to('watchpoint co', 'watchpoint command ') 195 196 def test_watchpoint_command_space(self): 197 """Test that 'watchpoint command ' completes to ['add', 'delete', 'list'].""" 198 self.complete_from_to( 199 'watchpoint command ', [ 200 'add', 'delete', 'list']) 201 202 def test_watchpoint_command_a(self): 203 """Test that 'watchpoint command a' completes to 'watchpoint command add '.""" 204 self.complete_from_to( 205 'watchpoint command a', 206 'watchpoint command add ') 207 208 def test_watchpoint_set_ex(self): 209 """Test that 'watchpoint set ex' completes to 'watchpoint set expression '.""" 210 self.complete_from_to( 211 'watchpoint set ex', 212 'watchpoint set expression ') 213 214 def test_watchpoint_set_var(self): 215 """Test that 'watchpoint set var' completes to 'watchpoint set variable '.""" 216 self.complete_from_to('watchpoint set var', 'watchpoint set variable ') 217 218 def test_watchpoint_set_variable_foo(self): 219 self.build() 220 lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp")) 221 self.complete_from_to('watchpoint set variable fo', 'watchpoint set variable fooo') 222 # Only complete the first argument. 223 self.complete_from_to('watchpoint set variable fooo ', 'watchpoint set variable fooo ') 224 225 def test_help_fi(self): 226 """Test that 'help fi' completes to ['file', 'finish'].""" 227 self.complete_from_to( 228 'help fi', [ 229 'file', 'finish']) 230 231 def test_help_watchpoint_s(self): 232 """Test that 'help watchpoint s' completes to 'help watchpoint set '.""" 233 self.complete_from_to('help watchpoint s', 'help watchpoint set ') 234 235 def test_common_complete_watchpoint_ids(self): 236 subcommands = ['enable', 'disable', 'delete', 'modify', 'ignore'] 237 238 # Completion should not work without a target. 239 for subcommand in subcommands: 240 self.complete_from_to('watchpoint ' + subcommand + ' ', 241 'watchpoint ' + subcommand + ' ') 242 243 # Create a process to provide a target and enable watchpoint setting. 244 self.build() 245 lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp")) 246 247 self.runCmd('watchpoint set variable ptr_fooo') 248 for subcommand in subcommands: 249 self.complete_from_to('watchpoint ' + subcommand + ' ', ['1']) 250 251 def test_settings_append_target_er(self): 252 """Test that 'settings append target.er' completes to 'settings append target.error-path'.""" 253 self.complete_from_to( 254 'settings append target.er', 255 'settings append target.error-path') 256 257 def test_settings_insert_after_target_en(self): 258 """Test that 'settings insert-after target.env' completes to 'settings insert-after target.env-vars'.""" 259 self.complete_from_to( 260 'settings insert-after target.env', 261 'settings insert-after target.env-vars') 262 263 def test_settings_insert_before_target_en(self): 264 """Test that 'settings insert-before target.env' completes to 'settings insert-before target.env-vars'.""" 265 self.complete_from_to( 266 'settings insert-before target.env', 267 'settings insert-before target.env-vars') 268 269 def test_settings_replace_target_ru(self): 270 """Test that 'settings replace target.ru' completes to 'settings replace target.run-args'.""" 271 self.complete_from_to( 272 'settings replace target.ru', 273 'settings replace target.run-args') 274 275 def test_settings_show_term(self): 276 self.complete_from_to( 277 'settings show term-', 278 'settings show term-width') 279 280 def test_settings_list_term(self): 281 self.complete_from_to( 282 'settings list term-', 283 'settings list term-width') 284 285 def test_settings_remove_term(self): 286 self.complete_from_to( 287 'settings remove term-', 288 'settings remove term-width') 289 290 def test_settings_s(self): 291 """Test that 'settings s' completes to ['set', 'show'].""" 292 self.complete_from_to( 293 'settings s', [ 294 'set', 'show']) 295 296 def test_settings_set_th(self): 297 """Test that 'settings set thread-f' completes to 'settings set thread-format'.""" 298 self.complete_from_to('settings set thread-f', 'settings set thread-format') 299 300 def test_settings_s_dash(self): 301 """Test that 'settings set --g' completes to 'settings set --global'.""" 302 self.complete_from_to('settings set --g', 'settings set --global') 303 304 def test_settings_clear_th(self): 305 """Test that 'settings clear thread-f' completes to 'settings clear thread-format'.""" 306 self.complete_from_to( 307 'settings clear thread-f', 308 'settings clear thread-format') 309 310 def test_settings_set_ta(self): 311 """Test that 'settings set ta' completes to 'settings set target.'.""" 312 self.complete_from_to( 313 'settings set target.ma', 314 'settings set target.max-') 315 316 def test_settings_set_target_exec(self): 317 """Test that 'settings set target.exec' completes to 'settings set target.exec-search-paths '.""" 318 self.complete_from_to( 319 'settings set target.exec', 320 'settings set target.exec-search-paths') 321 322 def test_settings_set_target_pr(self): 323 """Test that 'settings set target.pr' completes to [ 324 'target.prefer-dynamic-value', 'target.process.'].""" 325 self.complete_from_to('settings set target.pr', 326 ['target.prefer-dynamic-value', 327 'target.process.']) 328 329 def test_settings_set_target_process(self): 330 """Test that 'settings set target.process' completes to 'settings set target.process.'.""" 331 self.complete_from_to( 332 'settings set target.process', 333 'settings set target.process.') 334 335 def test_settings_set_target_process_dot(self): 336 """Test that 'settings set target.process.t' completes to 'settings set target.process.thread.'.""" 337 self.complete_from_to( 338 'settings set target.process.t', 339 'settings set target.process.thread.') 340 341 def test_settings_set_target_process_thread_dot(self): 342 """Test that 'settings set target.process.thread.' completes to [ 343 'target.process.thread.step-avoid-regexp', 'target.process.thread.trace-thread'].""" 344 self.complete_from_to('settings set target.process.thread.', 345 ['target.process.thread.step-avoid-regexp', 346 'target.process.thread.trace-thread']) 347 348 def test_thread_plan_discard(self): 349 self.build() 350 (_, _, thread, _) = lldbutil.run_to_source_breakpoint(self, 351 'ptr_foo', lldb.SBFileSpec("main.cpp")) 352 self.assertTrue(thread) 353 self.complete_from_to('thread plan discard ', 'thread plan discard ') 354 355 source_path = os.path.join(self.getSourceDir(), "thread_plan_script.py") 356 self.runCmd("command script import '%s'"%(source_path)) 357 self.runCmd("thread step-scripted -C thread_plan_script.PushPlanStack") 358 self.complete_from_to('thread plan discard ', 'thread plan discard 1') 359 self.runCmd('thread plan discard 1') 360 361 def test_target_space(self): 362 """Test that 'target ' completes to ['create', 'delete', 'list', 363 'modules', 'select', 'stop-hook', 'variable'].""" 364 self.complete_from_to('target ', 365 ['create', 366 'delete', 367 'list', 368 'modules', 369 'select', 370 'stop-hook', 371 'variable']) 372 373 def test_target_modules_dump_line_table(self): 374 """Tests source file completion by completing the line-table argument.""" 375 self.build() 376 self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 377 self.complete_from_to('target modules dump line-table main.cp', 378 ['main.cpp']) 379 380 def test_target_modules_load_aout(self): 381 """Tests modules completion by completing the target modules load argument.""" 382 self.build() 383 self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 384 self.complete_from_to('target modules load a.ou', 385 ['a.out']) 386 387 def test_target_modules_search_paths_insert(self): 388 # Completion won't work without a valid target. 389 self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert ") 390 self.build() 391 target = self.dbg.CreateTarget(self.getBuildArtifact('a.out')) 392 self.assertTrue(target, VALID_TARGET) 393 self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert ") 394 self.runCmd("target modules search-paths add a b") 395 self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert 0") 396 # Completion only works for the first arg. 397 self.complete_from_to("target modules search-paths insert 0 ", "target modules search-paths insert 0 ") 398 399 def test_target_create_dash_co(self): 400 """Test that 'target create --co' completes to 'target variable --core '.""" 401 self.complete_from_to('target create --co', 'target create --core ') 402 403 def test_target_va(self): 404 """Test that 'target va' completes to 'target variable '.""" 405 self.complete_from_to('target va', 'target variable ') 406 407 def test_common_completion_thread_index(self): 408 subcommands = ['continue', 'info', 'exception', 'select', 409 'step-in', 'step-inst', 'step-inst-over', 'step-out', 'step-over', 'step-script'] 410 411 # Completion should do nothing without threads. 412 for subcommand in subcommands: 413 self.complete_from_to('thread ' + subcommand + ' ', 414 'thread ' + subcommand + ' ') 415 416 self.build() 417 lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp")) 418 419 # At least we have the thread at the index of 1 now. 420 for subcommand in subcommands: 421 self.complete_from_to('thread ' + subcommand + ' ', ['1']) 422 423 def test_command_argument_completion(self): 424 """Test completion of command arguments""" 425 self.complete_from_to("watchpoint set variable -", ["-w", "-s"]) 426 self.complete_from_to('watchpoint set variable -w', 'watchpoint set variable -w ') 427 self.complete_from_to("watchpoint set variable --", ["--watch", "--size"]) 428 self.complete_from_to("watchpoint set variable --w", "watchpoint set variable --watch") 429 self.complete_from_to('watchpoint set variable -w ', ['read', 'write', 'read_write']) 430 self.complete_from_to("watchpoint set variable --watch ", ["read", "write", "read_write"]) 431 self.complete_from_to("watchpoint set variable --watch w", "watchpoint set variable --watch write") 432 self.complete_from_to('watchpoint set variable -w read_', 'watchpoint set variable -w read_write') 433 # Now try the same thing with a variable name (non-option argument) to 434 # test that getopts arg reshuffling doesn't confuse us. 435 self.complete_from_to("watchpoint set variable foo -", ["-w", "-s"]) 436 self.complete_from_to('watchpoint set variable foo -w', 'watchpoint set variable foo -w ') 437 self.complete_from_to("watchpoint set variable foo --", ["--watch", "--size"]) 438 self.complete_from_to("watchpoint set variable foo --w", "watchpoint set variable foo --watch") 439 self.complete_from_to('watchpoint set variable foo -w ', ['read', 'write', 'read_write']) 440 self.complete_from_to("watchpoint set variable foo --watch ", ["read", "write", "read_write"]) 441 self.complete_from_to("watchpoint set variable foo --watch w", "watchpoint set variable foo --watch write") 442 self.complete_from_to('watchpoint set variable foo -w read_', 'watchpoint set variable foo -w read_write') 443 444 def test_command_script_delete(self): 445 self.runCmd("command script add -h test_desc -f none -s current usercmd1") 446 self.check_completion_with_desc('command script delete ', [['usercmd1', 'test_desc']]) 447 448 def test_command_delete(self): 449 self.runCmd(r"command regex test_command s/^$/finish/ 's/([0-9]+)/frame select %1/'") 450 self.complete_from_to('command delete test_c', 'command delete test_command') 451 452 def test_command_unalias(self): 453 self.complete_from_to('command unalias ima', 'command unalias image') 454 455 def test_completion_description_commands(self): 456 """Test descriptions of top-level command completions""" 457 self.check_completion_with_desc("", [ 458 ["command", "Commands for managing custom LLDB commands."], 459 ["breakpoint", "Commands for operating on breakpoints (see 'help b' for shorthand.)"] 460 ]) 461 462 self.check_completion_with_desc("pl", [ 463 ["platform", "Commands to manage and create platforms."], 464 ["plugin", "Commands for managing LLDB plugins."] 465 ]) 466 467 # Just check that this doesn't crash. 468 self.check_completion_with_desc("comman", []) 469 self.check_completion_with_desc("non-existent-command", []) 470 471 def test_completion_description_command_options(self): 472 """Test descriptions of command options""" 473 # Short options 474 self.check_completion_with_desc("breakpoint set -", [ 475 ["-h", "Set the breakpoint on exception catcH."], 476 ["-w", "Set the breakpoint on exception throW."] 477 ]) 478 479 # Long options. 480 self.check_completion_with_desc("breakpoint set --", [ 481 ["--on-catch", "Set the breakpoint on exception catcH."], 482 ["--on-throw", "Set the breakpoint on exception throW."] 483 ]) 484 485 # Ambiguous long options. 486 self.check_completion_with_desc("breakpoint set --on-", [ 487 ["--on-catch", "Set the breakpoint on exception catcH."], 488 ["--on-throw", "Set the breakpoint on exception throW."] 489 ]) 490 491 # Unknown long option. 492 self.check_completion_with_desc("breakpoint set --Z", [ 493 ]) 494 495 def test_common_completion_frame_index(self): 496 self.build() 497 lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp")) 498 499 self.complete_from_to('frame select ', ['0']) 500 self.complete_from_to('thread backtrace -s ', ['0']) 501 502 def test_frame_recognizer_delete(self): 503 self.runCmd("frame recognizer add -l py_class -s module_name -n recognizer_name") 504 self.check_completion_with_desc('frame recognizer delete ', [['0', 'py_class, module module_name, symbol recognizer_name']]) 505 506 def test_platform_install_local_file(self): 507 self.complete_from_to('platform target-install main.cp', 'platform target-install main.cpp') 508 509 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489") 510 def test_symbol_name(self): 511 self.build() 512 self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 513 self.complete_from_to('breakpoint set -n Fo', 514 'breakpoint set -n Foo::Bar(int,\\ int)', 515 turn_off_re_match=True) 516 # No completion for Qu because the candidate is 517 # (anonymous namespace)::Quux(). 518 self.complete_from_to('breakpoint set -n Qu', '') 519 520 @skipIf(archs=no_match(['x86_64'])) 521 def test_register_read_and_write_on_x86(self): 522 """Test the completion of the commands register read and write on x86""" 523 524 # The tab completion for "register read/write" won't work without a running process. 525 self.complete_from_to('register read ', 526 'register read ') 527 self.complete_from_to('register write ', 528 'register write ') 529 530 self.build() 531 self.main_source_spec = lldb.SBFileSpec("main.cpp") 532 lldbutil.run_to_source_breakpoint(self, '// Break here', self.main_source_spec) 533 534 # test cases for register read 535 self.complete_from_to('register read ', 536 ['rax', 537 'rbx', 538 'rcx']) 539 self.complete_from_to('register read r', 540 ['rax', 541 'rbx', 542 'rcx']) 543 self.complete_from_to('register read ra', 544 'register read rax') 545 # register read can take multiple register names as arguments 546 self.complete_from_to('register read rax ', 547 ['rax', 548 'rbx', 549 'rcx']) 550 # complete with prefix '$' 551 self.completions_match('register read $rb', 552 ['$rbx', 553 '$rbp']) 554 self.completions_match('register read $ra', 555 ['$rax']) 556 self.complete_from_to('register read rax $', 557 ['\$rax', 558 '\$rbx', 559 '\$rcx']) 560 self.complete_from_to('register read $rax ', 561 ['rax', 562 'rbx', 563 'rcx']) 564 565 # test cases for register write 566 self.complete_from_to('register write ', 567 ['rax', 568 'rbx', 569 'rcx']) 570 self.complete_from_to('register write r', 571 ['rax', 572 'rbx', 573 'rcx']) 574 self.complete_from_to('register write ra', 575 'register write rax') 576 self.complete_from_to('register write rb', 577 ['rbx', 578 'rbp']) 579 # register write can only take exact one register name as argument 580 self.complete_from_to('register write rbx ', 581 []) 582 583 def test_common_completion_target_stophook_ids(self): 584 subcommands = ['delete', 'enable', 'disable'] 585 586 for subcommand in subcommands: 587 self.complete_from_to('target stop-hook ' + subcommand + ' ', 588 'target stop-hook ' + subcommand + ' ') 589 590 self.build() 591 self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 592 self.runCmd('target stop-hook add test DONE') 593 594 for subcommand in subcommands: 595 self.complete_from_to('target stop-hook ' + subcommand + ' ', 596 'target stop-hook ' + subcommand + ' 1') 597 598 # Completion should work only on the first argument. 599 for subcommand in subcommands: 600 self.complete_from_to('target stop-hook ' + subcommand + ' 1 ', 601 'target stop-hook ' + subcommand + ' 1 ') 602 603 def test_common_completion_type_language(self): 604 self.complete_from_to('type category -l ', ['c']) 605 606 def test_target_modules_load_dash_u(self): 607 self.build() 608 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) 609 self.complete_from_to('target modules load -u ', [target.GetModuleAtIndex(0).GetUUIDString()]) 610 611 def test_complete_breakpoint_with_ids(self): 612 """These breakpoint subcommands should be completed with a list of breakpoint ids""" 613 614 subcommands = ['enable', 'disable', 'delete', 'modify', 'name add', 'name delete', 'write'] 615 616 # The tab completion here is unavailable without a target 617 for subcommand in subcommands: 618 self.complete_from_to('breakpoint ' + subcommand + ' ', 619 'breakpoint ' + subcommand + ' ') 620 621 self.build() 622 target = self.dbg.CreateTarget(self.getBuildArtifact('a.out')) 623 self.assertTrue(target, VALID_TARGET) 624 625 bp = target.BreakpointCreateByName('main', 'a.out') 626 self.assertTrue(bp) 627 self.assertEqual(bp.GetNumLocations(), 1) 628 629 for subcommand in subcommands: 630 self.complete_from_to('breakpoint ' + subcommand + ' ', 631 ['1']) 632 633 bp2 = target.BreakpointCreateByName('Bar', 'a.out') 634 self.assertTrue(bp2) 635 self.assertEqual(bp2.GetNumLocations(), 1) 636 637 for subcommand in subcommands: 638 self.complete_from_to('breakpoint ' + subcommand + ' ', 639 ['1', 640 '2']) 641 642 for subcommand in subcommands: 643 self.complete_from_to('breakpoint ' + subcommand + ' 1 ', 644 ['1', 645 '2']) 646 647