aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandCompletions.cpp
AgeCommit message (Collapse)AuthorFilesLines
5 days[lldb][NFC] Use IterationAction for ModuleList::ForEach callbacks (#150930)Michael Buch1-1/+1
2025-07-15[lldb] Add completions for plugin list/enable/disable (#147775)David Peixotto1-0/+8
This commit adds completion support for the plugin commands. It will try to complete partial namespaces to the full namespace string. If the completion input is already a full namespace string then it will add all the matching plugins in that namespace as completions. This lets the user complete to the namespace first and then tab-complete to the next level if desired. ``` (lldb) plugin list a<tab> Available completions: abi architecture (lldb) plugin list ab<tab> (lldb) plugin list abi<tab> (lldb) plugin list abi.<tab> Available completions: abi.SysV-arm64 abi.ABIMacOSX_arm64 abi.SysV-arm ... ```
2025-04-23[lldb] returning command completions up to a maximum (#135565)Ely Ronnen1-5/+14
- Adding `max_return_elements` field to `CompletionRequest`. - adding maximum checks to `SymbolCompleter` and `SourceFileCompleter`. Fixes #135553
2024-08-23Revert "Revert "[lldb] Extend frame recognizers to hide frames from ↵Adrian Prantl1-2/+2
backtraces (#104523)"" This reverts commit 547917aebd1e79a8929b53f0ddf3b5185ee4df74.
2024-08-22Revert "[lldb] Extend frame recognizers to hide frames from backtraces ↵Dmitri Gribenko1-2/+2
(#104523)" This reverts commit f01f80ce6ca7640bb0e267b84b1ed0e89b57e2d9. This commit introduces an msan violation. See the discussion on https://github.com/llvm/llvm-project/pull/104523.
2024-08-20[lldb] Extend frame recognizers to hide frames from backtraces (#104523)Adrian Prantl1-2/+2
Compilers and language runtimes often use helper functions that are fundamentally uninteresting when debugging anything but the compiler/runtime itself. This patch introduces a user-extensible mechanism that allows for these frames to be hidden from backtraces and automatically skipped over when navigating the stack with `up` and `down`. This does not affect the numbering of frames, so `f <N>` will still provide access to the hidden frames. The `bt` output will also print a hint that frames have been hidden. My primary motivation for this feature is to hide thunks in the Swift programming language, but I'm including an example recognizer for `std::function::operator()` that I wished for myself many times while debugging LLDB. rdar://126629381 Example output. (Yes, my proof-of-concept recognizer could hide even more frames if we had a method that returned the function name without the return type or I used something that isn't based off regex, but it's really only meant as an example). before: ``` (lldb) thread backtrace --filtered=false * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #0: 0x0000000100001f04 a.out`foo(x=1, y=1) at main.cpp:4:10 frame #1: 0x0000000100003a00 a.out`decltype(std::declval<int (*&)(int, int)>()(std::declval<int>(), std::declval<int>())) std::__1::__invoke[abi:se200000]<int (*&)(int, int), int, int>(__f=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:149:25 frame #2: 0x000000010000399c a.out`int std::__1::__invoke_void_return_wrapper<int, false>::__call[abi:se200000]<int (*&)(int, int), int, int>(__args=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:216:12 frame #3: 0x0000000100003968 a.out`std::__1::__function::__alloc_func<int (*)(int, int), std::__1::allocator<int (*)(int, int)>, int (int, int)>::operator()[abi:se200000](this=0x000000016fdff280, __arg=0x000000016fdff224, __arg=0x000000016fdff220) at function.h:171:12 frame #4: 0x00000001000026bc a.out`std::__1::__function::__func<int (*)(int, int), std::__1::allocator<int (*)(int, int)>, int (int, int)>::operator()(this=0x000000016fdff278, __arg=0x000000016fdff224, __arg=0x000000016fdff220) at function.h:313:10 frame #5: 0x0000000100003c38 a.out`std::__1::__function::__value_func<int (int, int)>::operator()[abi:se200000](this=0x000000016fdff278, __args=0x000000016fdff224, __args=0x000000016fdff220) const at function.h:430:12 frame #6: 0x0000000100002038 a.out`std::__1::function<int (int, int)>::operator()(this= Function = foo(int, int) , __arg=1, __arg=1) const at function.h:989:10 frame #7: 0x0000000100001f64 a.out`main(argc=1, argv=0x000000016fdff4f8) at main.cpp:9:10 frame #8: 0x0000000183cdf154 dyld`start + 2476 (lldb) ``` after ``` (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 * frame #0: 0x0000000100001f04 a.out`foo(x=1, y=1) at main.cpp:4:10 frame #1: 0x0000000100003a00 a.out`decltype(std::declval<int (*&)(int, int)>()(std::declval<int>(), std::declval<int>())) std::__1::__invoke[abi:se200000]<int (*&)(int, int), int, int>(__f=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:149:25 frame #2: 0x000000010000399c a.out`int std::__1::__invoke_void_return_wrapper<int, false>::__call[abi:se200000]<int (*&)(int, int), int, int>(__args=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:216:12 frame #6: 0x0000000100002038 a.out`std::__1::function<int (int, int)>::operator()(this= Function = foo(int, int) , __arg=1, __arg=1) const at function.h:989:10 frame #7: 0x0000000100001f64 a.out`main(argc=1, argv=0x000000016fdff4f8) at main.cpp:9:10 frame #8: 0x0000000183cdf154 dyld`start + 2476 Note: Some frames were hidden by frame recognizers ```
2024-05-30[lldb] Fix module name tab completion (#93458)Pavel Labath1-21/+36
Module names can be matched either by a full path or just their basename. The completion machinery tried to do both, but had several bugs: - it always inserted the basename as a completion candidate, even if the string being completed was a full path - due to FileSpec canonicalization, it lost information about trailing slashes (it treated "lib/<TAB>" as "lib<TAB>", even though it's clear the former was trying to complete a directory name) - due to both of the previous issues, the completion candidates could end up being shorter than the string being completed, which caused crashes (string out of range errors) when attempting to substitute the results. This patch rewrites to logic to remove these kinds of issues: - basename and full path completion are handled separately - full path completion is attempted always, basename only if the input string does not contain a slash - the code remembers both the canonical and original spelling or the completed argument. The canonical arg is used for matching, while the original spelling is used for completion. This way "/foo///.//b<TAB>" can still match "/foo/bar", but it will complete to "/foo///.//bar".
2023-12-16[lldb] Use StringRef::{starts,ends}_with (NFC)Kazu Hirata1-2/+2
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-12-14Add option to pass thread ID to thread select command (#73596)Michael Christensen1-3/+22
We'd like a way to select the current thread by its thread ID (rather than its internal LLDB thread index). This PR adds a `-t` option (`--thread_id` long option) that tells the `thread select` command to interpret the `<thread-index>` argument as a thread ID. Here's an example of it working: ``` michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out (lldb) target create "/home/michristensen/scratch/cpp/threading/a.out" Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64). (lldb) b 18 Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0000000000000850 (lldb) run Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64) This is a thread, i=1 This is a thread, i=2 This is a thread, i=3 This is a thread, i=4 This is a thread, i=5 Process 215715 stopped * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select 2 * thread #2, name = 'a.out' frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x7ffff68f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x7ffff68f991e <+78>: ja 0x7ffff68f9952 ; <+130> 0x7ffff68f9920 <+80>: movl %edx, %edi 0x7ffff68f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread info thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread list Process 215715 stopped thread #1: tid = 215715, 0x0000555555400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1 * thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #3: tid = 216048, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #4: tid = 216049, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #5: tid = 216050, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' thread #6: tid = 216051, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out' (lldb) thread select 215715 error: invalid thread #215715. (lldb) thread select -t 215715 * thread #1, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12 15 for (int i = 0; i < 5; i++) { 16 pthread_create(&thread_ids[i], NULL, foo, NULL); 17 } -> 18 for (int i = 0; i < 5; i++) { 19 pthread_join(thread_ids[i], NULL); 20 } 21 return 0; (lldb) thread select -t 216051 * thread #6, name = 'a.out' frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x7ffff68f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x7ffff68f991e <+78>: ja 0x7ffff68f9952 ; <+130> 0x7ffff68f9920 <+80>: movl %edx, %edi 0x7ffff68f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select 3 * thread #3, name = 'a.out' frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x7ffff68f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x7ffff68f991e <+78>: ja 0x7ffff68f9952 ; <+130> 0x7ffff68f9920 <+80>: movl %edx, %edi 0x7ffff68f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select -t 216048 * thread #3, name = 'a.out' frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x7ffff68f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x7ffff68f991e <+78>: ja 0x7ffff68f9952 ; <+130> 0x7ffff68f9920 <+80>: movl %edx, %edi 0x7ffff68f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) thread select --thread_id 216048 * thread #3, name = 'a.out' frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72 libc.so.6`__nanosleep: -> 0x7ffff68f9918 <+72>: cmpq $-0x1000, %rax ; imm = 0xF000 0x7ffff68f991e <+78>: ja 0x7ffff68f9952 ; <+130> 0x7ffff68f9920 <+80>: movl %edx, %edi 0x7ffff68f9922 <+82>: movl %eax, 0xc(%rsp) (lldb) help thread select Change the currently selected thread. Syntax: thread select <cmd-options> <thread-index> Command Options Usage: thread select [-t] <thread-index> -t ( --thread_id ) Provide a thread ID instead of a thread index. This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. (lldb) c Process 215715 resuming Process 215715 exited with status = 0 (0x00000000) ```
2023-12-09[ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (#74916)Kazu Hirata1-1/+1
This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them.
2023-07-06Refine the reporting mechanism for interruption.Jim Ingham1-1/+1
Also, make it possible for new Targets which haven't been added to the TargetList yet to check for interruption, and add a few more places in building modules where we can check for interruption. Differential Revision: https://reviews.llvm.org/D154542
2023-07-06[lldb] Fix crash when completing register names after program exitDavid Spickett1-0/+3
Previously the following would crash: (lldb) run Process 2594053 launched: '/tmp/test.o' (aarch64) Process 2594053 exited with status = 0 (0x00000000) (lldb) register read <tab> As the completer assumed that the execution context would always have a register context. After a program has finished, it does not. Split out the generic parts of the test from the x86 specific tests, and added "register info" to both. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D154413
2023-07-03[lldb][NFCI] Target::StopHook::GetDescription should take a Stream ref ↵Alex Langford1-1/+1
instead of pointer We always assume that this is valid anyway, might as well take a reference. Differential Revision: https://reviews.llvm.org/D153917
2023-06-06[lldb/Commands] Fix disk completion from root directoryMed Ismail Bennani1-3/+7
This patch should fix path completion starting from the root directory. To do so, this patch adds a special case when setting the search directory when the completion buffer points to the root directory. Differential Revision: https://reviews.llvm.org/D152013 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-06-06[lldb/Commands] Add support to auto-completion for user commandsMed Ismail Bennani1-27/+31
This patch should allow the user to set specific auto-completion type for their custom commands. To do so, we had to hoist the `CompletionType` enum so the user can access it and add a new completion type flag to the CommandScriptAdd Command Object. So now, the user can specify which completion type will be used with their custom command, when they register it. This also makes the `crashlog` custom commands use disk-file completion type, to browse through the user file system and load the report. Differential Revision: https://reviews.llvm.org/D152011 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-05-11We can't let GetStackFrameCount get interrupted or it will give theJim Ingham1-0/+4
wrong answer. Plus, it's useful in some places to have a way to force the full stack to be created even in the face of interruption. Moreover, most of the time when you're just getting frames, you don't need to know the number of frames in the stack to start with. You just keep calling Thread::GetStackFrameAtIndex(index++) and when you get a null StackFrameSP back, you're done. That's also more amenable to interruption if you are doing some work frame by frame. So this patch makes GetStackFrameCount always return the full count, suspending interruption. I also went through all the places that use GetStackFrameCount to make sure that they really needed the full stack walk. In many cases, they did not. For instance frame select -r 10 was getting the number of frames just to check whether cur_frame_idx + 10 was within the stack. It's better in that case to see if that frame exists first, since that doesn't force a full stack walk, and only deal with walking off the end of the stack if it doesn't... I also added a test for some of these behaviors. Differential Revision: https://reviews.llvm.org/D150236
2023-05-05Re-land "[lldb] Expose a const iterator for SymbolContextList"Alex Langford1-11/+8
Re-lands 04aa943be8ed5c03092e2a90112ac638360ec253 with modifications to fix tests. I originally reverted this because it caused a test to fail on Linux. The problem was that I inverted a condition on accident.
2023-05-04[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)Jonas Devlieghere1-1/+1
There's no reason for FileSpecList to live in lldb/Core while FileSpec lives in lldb/Utility. Move FileSpecList next to FileSpec.
2023-05-04Revert "[lldb] Expose a const iterator for SymbolContextList"Alex Langford1-8/+11
This reverts commit 04aa943be8ed5c03092e2a90112ac638360ec253. This broke the debian buildbot and I'm not sure why. Reverting so I can investigate.
2023-05-04[lldb] Expose a const iterator for SymbolContextListAlex Langford1-11/+8
There are many situations where we'll iterate over a SymbolContextList with the pattern: ``` SymbolContextList sc_list; // Fill in sc_list here for (auto i = 0; i < sc_list.GetSize(); i++) { SymbolContext sc; sc_list.GetSymbolAtContext(i, sc); // Do work with sc } ``` Adding an iterator to iterate over the instances directly means we don't have to do bounds checking or create a copy of every element of the SymbolContextList. Differential Revision: https://reviews.llvm.org/D149900
2022-01-23[Commands] Remove redundant member initialization (NFC)Kazu Hirata1-1/+1
Identified with readability-redundant-member-init.
2021-12-26Remove redundant string initialization (NFC)Kazu Hirata1-1/+1
Identified with readability-redundant-string-init.
2021-10-18Add a "command container" hierarchy to allow users to add container nodes.Jim Ingham1-0/+59
The point is to allow users with a related set of script based commands to organize their commands in a hierarchy in the command set, rather than having to have only top-level commands. Differential Revision: https://reviews.llvm.org/D110298
2021-08-05[lldb] Use a struct to pass function search options to Module::FindFunctionJonas Devlieghere1-4/+4
Rather than passing two booleans around, which is especially error prone with them being next to each other, use a struct with named fields instead. Differential revision: https://reviews.llvm.org/D107295
2021-07-20[lldb] Make WatchpointList iterableMichał Górny1-3/+1
Based on de448c0a9e5088979526e2e67152fe547ae4ccf0. Differential Revision: https://reviews.llvm.org/D106263
2021-07-08PR51018: Remove explicit conversions from SmallString to StringRef to ↵David Blaikie1-1/+1
future-proof against C++23 C++23 will make these conversions ambiguous - so fix them to make the codebase forward-compatible with C++23 (& a follow-up change I've made will make this ambiguous/invalid even in <C++23 so we don't regress this & it generally improves the code anyway)
2020-08-24[lldb] type category name common completionGongyu Deng1-1/+15
1. Added a new common completion TypeCategoryNames to provide a list of category names for completion; 2. Applied the completion to these commands: type category delete/enable/disable/list/define; 3. Added a related test case; 4. Bound the completion to the arguments of the type 'eArgTypeName'. Reviewed By: teemperor, JDevlieghere Differential Revision: https://reviews.llvm.org/D84124
2020-08-24[lldb] Remote disk file/directory completion for platform commandsGongyu Deng1-0/+20
1. Extended the gdb-remote communication related classes with disk file/directory completion functions; 2. Added two common completion functions RemoteDiskFiles and RemoteDiskDirectories based on the functions above; 3. Added completion for these commands: A. platform get-file <remote-file> <local-file>; B. platform put-file <local-file> <remote-file>; C. platform get-size <remote-file>; D. platform settings -w <remote-dir>; E. platform open file <remote-file>. 4. Added related tests for client and server; 5. Updated docs/lldb-platform-packets.txt. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D85284
2020-08-24[lldb] common completion for process pids and process namesGongyu Deng1-0/+29
1. Added two common completions: `ProcessIDs` and `ProcessNames`, which are refactored from their original dedicated option completions; 2. Removed the dedicated option completion functions of `process attach` and `platform process attach`, so that they can use arg-type-bound common completions instead; 3. Bound `eArgTypePid` to the pid completion, `eArgTypeProcessName` to the process name completion in `CommandObject.cpp`; 4. Added a related test case. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D80700
2020-08-20[lldb] tab completion for breakpoint namesGongyu Deng1-1/+15
1. created a common completion for breakpoint names; 2. bound the breakpoint name common completion with eArgTypeBreakpointName; 3. implemented the dedicated completion for breakpoint read -N. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D80693
2020-08-11[lldb] watchpoint ID common completion for commands `watchpoint ↵Gongyu Deng1-0/+20
delete/enable/disable/modify/ignore` 1. Added a common completion WatchPointIDs to complete with a list of the IDs of the current watchpoints; 2. Applied the completion to these commands: watchpoint delete/enable/disable/modify/ignore; 3. Added a correlated test case. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D84104
2020-08-11[lldb] thread index common completion for commands like `thread ↵Gongyu Deng1-0/+19
select/step-over` 1. Added a common completion completing with a list of the threads of the current process; 2. Apply the common completion above to these commands: thread continue/info/exception/select/step-in/step-inst/step-inst-over/step-out/step-over/step-script​ 3. Correlated test case test_common_completion_thread_index. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D84088
2020-08-11[lldb] stop-hook ID common completion for commands `target stop-hook ↵Gongyu Deng1-0/+22
enable/disable/delete' 1. Added a common completion StopHookIDs to provide completion with a list of stop hook ids; 2. Applied the common completion to commands: `target stop-hook delete/enable/disable'; 3. Added an related test case. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D84123
2020-08-11[lldb] tab completion for `target modules load -u`Gongyu Deng1-0/+19
1. Added a common completion ModuleUUIDs to provide a list of the UUIDs of modules for completion; 2. Added a new enumeration item eArgTypeModuleUUID to CommandArgumentType which is set as the option argument type of OptionGroupUUID; 3. Applied the module UUID completion to the argument of the type eArgTypeModuleUUID in lldb/source/Interpreter/CommandObject.cpp; 4. Added an related test case in lldb/test/API/functionalities/completion/TestCompletion.py.
2020-08-11[lldb] move the frame index completion into a common completion and apply it ↵Gongyu Deng1-0/+19
to `thread backtrace -s` Commands frame select and thread backtrace -s can be completed in the same way. Moved the dedicated completion of frame select into a common completion and apply it to the both commands, along with the test modified.
2020-08-11[lldb] type language common completionGongyu Deng1-0/+12
1. Added a new common completion TypeLanguages to provide a list of supporting languages; 2. Bound the completion to eArgTypeLanguage; 3. Added a related test case.
2020-08-11[lldb] tab completion for `disassemble -F`Gongyu Deng1-1/+13
1.Added a new common completion DisassemblyFlavors; 2. Bound DisassemblyFlavors to argument of type eArgTypeDisassemblyFlavor in CommandObject.cpp; 3. Added a related test case.
2020-06-02[lldb] NFC remove DISALLOW_COPY_AND_ASSIGNKonrad Kleine1-4/+8
Summary: This is how I applied my clang-tidy check (see https://reviews.llvm.org/D80531) in order to remove `DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted assignment operators instead. ``` lang=bash grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files for i in $(cat files); do clang-tidy \ --checks="-*,modernize-replace-disallow-copy-and-assign-macro" \ --format-style=LLVM \ --header-filter=.* \ --fix \ -fix-errors \ $i; done ``` Reviewers: espindola, labath, aprantl, teemperor Reviewed By: labath, aprantl, teemperor Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D80543
2020-05-27[lldb] Tab completion for process plugin nameGongyu Deng1-0/+8
Summary: 1. Added tab completion to `process launch -p`, `process attach -P`, `process connect -p`; 2. Bound the plugin name common completion as the default completion for `eArgTypePlugin` arguments. Reviewers: teemperor, JDevlieghere Tags: #lldb Differential Revision: https://reviews.llvm.org/D79929
2020-05-11Complete breakpoint enable/disable/delete/modify with a list of breakpoint IDsGongyu Deng1-1/+33
Summary: 1. A new common completion `CommandCompletions::Breakpoints` to provide a list of the breakpoints of the current context; 2. Apply the completion above to the commands breakpoint enable/disable/delete/modify; 3. Unit test. Reviewers: teemperor, JDevlieghere Reviewed By: teemperor Tags: #lldb Differential Revision: https://reviews.llvm.org/D79666
2020-05-07tab completion for register read/writeGongyu Deng1-0/+19
Summary: 1. Created a new common completion for the registers of the current context; 2. Apply this new common completion to the commands register read/write; 3. Unit test. Reviewers: teemperor, JDevlieghere Reviewed By: teemperor Tags: #lldb Differential Revision: https://reviews.llvm.org/D79490
2020-02-12[lldb][NFC] Move common_completions mapping out of CommandCompletions header.Raphael Isemann1-17/+29
2020-02-12[lldb][NFC] Move all completer subclasses into source fileRaphael Isemann1-160/+202
They are all implementation details so let's keep them out of the interface. Also makes this code more readable by keeping these small classes not spread over header and source file.
2020-02-12[lldb][NFC] Remove eCustomCompletion modeRaphael Isemann1-4/+0
It's not used by anyone. Also if something implements its own completion it could just not call the method instead of having a parameter that makes the function a no-op.
2020-02-11[lldb][NFC] Remove support file searching from SourceFileCompleterRaphael Isemann1-43/+19
This code seems wrong as the directory variable actually contains the file name. It's also unreachable code as m_include_support_files is hardcoded to false which is the condition for the surrounding 'if statement'. Let's just remove all of this.
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer1-2/+2
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann1-1/+1
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2019-12-16[lldb][NFC] Remove unnecessary includes in source/CommandsRaphael Isemann1-8/+0
Summary: This removes most of unnecessary includes in the `source/Commands` directory. This was generated by IWYU and a script that fixed all the bogus reports from IWYU. Patch is tested on Linux and macOS. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: krytarowski, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71489
2019-11-29[lldb][NFC] Simplify regex_chars in CommandCompletionsRaphael Isemann1-4/+1
2019-11-29[lldb] Remove FileSpec->CompileUnit inheritancePavel Labath1-3/+5
Summary: CompileUnit is a complicated class. Having it be implicitly convertible to a FileSpec makes reasoning about it even harder. This patch replaces the inheritance by a simple member and an accessor function. This avoid the need for casting in places where one needed to force a CompileUnit to be treated as a FileSpec, and does not add much verbosity elsewhere. It also fixes a bug where we were wrongly comparing CompileUnit& and a CompileUnit*, which compiled due to a combination of this inheritance and the FileSpec*->FileSpec implicit constructor. Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70827