Lines Matching defs:self
27 def test_at(self):
29 self.complete_from_to("at", "attach ")
31 def test_de(self):
33 self.complete_from_to("de", "detach ")
35 def test_frame_variable(self):
36 self.build()
39 self, "// Break here", lldb.SBFileSpec("main.cpp")
41 self.assertState(process.GetState(), lldb.eStateStopped)
46 self.do_test_variable_completion("frame variable")
48 def test_dwim_print(self):
49 self.build()
52 self, "// Break here", lldb.SBFileSpec("main.cpp")
54 self.assertState(process.GetState(), lldb.eStateStopped)
59 self.do_test_variable_completion("dwim-print")
61 def do_test_variable_completion(self, command):
62 self.complete_from_to(f"{command} fo", f"{command} fooo")
63 self.complete_from_to(f"{command} fooo.", f"{command} fooo.t")
64 self.complete_from_to(f"{command} fooo.t.", f"{command} fooo.t.x")
65 self.complete_from_to(f"{command} fooo.dd", f"{command} fooo.dd")
67 self.complete_from_to(f"{command} ptr_fooo->", f"{command} ptr_fooo->t")
68 self.complete_from_to(f"{command} ptr_fooo->t.", f"{command} ptr_fooo->t.x")
69 self.complete_from_to(f"{command} ptr_fooo->dd", f"{command} ptr_fooo->dd")
71 self.complete_from_to(f"{command} cont", f"{command} container")
72 self.complete_from_to(f"{command} container.", f"{command} container.MemberVar")
73 self.complete_from_to(
77 self.complete_from_to(f"{command} ptr_cont", f"{command} ptr_container")
78 self.complete_from_to(
81 self.complete_from_to(
85 def test_process_attach_dash_dash_con(self):
87 self.complete_from_to("process attach --con", "process attach --continue ")
89 def test_process_launch_arch(self):
90 self.complete_from_to("process launch --arch ", ["mips", "arm64"])
92 def test_process_load(self):
93 self.build()
95 self, "// Break here", lldb.SBFileSpec("main.cpp")
97 self.complete_from_to("process load Makef", "process load Makefile")
100 def test_process_unload(self):
103 self.complete_from_to("process unload ", "process unload ")
105 self.build()
107 self, "// Break here", lldb.SBFileSpec("main.cpp")
110 local_spec = lldb.SBFileSpec(self.getBuildArtifact("libshared.so"))
112 self.process().LoadImage(
115 lldbutil.append_to_process_working_directory(self, "libshared.so"),
121 self.process().LoadImage(local_spec, err)
122 self.assertSuccess(err)
124 self.complete_from_to("process unload ", "process unload 0")
126 self.process().UnloadImage(0)
127 self.complete_from_to("process unload ", "process unload ")
129 def test_process_plugin_completion(self):
133 self.complete_from_to(
138 def completions_contain_str(self, input, needle):
139 interp = self.dbg.GetCommandInterpreter()
147 self.assertTrue(
152 def test_common_completion_process_pid_and_name(self):
156 self.build()
157 server = self.spawnSubprocess(
158 self.getBuildArtifact("a.out"),
164 self.assertIsNotNone(server)
167 self.completions_contain("process attach -p ", [str(pid)])
168 self.completions_contain("platform process attach -p ", [str(pid)])
169 self.completions_contain("platform process info ", [str(pid)])
171 self.completions_contain_str("process attach -n ", "a.out")
172 self.completions_contain_str("platform process attach -n ", "a.out")
174 def test_process_signal(self):
176 self.complete_from_to("process signal ", "process signal ")
179 self.build()
180 self.main_source = "main.cpp"
181 self.main_source_spec = lldb.SBFileSpec(self.main_source)
182 lldbutil.run_to_source_breakpoint(self, "// Break here", self.main_source_spec)
184 self.complete_from_to("process signal ", "process signal SIG")
185 self.complete_from_to("process signal SIGPIP", "process signal SIGPIPE")
186 self.complete_from_to("process signal SIGA", ["SIGABRT", "SIGALRM"])
188 def test_ambiguous_long_opt(self):
189 self.completions_match(
193 def test_disassemble_dash_f(self):
194 self.completions_match("disassemble -F ", ["default", "intel", "att"])
196 def test_plugin_load(self):
197 self.complete_from_to("plugin load ", [])
199 def test_log_enable(self):
200 self.complete_from_to("log disable ll", ["lldb"])
201 self.complete_from_to("log disable dw", ["dwarf"])
202 self.complete_from_to("log disable lldb al", ["all"])
203 self.complete_from_to("log disable lldb sym", ["symbol"])
205 def test_log_list(self):
206 self.complete_from_to("log list ll", ["lldb"])
207 self.complete_from_to("log list dw", ["dwarf"])
208 self.complete_from_to("log list ll", ["lldb"])
209 self.complete_from_to("log list lldb dwa", ["dwarf"])
211 def test_quoted_command(self):
212 self.complete_from_to('"set', ['"settings" '])
214 def test_quoted_arg_with_quoted_command(self):
215 self.complete_from_to('"settings" "repl', ['"replace" '])
217 def test_quoted_arg_without_quoted_command(self):
218 self.complete_from_to('settings "repl', ['"replace" '])
220 def test_single_quote_command(self):
221 self.complete_from_to("'set", ["'settings' "])
223 def test_terminated_quote_command(self):
226 self.complete_from_to("'settings'", [])
228 def test_process_launch_arch_arm(self):
229 self.complete_from_to("process launch --arch arm", ["arm64"])
231 def test_target_symbols_add_shlib(self):
233 self.complete_from_to("target symbols add --shlib ", [])
235 def test_log_file(self):
237 src_dir = self.getSourceDir() + "/"
238 self.complete_from_to("log enable lldb expr -f " + src_dir, ["main.cpp"])
240 def test_log_dir(self):
243 self.complete_from_to("log enable lldb expr -f " + src_dir, [src_dir + os.sep])
246 def test_infinite_loop_while_completing(self):
248 self.complete_from_to("process print hello\\", "process print hello\\")
250 def test_watchpoint_co(self):
252 self.complete_from_to("watchpoint co", "watchpoint command ")
254 def test_watchpoint_command_space(self):
256 self.complete_from_to("watchpoint command ", ["add", "delete", "list"])
258 def test_watchpoint_command_a(self):
260 self.complete_from_to("watchpoint command a", "watchpoint command add ")
262 def test_watchpoint_set_ex(self):
264 self.complete_from_to("watchpoint set ex", "watchpoint set expression ")
266 def test_watchpoint_set_var(self):
268 self.complete_from_to("watchpoint set var", "watchpoint set variable ")
270 def test_watchpoint_set_variable_foo(self):
271 self.build()
273 self, "// Break here", lldb.SBFileSpec("main.cpp")
275 self.complete_from_to(
279 self.complete_from_to(
283 def test_help_fi(self):
285 self.complete_from_to("help fi", ["file", "finish"])
287 def test_help_watchpoint_s(self):
289 self.complete_from_to("help watchpoint s", "help watchpoint set ")
293 def test_common_complete_watchpoint_ids(self):
298 self.complete_from_to(
303 self.build()
305 self, "// Break here", lldb.SBFileSpec("main.cpp")
308 self.runCmd("watchpoint set variable ptr_fooo")
310 self.complete_from_to("watchpoint " + subcommand + " ", ["1"])
312 def test_settings_append_target_er(self):
314 self.complete_from_to(
318 def test_settings_insert_after_target_en(self):
320 self.complete_from_to(
324 def test_settings_insert_before_target_en(self):
326 self.complete_from_to(
331 def test_settings_replace_target_ru(self):
333 self.complete_from_to(
337 def test_settings_show_term(self):
338 self.complete_from_to("settings show term-w", "settings show term-width")
340 def test_settings_list_term(self):
341 self.complete_from_to("settings list term-w", "settings list term-width")
343 def test_settings_show_term(self):
344 self.complete_from_to("settings show term-h", "settings show term-height")
346 def test_settings_list_term(self):
347 self.complete_from_to("settings list term-h", "settings list term-height")
349 def test_settings_remove_term(self):
350 self.complete_from_to("settings remove term-w", "settings remove term-width")
352 def test_settings_remove_term(self):
353 self.complete_from_to("settings remove term-h", "settings remove term-height")
355 def test_settings_s(self):
357 self.complete_from_to("settings s", ["set", "show"])
359 def test_settings_set_th(self):
361 self.complete_from_to("settings set thread-f", "settings set thread-format")
363 def test_settings_s_dash(self):
365 self.complete_from_to("settings set --g", "settings set --global")
367 def test_settings_clear_th(self):
369 self.complete_from_to("settings clear thread-f", "settings clear thread-format")
371 def test_settings_set_ta(self):
373 self.complete_from_to("settings set target.ma", "settings set target.max-")
375 def test_settings_set_target_exec(self):
377 self.complete_from_to(
381 def test_settings_set_target_pr(self):
384 self.complete_from_to(
388 def test_settings_set_target_process(self):
390 self.complete_from_to(
394 def test_settings_set_target_process_dot(self):
396 self.complete_from_to(
400 def test_settings_set_target_process_thread_dot(self):
404 self.complete_from_to(
412 def test_settings_set_can_complete_setting_enum_values(self):
414 self.complete_from_to(
419 def test_thread_plan_discard(self):
420 self.build()
422 self, "ptr_foo", lldb.SBFileSpec("main.cpp")
424 self.assertTrue(thread)
425 self.complete_from_to("thread plan discard ", "thread plan discard ")
427 source_path = os.path.join(self.getSourceDir(), "thread_plan_script.py")
428 self.runCmd("command script import '%s'" % (source_path))
429 self.runCmd("thread step-scripted -C thread_plan_script.PushPlanStack")
430 self.complete_from_to("thread plan discard ", "thread plan discard 1")
431 self.runCmd("thread plan discard 1")
433 def test_target_space(self):
436 self.complete_from_to(
441 def test_target_modules_dump_line_table(self):
443 self.build()
444 self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
445 self.complete_from_to("target modules dump line-table main.cp", ["main.cpp"])
447 def test_custom_command_completion(self):
478 self.completions_contain("command script add -C ", completion_types)
480 source_path = os.path.join(self.getSourceDir(), "my_test_cmd.py")
481 self.runCmd("command script import '%s'" % (source_path))
482 self.runCmd(
485 self.complete_from_to("my_test_cmd main.cp", ["main.cpp"])
486 self.expect("my_test_cmd main.cpp", substrs=["main.cpp"])
489 def test_completion_target_create_from_root_dir(self):
492 self.completions_contain(
502 def test_target_modules_load_aout(self):
504 self.build()
505 self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
506 self.complete_from_to("target modules load a.ou", ["a.out"])
508 def test_target_modules_search_paths_insert(self):
510 self.complete_from_to(
513 self.build()
514 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
515 self.assertTrue(target, VALID_TARGET)
516 self.complete_from_to(
519 self.runCmd("target modules search-paths add a b")
520 self.complete_from_to(
525 self.complete_from_to(
530 def test_target_create_dash_co(self):
532 self.complete_from_to("target create --co", "target create --core ")
534 def test_target_va(self):
536 self.complete_from_to("target va", "target variable ")
538 def test_common_completion_thread_index(self):
554 self.complete_from_to(
558 self.build()
560 self, "// Break here", lldb.SBFileSpec("main.cpp")
565 self.complete_from_to("thread " + subcommand + " ", ["1"])
567 def test_common_completion_type_category_name(self):
570 self.complete_from_to("type category " + subcommand + " ", ["default"])
571 self.complete_from_to("type filter add -w ", ["default"])
573 def test_command_argument_completion(self):
575 self.complete_from_to("watchpoint set variable -", ["-w", "-s"])
576 self.complete_from_to(
579 self.complete_from_to("watchpoint set variable --", ["--watch", "--size"])
580 self.complete_from_to(
583 self.complete_from_to(
586 self.complete_from_to(
589 self.complete_from_to(
592 self.complete_from_to(
597 self.complete_from_to("watchpoint set variable foo -", ["-w", "-s"])
598 self.complete_from_to(
601 self.complete_from_to("watchpoint set variable foo --", ["--watch", "--size"])
602 self.complete_from_to(
605 self.complete_from_to(
608 self.complete_from_to(
611 self.complete_from_to(
615 self.complete_from_to(
620 def test_command_script_delete(self):
621 self.runCmd("command script add -h test_desc -f none -s current usercmd1")
622 self.check_completion_with_desc("command script delete ", [["usercmd1", ""]])
624 def test_command_delete(self):
625 self.runCmd(
628 self.complete_from_to("command delete test_c", "command delete test_command")
630 def test_command_unalias(self):
631 self.complete_from_to("command unalias ima", "command unalias image")
633 def test_command_aliases(self):
634 self.runCmd("command alias brkpt breakpoint")
637 self.complete_from_to("b", "b ")
639 self.complete_from_to("br", ["breakpoint", "brkpt"])
641 self.complete_from_to("brk", "brkpt")
644 self.runCmd("command alias test_1 breakpoint")
645 self.runCmd("command alias test_2 breakpoint")
646 self.complete_from_to("test_", ["test_1", "test_2"])
648 def test_completion_description_commands(self):
650 self.check_completion_with_desc(
661 self.check_completion_with_desc(
670 self.check_completion_with_desc("comman", [])
671 self.check_completion_with_desc("non-existent-command", [])
673 def test_completion_description_command_options(self):
676 self.check_completion_with_desc(
685 self.check_completion_with_desc(
694 self.check_completion_with_desc(
703 self.check_completion_with_desc("breakpoint set --Z", [])
705 def test_common_completion_frame_index(self):
706 self.build()
708 self, "// Break here", lldb.SBFileSpec("main.cpp")
711 self.complete_from_to("frame select ", ["0"])
712 self.complete_from_to("thread backtrace -s ", ["0"])
714 def test_frame_recognizer_delete(self):
715 self.runCmd(
718 self.check_completion_with_desc(
723 def test_platform_install_local_file(self):
724 self.complete_from_to(
729 def test_symbol_name(self):
730 self.build()
731 self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
732 self.complete_from_to(
737 self.complete_from_to("breakpoint set -n Qu", "")
739 def test_completion_type_formatter_delete(self):
740 self.runCmd("type filter add --child a Aoo")
741 self.complete_from_to("type filter delete ", ["Aoo"])
742 self.runCmd("type filter add --child b -x Boo")
743 self.complete_from_to("type filter delete ", ["Boo"])
745 self.runCmd("type format add -f hex Coo")
746 self.complete_from_to("type format delete ", ["Coo"])
747 self.runCmd("type format add -f hex -x Doo")
748 self.complete_from_to("type format delete ", ["Doo"])
750 self.runCmd("type summary add -c Eoo")
751 self.complete_from_to("type summary delete ", ["Eoo"])
752 self.runCmd("type summary add -x -c Foo")
753 self.complete_from_to("type summary delete ", ["Foo"])
755 self.runCmd("type synthetic add Goo -l test")
756 self.complete_from_to("type synthetic delete ", ["Goo"])
757 self.runCmd("type synthetic add -x Hoo -l test")
758 self.complete_from_to("type synthetic delete ", ["Hoo"])
760 def test_register_no_complete(self):
762 self.complete_from_to("register read ", "register read ")
763 self.complete_from_to("register write ", "register write ")
764 self.complete_from_to("register info ", "register info ")
766 self.build()
767 self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
768 self.runCmd("run")
772 self.complete_from_to("register read ", "register read ")
773 self.complete_from_to("register write ", "register write ")
774 self.complete_from_to("register info ", "register info ")
777 def test_register_read_and_write_on_x86(self):
780 self.build()
781 self.main_source_spec = lldb.SBFileSpec("main.cpp")
782 lldbutil.run_to_source_breakpoint(self, "// Break here", self.main_source_spec)
785 self.complete_from_to("register read ", ["rax", "rbx", "rcx"])
786 self.complete_from_to("register read r", ["rax", "rbx", "rcx"])
787 self.complete_from_to("register read ra", "register read rax")
789 self.complete_from_to("register read rax ", ["rax", "rbx", "rcx"])
791 self.completions_match("register read $rb", ["$rbx", "$rbp"])
792 self.completions_match("register read $ra", ["$rax"])
793 self.complete_from_to("register read rax $", ["$rax", "$rbx", "$rcx"])
794 self.complete_from_to("register read $rax ", ["rax", "rbx", "rcx"])
797 self.complete_from_to("register write ", ["rax", "rbx", "rcx"])
798 self.complete_from_to("register write r", ["rax", "rbx", "rcx"])
799 self.complete_from_to("register write ra", "register write rax")
800 self.complete_from_to("register write rb", ["rbx", "rbp"])
802 self.complete_from_to("register write rbx ", [])
804 def test_common_completion_target_stophook_ids(self):
808 self.complete_from_to(
813 self.build()
814 self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
815 self.runCmd("target stop-hook add -o test")
818 self.complete_from_to(
825 self.complete_from_to(
830 def test_common_completion_type_language(self):
831 self.complete_from_to("type category -l ", ["c"])
833 def test_target_modules_load_dash_u(self):
834 self.build()
835 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
836 self.complete_from_to(
840 def test_complete_breakpoint_with_ids(self):
855 self.complete_from_to(
859 self.build()
860 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
861 self.assertTrue(target, VALID_TARGET)
864 self.assertTrue(bp)
865 self.assertEqual(bp.GetNumLocations(), 1)
868 self.complete_from_to("breakpoint " + subcommand + " ", ["1"])
871 self.assertTrue(bp2)
872 self.assertEqual(bp2.GetNumLocations(), 1)
875 self.complete_from_to("breakpoint " + subcommand + " ", ["1", "2"])
878 self.complete_from_to("breakpoint " + subcommand + " 1 ", ["1", "2"])
880 def test_complete_breakpoint_with_names(self):
881 self.build()
882 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
883 self.assertTrue(target, VALID_TARGET)
886 self.complete_from_to("breakpoint read -N ", "breakpoint read -N ")
887 self.complete_from_to("breakpoint read -f breakpoints.json -N ", ["mm"])
888 self.complete_from_to(
892 self.complete_from_to(
899 self.assertTrue(bp1)
900 self.assertEqual(bp1.GetNumLocations(), 1)
901 self.complete_from_to("breakpoint set -N n", "breakpoint set -N n")
902 self.assertTrue(bp1.AddNameWithErrorHandling("nn"))
903 self.complete_from_to("breakpoint set -N ", "breakpoint set -N nn")
905 def test_ambiguous_command(self):
907 self.complete_from_to("settings s", ["set", "show"])
909 def test_ambiguous_subcommand(self):
911 self.complete_from_to("settings s ta", [])
913 def test_shlib_name(self):
914 self.build()
917 target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"), None, None, False, error)
918 self.assertSuccess(error)
919 self.registerSharedLibrariesWithTarget(target, ["shared"])
928 self.maxDiff = None
931 self.completions_match("target symbols add -s ", basenames + paths)
934 self.completions_match("target symbols add -s a.", ["a.out"])
938 self.completions_match("target symbols add -s '" + prefix, paths)
942 self.completions_match("target symbols add -s '" + prefix_sep, paths)
948 self.completions_match("target symbols add -s '" + prefix_sep_sep, paths_sep)