aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectPlatform.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-05-02[LLDB][NFC] Remove unneeded conditional (#138321)satyajanga1-68/+65
we already check for `platform_sp` not null in one line below. existing code ``` if (platform_sp) { Status error; if (platform_sp) { ... ... } } ``` `platform_sp` null check is redundant and error variable is unused. ### TEST PLAN manual test ``` satyajanga@devvm21837:toolchain $ ./bin/lldb LLDB logging initialized. Logs stored in: /tmp (lldb) platform select host Platform: host Triple: x86_64-*-linux-gnu OS Version: 6.9.0 (6.9.0-0_fbk5_hardened_1_gf368ae920c1a) Hostname: 127.0.0.1 WorkingDir: /home/satyajanga/llvm-sand/build/Debug/fbcode-x86_64/toolchain Kernel: #1 SMP Tue Feb 11 07:24:41 PST 2025 Kernel: Linux Release: 6.9.0-0_fbk5_hardened_1_gf368ae920c1a Version: #1 SMP Tue Feb 11 07:24:41 PST 2025 (lldb) platform process list 144 matching processes were found on "host" PID PARENT USER TRIPLE NAME ====== ====== ========== ============================== ============================ 130461 874915 satyajanga x86_64-*-linux-gnu sushd 135505 874915 satyajanga x86_64-*-linux-gnu hg.real 817146 874915 satyajanga x86_64-*-linux-gnu vscode-thrift 874915 1 satyajanga 874947 874915 satyajanga ``` and running the existing tests ``` satyajanga@devvm21837:toolchain $ ./bin/llvm-lit -v ~/llvm-sand/external/llvm-project/lldb/test/API/commands/platform/ -- Testing: 9 tests, 9 workers -- PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (1 of 9) PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (2 of 9) UNSUPPORTED: lldb-api :: commands/platform/sdk/TestPlatformSDK.py (3 of 9) PASS: lldb-api :: commands/platform/basic/TestPlatformPython.py (4 of 9) PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (5 of 9) PASS: lldb-api :: commands/platform/connect/TestPlatformConnect.py (6 of 9) PASS: lldb-api :: commands/platform/process/launch/TestPlatformProcessLaunch.py (7 of 9) PASS: lldb-api :: commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py (8 of 9) PASS: lldb-api :: commands/platform/process/list/TestProcessList.py (9 of 9) Testing Time: 13.48s Total Discovered Tests: 9 Unsupported: 1 (11.11%) Passed : 8 (88.89%) satyajanga@devvm21837:toolchain $ ```
2024-08-27[lldb] Turn lldb_private::Status into a value type. (#106163)Adrian Prantl1-22/+22
This patch removes all of the Set.* methods from Status. This cleanup is part of a series of patches that make it harder use the anti-pattern of keeping a long-lives Status object around and updating it while dropping any errors it contains on the floor. This patch is largely NFC, the more interesting next steps this enables is to: 1. remove Status.Clear() 2. assert that Status::operator=() never overwrites an error 3. remove Status::operator=() Note that step (2) will bring 90% of the benefits for users, and step (3) will dramatically clean up the error handling code in various places. In the end my goal is to convert all APIs that are of the form ` ResultTy DoFoo(Status& error) ` to ` llvm::Expected<ResultTy> DoFoo() ` How to read this patch? The interesting changes are in Status.h and Status.cpp, all other changes are mostly ` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git grep -l SetErrorString lldb/source) ` plus the occasional manual cleanup.
2024-02-27Start to clean up the process of defining command arguments. (#83097)jimingham1-67/+13
Partly, there's just a lot of unnecessary boiler plate. It's also possible to define combinations of arguments that make no sense (e.g. eArgRepeatPlus followed by eArgRepeatPlain...) but these are never checked since we just push_back directly into the argument definitions. This commit is step 1 of this cleanup - do the obvious stuff. In it, all the simple homogenous argument lists and the breakpoint/watchpoint ID/Range types, are set with common functions. This is an NFC change, it just centralizes boiler plate. There's no checking yet because you can't get a single argument wrong. The end goal is that all argument definition goes through functions and m_arguments is hidden so that you can't define inconsistent argument sets.
2024-02-20Add the RegisterCompleter to eArgTypeRegisterName in g_argument_table (#82428)jimingham1-57/+18
This is a follow-on to: https://github.com/llvm/llvm-project/pull/82085 The completer for register names was missing from the argument table. I somehow missed that the only register completer test was x86_64, so that test broke. I added the completer in to the right slot in the argument table, and added a small completions test that just uses the alias register names. If we end up having a platform that doesn't define register names, we'll have to skip this test there, but it should add a sniff test for register completion that will run most everywhere.
2024-02-19Revert "Centralize the handling of completion for simple argument lists. ↵Shubham Sandeep Rastogi1-18/+57
(#82085)" This reverts commit 21631494b068d9364b8dc8f18e59adee9131a0a5. Reverted because of greendragon failure: ******************** TEST 'lldb-api :: functionalities/completion/TestCompletion.py' FAILED ******************** Script:
2024-02-19Centralize the handling of completion for simple argument lists. (#82085)jimingham1-57/+18
Most commands were adding argument completion handling by themselves, resulting in a lot of unnecessary boilerplate. In many cases, this could be done generically given the argument definition and the entries in the g_argument_table. I'm going to address this in a couple passes. In this first pass, I added handling of commands that have only one argument list, with one argument type, either single or repeated, and changed all the commands that are of this sort (and don't have other bits of business in their completers.) I also added some missing connections between arg types and completions to the table, and added a RemoteFilename and RemotePath to use in places where we were using the Remote completers. Those arguments used to say they were "files" but they were in fact remote files. I also added a module arg type to use where we were using the module completer. In that case, we should call the argument module.
2023-10-30[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` return `void` ↵Pete Lawrence1-62/+40
(not `bool`) (#69991) [lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` to return `void` instead of ~~`bool`~~ Justifications: - The code doesn't ultimately apply the `true`/`false` return values. - The methods already pass around a `CommandReturnObject`, typically with a `result` parameter. - Each command return object already contains: - A more precise status - The error code(s) that apply to that status Part 1 refactors the `CommandObject::Execute(...)` method. - See [https://github.com/llvm/llvm-project/pull/69989](https://github.com/llvm/llvm-project/pull/69989) rdar://117378957
2023-06-29Reland "[LLDB] Fix the use of "platform process launch" with no extra arguments"David Spickett1-4/+6
This reverts commit 3254623d73fb7252385817d8057640c9d5d5ffd1. One test has been updated to add the "-s" flag which along with 86fd957af981f146a306831608d7ad2de65b9560 should fix the tests on MacOS. An assert on hijack listener added in that patch was removed, it seems to be correct on MacOS but not on Linux.
2023-06-27[lldb] Duplicate Target::Launch resuming logic into ↵Dave Lee1-5/+56
CommandObjectPlatformProcessLaunch Fix `platform process launch` on macOS where it fails for lack of auto-resuming support. This change reproduces the resuming logic found in `Target::Launch`. This issue was identified by @DavidSpickett in D153636. This change relies on the tests added in that PR. Thanks David. Differential Revision: https://reviews.llvm.org/D153922
2023-06-27Revert "[LLDB] Fix the use of "platform process launch" with no extra arguments"David Spickett1-6/+2
This reverts commit cc0fc358540517a3d205243c27bd543afeae2b02 due to a failure reported on MacOS.
2023-06-27[LLDB] Fix the use of "platform process launch" with no extra argumentsDavid Spickett1-2/+6
This fixes #62068. After 8d1de7b34af46a089eb5433c700419ad9b2923ee the following issue appeared: ``` $ ./bin/lldb /tmp/test.o (lldb) target create "/tmp/test.o" Current executable set to '/tmp/test.o' (aarch64). (lldb) platform process launch -s error: Cannot launch '': Nothing to launch ``` Previously would call target->GetRunArguments when there were no extra arguments, so we could find out what target.run-args might be. Once that change started relying on the first arg being the exe, the fact that that call clears the existing argument list caused the bug. Instead, have it set a local arg list and append that to the existing one. Which in this case will just contain the exe name. Since there's no existing tests for this command I've added a new file that covers enough to check this issue. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D153636
2023-06-06[lldb/Commands] Add support to auto-completion for user commandsMed Ismail Bennani1-34/+29
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-03-06[lldb/Utility] Fix layering violation caused by ScriptedMetadataMed Ismail Bennani1-1/+1
This patch moves `ScriptedMetadata.h` from the `Interpreter` directory to the `Utility` sub-directory since `ProcessInfo.h` depends on it. It also gets rid of the unused `OptionGroupPythonClassWithDict` constructor for `ScriptedMetadata` which would address the layering violation. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-03[lldb/Plugins] Add Attach capabilities to ScriptedProcessMed Ismail Bennani1-8/+6
This patch adds process attach capabilities to the ScriptedProcess plugin. This doesn't really expects a PID or process name, since the process state is already script, however, this allows to create a scripted process without requiring to have an executuble in the target. In order to do so, this patch also turns the scripted process related getters and setters from the `ProcessLaunchInfo` and `ProcessAttachInfo` classes to a `ScriptedMetadata` instance and moves it in the `ProcessInfo` class, so it can be accessed interchangeably. This also adds the necessary SWIG wrappers to convert the internal `Process{Attach,Launch}InfoSP` into a `SB{Attach,Launch}Info` to pass it as argument the scripted process python implementation and convert it back to the internal representation. rdar://104577406 Differential Revision: https://reviews.llvm.org/D143104 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-03[lldb] Add scripted process launch/attach option to {,platform }process commandsMed Ismail Bennani1-65/+37
This patch does several things: First, it refactors the `CommandObject{,Platform}ProcessObject` command option class into a separate `CommandOptionsProcessAttach` option group. This will make sure both the `platform process attach` and `process attach` command options will always stay in sync without having with duplicate them each time. But more importantly, making this class an `OptionGroup` allows us to combine with a `OptionGroupPythonClassWithDict` to add support for the scripted process managing class name and user-provided dictionary options. This patch also improves feature parity between `ProcessLaunchInfo` and `ProcessAttachInfo` with regard to ScriptedProcesses, by exposing the various getters and setters necessary to use them through the SBAPI. This is foundation work for adding support to "attach" to a process from the scripted platform. Differential Revision: https://reviews.llvm.org/D139945 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-01-16[LLDB] Fix help text for "platform settings"David Spickett1-2/+1
This claims to take a platform name argument but doesn't. That was probably the intent in fbb7634934d40548b650574a2f2a85ab41527674 but it has only ever worked with the current platform. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D136928
2023-01-13Revert "[lldb] Add Debugger & ScriptedMetadata reference to ↵Med Ismail Bennani1-43/+48
Platform::CreateInstance" This reverts commit 2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.
2023-01-12[lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstanceMed Ismail Bennani1-48/+43
This patch is preparatory work for Scripted Platform support and does multiple things: First, it introduces new options for the `platform select` command and `SBPlatform::Create` API, to hold a reference to the debugger object, the name of the python script managing the Scripted Platform and a structured data dictionary that the user can use to pass arbitrary data. Then, it updates the various `Create` and `GetOrCreate` methods for the `Platform` and `PlatformList` classes to pass down the new parameter to the `Platform::CreateInstance` callbacks. Finally, it updates every callback to reflect these changes. Differential Revision: https://reviews.llvm.org/D139249 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-01-10Move from llvm::makeArrayRef to ArrayRef deduction guides - last partserge-sans-paille1-6/+6
This is a follow-up to https://reviews.llvm.org/D140896, split into several parts as it touches a lot of files. Differential Revision: https://reviews.llvm.org/D141298
2022-12-08[NFC] Fix leak in command options configuration.Jordan Rupprecht1-2/+4
`m_options.Append(new OptionPermissions())` leaks because the pointer passed in is not owned. Use a class member to ensure lifetime, which is the common pattern used for this API. Found by the LLDB command interpreter fuzzer. The fuzz input is running `ap $` twice.
2022-07-14[lldb] Refactor command option enum values (NFC)Jonas Devlieghere1-0/+1
Refactor the command option enum values and the command argument table to connect the two. This has two benefits: - We guarantee that two options that use the same argument type have the same accepted values. - We can print the enum values and their description in the help output. (D129707) Differential revision: https://reviews.llvm.org/D129703
2022-06-27Have CommandObjectParsed check for "commands that take no arguments".Jim Ingham1-79/+108
This is currently being done in an ad hoc way, and so for some commands it isn't being checked. We have the info to make this check, since commands are supposed to add their arguments to the m_arguments field of the CommandObject. This change uses that info to check whether the command received arguments in error. A handful of commands weren't defining their argument types, I also had to fix them. And a bunch of commands were checking for arguments by hand, so I removed those checks in favor of the CommandObject one. That also meant I had to change some tests that were checking for the ad hoc error outputs. Differential Revision: https://reviews.llvm.org/D128453
2022-03-31[LLDB] Applying clang-tidy modernize-use-equals-default over LLDBShafik Yaghmour1-4/+4
Applied modernize-use-equals-default clang-tidy check over LLDB. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121844
2022-03-02[lldb/Platform] Prepare decouple instance and plugin namesPavel Labath1-6/+5
This patch changes the return value of Platform::GetName() to a StringRef, and uses the opportunity (compile errors) to change some callsites to use GetPluginName() instead. The two methods still remain hardwired to return the same thing, but this will change once the ideas in <https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594> are implemented. Differential Revision: https://reviews.llvm.org/D119146
2022-01-23[Commands] Remove redundant member initialization (NFC)Kazu Hirata1-23/+13
Identified with readability-redundant-member-init.
2021-10-26[lldb] Remove ConstString from Platform plugin namesPavel Labath1-6/+4
2021-10-18[lldb] Return StringRef from PluginInterface::GetPluginNamePavel Labath1-16/+13
There is no reason why this function should be returning a ConstString. While modifying these files, I also fixed several instances where GetPluginName and GetPluginNameStatic were returning different strings. I am not changing the return type of GetPluginNameStatic in this patch, as that would necessitate additional changes, and this patch is big enough as it is. Differential Revision: https://reviews.llvm.org/D111877
2021-10-05[lldb] Improve help for platform put-fileKeith Smiley1-1/+12
Previously it was not clear what arguments this required, or what it would do if you didn't pass the destination argument. Differential Revision: https://reviews.llvm.org/D110981
2021-09-16[lldb] Make Platform::DebugProcess take a Target referencePavel Labath1-1/+1
instead of a pointer. There are just two callers of this function, and both of them have a valid target pointer, so there's no need for all implementations to concern themselves with whether the pointer is null.
2021-09-10[lldb] Add new commands and tests for getting file perms & existsMichał Górny1-0/+139
Add two new commands 'platform get-file-permissions' and 'platform file-exists' for the respective bits of LLDB protocol. Add tests for them. Fix error handling in GetFilePermissions(). Differential Revision: https://reviews.llvm.org/D107809
2021-09-08[lldb] [Commands] Remove 'append' from 'platform file open' modeMichał Górny1-2/+1
Remove File::eOpenOptionAppend from the mode used by 'platform file open' command. According to POSIX, O_APPEND causes all successive writes to be done at the end of the file. This effectively makes the offset argument to 'platform file write' meaningless. Furthermore, apparently O_APPEND is not implemented reliably everywhere. The Linux manpage for pwrite(2) suggests that Linux does respect O_APPEND there while according to POSIX it should not, so the actual behavior would be dependent on how the vFile:pwrite packet is implemented on the server. Ideally, the mode used for opening flags would be provided via options. However, changing the default mode seems to be a reasonable intermediate solution. Differential Revision: https://reviews.llvm.org/D107664
2021-09-08[lldb] [Commands] Fix reporting errors in 'platform file read/write'Michał Górny1-7/+15
Fix 'platform file read' and 'platform file write' commands to correctly detect erraneous return and report it as such. Currently, errors were implicitly printed as a return value of -1, and the commands were assumed to be successful. Differential Revision: https://reviews.llvm.org/D107665
2021-08-09[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compatMichał Górny1-2/+2
Modify OpenOptions enum to open the future path into synchronizing vFile:open bits with GDB. Currently, LLDB and GDB use different flag models effectively making it impossible to match bits. Notably, LLDB uses two bits to indicate read and write status, and uses union of both for read/write. GDB uses a value of 0 for read-only, 1 for write-only and 2 for read/write. In order to future-proof the code for the GDB variant: 1. Add a distinct eOpenOptionReadWrite constant to be used instead of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required. 2. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly and eOpenOptionWriteOnly respectively, to make it clear that they do not mean to be combined and require update to all call sites. 3. Use the intersection of all three flags when matching against the three possible values. This commit does not change the actual bits used by LLDB. Differential Revision: https://reviews.llvm.org/D106984
2021-07-02[lldb] Replace default bodies of special member functions with = default;Jonas Devlieghere1-1/+1
Replace default bodies of special member functions with = default; $ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-equals-default' -fix , https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html Differential revision: https://reviews.llvm.org/D104041
2021-06-22[lldb] Remove more redundant SetStatus(eReturnStatusFailed)David Spickett1-8/+4
Mostly by converting uses of GetErrorStream to AppendError, so that the call to SetStatus is implicit. Some remain where it isn't certain that you'll have a message to set, or you want the output to be on stdout. One place in CommandObjectWatchpoint previously didn't set the status to failed at all. However it's pretty obvious that it should do so. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D104697
2021-06-17[lldb] Remove redundant calls to set eReturnStatusFailedDavid Spickett1-48/+0
This is part 2, covering the commands source. Some uses remain where it's tricky to see what the logic is or they are not used with AppendError. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D104448
2021-06-09[lldb] Use C++11 default member initializersJonas Devlieghere1-4/+3
This converts a default constructor's member initializers into C++11 default member initializers. This patch was automatically generated with clang-tidy and the modernize-use-default-member-init check. $ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-default-member-init' -fix This is a mass-refactoring patch and this commit will be added to .git-blame-ignore-revs. Differential revision: https://reviews.llvm.org/D103483
2021-03-23[lldb/Commands] Add command options for ScriptedProcess to ProcessLaunchMed Ismail Bennani1-2/+6
This patch adds a new command options to the CommandObjectProcessLaunch for scripted processes. Among the options, the user need to specify the class name managing the scripted process. The user can also use a key-value dictionary holding arbitrary data that will be passed to the managing class. This patch also adds getters and setters to `SBLaunchInfo` for the class name managing the scripted process and the dictionary. rdar://65508855 Differential Review: https://reviews.llvm.org/D95710 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01[lldb] Revert ScriptedProcess patchesMed Ismail Bennani1-6/+2
This patch reverts the following commits: - 5a9c34918bb1526b7e8c29aa5e4fb8d8e27e27b4 - 46796762afe76496ec4dd900f64d0cf4cdc30e99 - 2cff3dec1171188ce04ab1a4373cc1885ab97be1 - 182f0d1a34419445bb19d67581d6ac1afc98b7fa - d62a53aaf1d38a55d1affbd3a30d564a4e9d3171 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01[lldb/Commands] Add command options for ScriptedProcess to ProcessLaunchMed Ismail Bennani1-2/+6
This patch adds a new command options to the CommandObjectProcessLaunch for scripted processes. Among the options, the user need to specify the class name managing the scripted process. The user can also use a key-value dictionary holding arbitrary data that will be passed to the managing class. This patch also adds getters and setters to `SBLaunchInfo` for the class name managing the scripted process and the dictionary. rdar://65508855 Differential Review: https://reviews.llvm.org/D95710 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-01-20[lldb/Commands] Refactor ProcessLaunchCommandOptions to use TableGen (NFC)Med Ismail Bennani1-1/+2
This patch refactors the current implementation of `ProcessLaunchCommandOptions` to be generated by TableGen. The patch also renames the class to `CommandOptionsProcessLaunch` to align better with the rest of the codebase style and moves it to separate files. Differential Review: https://reviews.llvm.org/D95059 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-09-02[lldb/Target] Add custom interpreter option to `platform shell`Med Ismail Bennani1-2/+16
This patch adds the ability to use a custom interpreter with the `platform shell` command. If the user set the `-s|--shell` option with the path to a binary, lldb passes it down to the platform's `RunShellProcess` method and set it as the shell to use in `ProcessLaunchInfo to run commands. Note that not all the Platforms support running shell commands with custom interpreters (i.e. RemoteGDBServer is only expected to use the default shell). This patch also makes some refactoring and cleanups, like swapping CString for StringRef when possible and updating `SBPlatformShellCommand` with new methods and a new constructor. rdar://67759256 Differential Revision: https://reviews.llvm.org/D86667 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-08-24[lldb] Remote disk file/directory completion for platform commandsGongyu Deng1-1/+48
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-40/+8
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-10[lldb] tab completion for `platform target-install`Gongyu Deng1-0/+10
1. Applied the common completion `eDiskFileCompletion` to the first argument of the command `platform target-install`. 2. Added a related test case. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D84179
2020-07-01[lldb] Replace StringConvert with llvm::to_integer when parsing integer ↵Raphael Isemann1-7/+21
values in CommandObjects Summary: This replaces the current use of LLDB's own `StringConvert` with LLVM's `to_integer` which has a less error-prone API and doesn't use special 'error values' to designate parsing problems. Where needed I also added missing error handling code that prints a parsing error instead of continuing with the error value returned from `StringConvert` (which either gave a cryptic error message or just took the error value performed an incorrect action with it. For example, `frame recognizer delete -1` just deleted the frame recognizer at index 0). Reviewers: #lldb, labath Reviewed By: labath Subscribers: labath, abidh, JDevlieghere Differential Revision: https://reviews.llvm.org/D82297
2020-06-15[lldb] Remove redundant access specifiers (NFC)Jonas Devlieghere1-2/+0
2020-06-02[lldb] NFC remove DISALLOW_COPY_AND_ASSIGNKonrad Kleine1-3/+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-15[lldb/Commands] Add ability to run shell command on the host.Med Ismail Bennani1-5/+21
This patch introduces the `(-h|--host)` option to the `platform shell` command. It allows the user to run shell commands from the host platform (always available) without putting lldb in the background. Since the default behaviour of `platform shell` is to run the command of the selected platform, having such a choice can be quite handy when debugging remote targets, for instances. This patch also introduces a `shell` alias, to improve the command discoverability and make it more convenient to use for the user. rdar://62856024 Differential Revision: https://reviews.llvm.org/D79659 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-03-12[lldb/Utility] Replace ProcessInstanceInfoList with std::vector. (NFCI)Jonas Devlieghere1-3/+3
Replace ProcessInstanceInfoList with std::vector<ProcessInstanceInfo> and update the call sites.