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_settings_append_target_er(self):
236        """Test that 'settings append target.er' completes to 'settings append target.error-path'."""
237        self.complete_from_to(
238            'settings append target.er',
239            'settings append target.error-path')
240
241    def test_settings_insert_after_target_en(self):
242        """Test that 'settings insert-after target.env' completes to 'settings insert-after target.env-vars'."""
243        self.complete_from_to(
244            'settings insert-after target.env',
245            'settings insert-after target.env-vars')
246
247    def test_settings_insert_before_target_en(self):
248        """Test that 'settings insert-before target.env' completes to 'settings insert-before target.env-vars'."""
249        self.complete_from_to(
250            'settings insert-before target.env',
251            'settings insert-before target.env-vars')
252
253    def test_settings_replace_target_ru(self):
254        """Test that 'settings replace target.ru' completes to 'settings replace target.run-args'."""
255        self.complete_from_to(
256            'settings replace target.ru',
257            'settings replace target.run-args')
258
259    def test_settings_show_term(self):
260        self.complete_from_to(
261            'settings show term-',
262            'settings show term-width')
263
264    def test_settings_list_term(self):
265        self.complete_from_to(
266            'settings list term-',
267            'settings list term-width')
268
269    def test_settings_remove_term(self):
270        self.complete_from_to(
271            'settings remove term-',
272            'settings remove term-width')
273
274    def test_settings_s(self):
275        """Test that 'settings s' completes to ['set', 'show']."""
276        self.complete_from_to(
277            'settings s', [
278                'set', 'show'])
279
280    def test_settings_set_th(self):
281        """Test that 'settings set thread-f' completes to 'settings set thread-format'."""
282        self.complete_from_to('settings set thread-f', 'settings set thread-format')
283
284    def test_settings_s_dash(self):
285        """Test that 'settings set --g' completes to 'settings set --global'."""
286        self.complete_from_to('settings set --g', 'settings set --global')
287
288    def test_settings_clear_th(self):
289        """Test that 'settings clear thread-f' completes to 'settings clear thread-format'."""
290        self.complete_from_to(
291            'settings clear thread-f',
292            'settings clear thread-format')
293
294    def test_settings_set_ta(self):
295        """Test that 'settings set ta' completes to 'settings set target.'."""
296        self.complete_from_to(
297            'settings set target.ma',
298            'settings set target.max-')
299
300    def test_settings_set_target_exec(self):
301        """Test that 'settings set target.exec' completes to 'settings set target.exec-search-paths '."""
302        self.complete_from_to(
303            'settings set target.exec',
304            'settings set target.exec-search-paths')
305
306    def test_settings_set_target_pr(self):
307        """Test that 'settings set target.pr' completes to [
308        'target.prefer-dynamic-value', 'target.process.']."""
309        self.complete_from_to('settings set target.pr',
310                              ['target.prefer-dynamic-value',
311                               'target.process.'])
312
313    def test_settings_set_target_process(self):
314        """Test that 'settings set target.process' completes to 'settings set target.process.'."""
315        self.complete_from_to(
316            'settings set target.process',
317            'settings set target.process.')
318
319    def test_settings_set_target_process_dot(self):
320        """Test that 'settings set target.process.t' completes to 'settings set target.process.thread.'."""
321        self.complete_from_to(
322            'settings set target.process.t',
323            'settings set target.process.thread.')
324
325    def test_settings_set_target_process_thread_dot(self):
326        """Test that 'settings set target.process.thread.' completes to [
327        'target.process.thread.step-avoid-regexp', 'target.process.thread.trace-thread']."""
328        self.complete_from_to('settings set target.process.thread.',
329                              ['target.process.thread.step-avoid-regexp',
330                               'target.process.thread.trace-thread'])
331
332    def test_thread_plan_discard(self):
333        self.build()
334        (_, _, thread, _) = lldbutil.run_to_source_breakpoint(self,
335                                          'ptr_foo', lldb.SBFileSpec("main.cpp"))
336        self.assertTrue(thread)
337        self.complete_from_to('thread plan discard ', 'thread plan discard ')
338
339        source_path = os.path.join(self.getSourceDir(), "thread_plan_script.py")
340        self.runCmd("command script import '%s'"%(source_path))
341        self.runCmd("thread step-scripted -C thread_plan_script.PushPlanStack")
342        self.complete_from_to('thread plan discard ', 'thread plan discard 1')
343        self.runCmd('thread plan discard 1')
344
345    def test_target_space(self):
346        """Test that 'target ' completes to ['create', 'delete', 'list',
347        'modules', 'select', 'stop-hook', 'variable']."""
348        self.complete_from_to('target ',
349                              ['create',
350                               'delete',
351                               'list',
352                               'modules',
353                               'select',
354                               'stop-hook',
355                               'variable'])
356
357    def test_target_modules_dump_line_table(self):
358        """Tests source file completion by completing the line-table argument."""
359        self.build()
360        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
361        self.complete_from_to('target modules dump line-table main.cp',
362                              ['main.cpp'])
363
364    def test_target_modules_load_aout(self):
365        """Tests modules completion by completing the target modules load argument."""
366        self.build()
367        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
368        self.complete_from_to('target modules load a.ou',
369                              ['a.out'])
370
371    def test_target_modules_search_paths_insert(self):
372        # Completion won't work without a valid target.
373        self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert ")
374        self.build()
375        target = self.dbg.CreateTarget(self.getBuildArtifact('a.out'))
376        self.assertTrue(target, VALID_TARGET)
377        self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert ")
378        self.runCmd("target modules search-paths add a b")
379        self.complete_from_to("target modules search-paths insert ", "target modules search-paths insert 0")
380        # Completion only works for the first arg.
381        self.complete_from_to("target modules search-paths insert 0 ", "target modules search-paths insert 0 ")
382
383    def test_target_create_dash_co(self):
384        """Test that 'target create --co' completes to 'target variable --core '."""
385        self.complete_from_to('target create --co', 'target create --core ')
386
387    def test_target_va(self):
388        """Test that 'target va' completes to 'target variable '."""
389        self.complete_from_to('target va', 'target variable ')
390
391    def test_common_completion_thread_index(self):
392        subcommands = ['continue', 'info', 'exception', 'select',
393                       'step-in', 'step-inst', 'step-inst-over', 'step-out', 'step-over', 'step-script']
394
395        # Completion should do nothing without threads.
396        for subcommand in subcommands:
397            self.complete_from_to('thread ' + subcommand + ' ',
398                                  'thread ' + subcommand + ' ')
399
400        self.build()
401        lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
402
403        # At least we have the thread at the index of 1 now.
404        for subcommand in subcommands:
405            self.complete_from_to('thread ' + subcommand + ' ', ['1'])
406
407    def test_command_argument_completion(self):
408        """Test completion of command arguments"""
409        self.complete_from_to("watchpoint set variable -", ["-w", "-s"])
410        self.complete_from_to('watchpoint set variable -w', 'watchpoint set variable -w ')
411        self.complete_from_to("watchpoint set variable --", ["--watch", "--size"])
412        self.complete_from_to("watchpoint set variable --w", "watchpoint set variable --watch")
413        self.complete_from_to('watchpoint set variable -w ', ['read', 'write', 'read_write'])
414        self.complete_from_to("watchpoint set variable --watch ", ["read", "write", "read_write"])
415        self.complete_from_to("watchpoint set variable --watch w", "watchpoint set variable --watch write")
416        self.complete_from_to('watchpoint set variable -w read_', 'watchpoint set variable -w read_write')
417        # Now try the same thing with a variable name (non-option argument) to
418        # test that getopts arg reshuffling doesn't confuse us.
419        self.complete_from_to("watchpoint set variable foo -", ["-w", "-s"])
420        self.complete_from_to('watchpoint set variable foo -w', 'watchpoint set variable foo -w ')
421        self.complete_from_to("watchpoint set variable foo --", ["--watch", "--size"])
422        self.complete_from_to("watchpoint set variable foo --w", "watchpoint set variable foo --watch")
423        self.complete_from_to('watchpoint set variable foo -w ', ['read', 'write', 'read_write'])
424        self.complete_from_to("watchpoint set variable foo --watch ", ["read", "write", "read_write"])
425        self.complete_from_to("watchpoint set variable foo --watch w", "watchpoint set variable foo --watch write")
426        self.complete_from_to('watchpoint set variable foo -w read_', 'watchpoint set variable foo -w read_write')
427
428    def test_command_script_delete(self):
429        self.runCmd("command script add -h test_desc -f none -s current usercmd1")
430        self.check_completion_with_desc('command script delete ', [['usercmd1', 'test_desc']])
431
432    def test_command_delete(self):
433        self.runCmd(r"command regex test_command s/^$/finish/ 's/([0-9]+)/frame select %1/'")
434        self.complete_from_to('command delete test_c', 'command delete test_command')
435
436    def test_command_unalias(self):
437        self.complete_from_to('command unalias ima', 'command unalias image')
438
439    def test_completion_description_commands(self):
440        """Test descriptions of top-level command completions"""
441        self.check_completion_with_desc("", [
442            ["command", "Commands for managing custom LLDB commands."],
443            ["breakpoint", "Commands for operating on breakpoints (see 'help b' for shorthand.)"]
444        ])
445
446        self.check_completion_with_desc("pl", [
447            ["platform", "Commands to manage and create platforms."],
448            ["plugin", "Commands for managing LLDB plugins."]
449        ])
450
451        # Just check that this doesn't crash.
452        self.check_completion_with_desc("comman", [])
453        self.check_completion_with_desc("non-existent-command", [])
454
455    def test_completion_description_command_options(self):
456        """Test descriptions of command options"""
457        # Short options
458        self.check_completion_with_desc("breakpoint set -", [
459            ["-h", "Set the breakpoint on exception catcH."],
460            ["-w", "Set the breakpoint on exception throW."]
461        ])
462
463        # Long options.
464        self.check_completion_with_desc("breakpoint set --", [
465            ["--on-catch", "Set the breakpoint on exception catcH."],
466            ["--on-throw", "Set the breakpoint on exception throW."]
467        ])
468
469        # Ambiguous long options.
470        self.check_completion_with_desc("breakpoint set --on-", [
471            ["--on-catch", "Set the breakpoint on exception catcH."],
472            ["--on-throw", "Set the breakpoint on exception throW."]
473        ])
474
475        # Unknown long option.
476        self.check_completion_with_desc("breakpoint set --Z", [
477        ])
478
479    def test_common_completion_frame_index(self):
480        self.build()
481        lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
482
483        self.complete_from_to('frame select ', ['0'])
484        self.complete_from_to('thread backtrace -s ', ['0'])
485
486    def test_frame_recognizer_delete(self):
487        self.runCmd("frame recognizer add -l py_class -s module_name -n recognizer_name")
488        self.check_completion_with_desc('frame recognizer delete ', [['0', 'py_class, module module_name, symbol recognizer_name']])
489
490    def test_platform_install_local_file(self):
491        self.complete_from_to('platform target-install main.cp', 'platform target-install main.cpp')
492
493    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
494    def test_symbol_name(self):
495        self.build()
496        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
497        self.complete_from_to('breakpoint set -n Fo',
498                              'breakpoint set -n Foo::Bar(int,\\ int)',
499                              turn_off_re_match=True)
500        # No completion for Qu because the candidate is
501        # (anonymous namespace)::Quux().
502        self.complete_from_to('breakpoint set -n Qu', '')
503
504    @skipIf(archs=no_match(['x86_64']))
505    def test_register_read_and_write_on_x86(self):
506        """Test the completion of the commands register read and write on x86"""
507
508        # The tab completion for "register read/write"  won't work without a running process.
509        self.complete_from_to('register read ',
510                              'register read ')
511        self.complete_from_to('register write ',
512                              'register write ')
513
514        self.build()
515        self.main_source_spec = lldb.SBFileSpec("main.cpp")
516        lldbutil.run_to_source_breakpoint(self, '// Break here', self.main_source_spec)
517
518        # test cases for register read
519        self.complete_from_to('register read ',
520                              ['rax',
521                               'rbx',
522                               'rcx'])
523        self.complete_from_to('register read r',
524                              ['rax',
525                               'rbx',
526                               'rcx'])
527        self.complete_from_to('register read ra',
528                              'register read rax')
529        # register read can take multiple register names as arguments
530        self.complete_from_to('register read rax ',
531                              ['rax',
532                               'rbx',
533                               'rcx'])
534        # complete with prefix '$'
535        self.completions_match('register read $rb',
536                              ['$rbx',
537                               '$rbp'])
538        self.completions_match('register read $ra',
539                              ['$rax'])
540        self.complete_from_to('register read rax $',
541                              ['\$rax',
542                               '\$rbx',
543                               '\$rcx'])
544        self.complete_from_to('register read $rax ',
545                              ['rax',
546                               'rbx',
547                               'rcx'])
548
549        # test cases for register write
550        self.complete_from_to('register write ',
551                              ['rax',
552                               'rbx',
553                               'rcx'])
554        self.complete_from_to('register write r',
555                              ['rax',
556                               'rbx',
557                               'rcx'])
558        self.complete_from_to('register write ra',
559                              'register write rax')
560        self.complete_from_to('register write rb',
561                              ['rbx',
562                               'rbp'])
563        # register write can only take exact one register name as argument
564        self.complete_from_to('register write rbx ',
565                              [])
566
567    def test_common_completion_target_stophook_ids(self):
568        subcommands = ['delete', 'enable', 'disable']
569
570        for subcommand in subcommands:
571            self.complete_from_to('target stop-hook ' + subcommand + ' ',
572                                  'target stop-hook ' + subcommand + ' ')
573
574        self.build()
575        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
576        self.runCmd('target stop-hook add test DONE')
577
578        for subcommand in subcommands:
579            self.complete_from_to('target stop-hook ' + subcommand + ' ',
580                                  'target stop-hook ' + subcommand + ' 1')
581
582        # Completion should work only on the first argument.
583        for subcommand in subcommands:
584            self.complete_from_to('target stop-hook ' + subcommand + ' 1 ',
585                                  'target stop-hook ' + subcommand + ' 1 ')
586
587    def test_common_completion_type_language(self):
588        self.complete_from_to('type category -l ', ['c'])
589
590    def test_target_modules_load_dash_u(self):
591        self.build()
592        target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
593        self.complete_from_to('target modules load -u ', [target.GetModuleAtIndex(0).GetUUIDString()])
594
595    def test_complete_breakpoint_with_ids(self):
596        """These breakpoint subcommands should be completed with a list of breakpoint ids"""
597
598        subcommands = ['enable', 'disable', 'delete', 'modify', 'name add', 'name delete', 'write']
599
600        # The tab completion here is unavailable without a target
601        for subcommand in subcommands:
602            self.complete_from_to('breakpoint ' + subcommand + ' ',
603                                  'breakpoint ' + subcommand + ' ')
604
605        self.build()
606        target = self.dbg.CreateTarget(self.getBuildArtifact('a.out'))
607        self.assertTrue(target, VALID_TARGET)
608
609        bp = target.BreakpointCreateByName('main', 'a.out')
610        self.assertTrue(bp)
611        self.assertEqual(bp.GetNumLocations(), 1)
612
613        for subcommand in subcommands:
614            self.complete_from_to('breakpoint ' + subcommand + ' ',
615                                  ['1'])
616
617        bp2 = target.BreakpointCreateByName('Bar', 'a.out')
618        self.assertTrue(bp2)
619        self.assertEqual(bp2.GetNumLocations(), 1)
620
621        for subcommand in subcommands:
622            self.complete_from_to('breakpoint ' + subcommand + ' ',
623                                  ['1',
624                                   '2'])
625
626        for subcommand in subcommands:
627            self.complete_from_to('breakpoint ' + subcommand + ' 1 ',
628                                  ['1',
629                                   '2'])
630
631