aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectDisassemble.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-28Stateful variable-location annotations in Disassembler::PrintInstructions() ↵Abdullah Mohammad Amin1-0/+8
(follow-up to #147460) (#152887) **Context** Follow-up to [#147460](https://github.com/llvm/llvm-project/pull/147460), which added the ability to surface register-resident variable locations. This PR moves the annotation logic out of `Instruction::Dump()` and into `Disassembler::PrintInstructions()`, and adds lightweight state tracking so we only print changes at range starts and when variables go out of scope. --- ## What this does While iterating the instructions for a function, we maintain a “live variable map” keyed by `lldb::user_id_t` (the `Variable`’s ID) to remember each variable’s last emitted location string. For each instruction: - **New (or newly visible) variable** → print `name = <location>` once at the start of its DWARF location range, cache it. - **Location changed** (e.g., DWARF range switched to a different register/const) → print the updated mapping. - **Out of scope** (was tracked previously but not found for the current PC) → print `name = <undef>` and drop it. This produces **concise, stateful annotations** that highlight variable lifetime transitions without spamming every line. --- ## Why in `PrintInstructions()`? - Keeps `Instruction` stateless and avoids changing the `Instruction::Dump()` virtual API. - Makes it straightforward to diff state across instructions (`prev → current`) inside the single driver loop. --- ## How it works (high-level) 1. For the current PC, get in-scope variables via `StackFrame::GetInScopeVariableList(/*get_parent=*/true)`. 2. For each `Variable`, query `DWARFExpressionList::GetExpressionEntryAtAddress(func_load_addr, current_pc)` (added in #144238). 3. If the entry exists, call `DumpLocation(..., eDescriptionLevelBrief, abi)` to get a short, ABI-aware location string (e.g., `DW_OP_reg3 RBX → RBX`). 4. Compare against the last emitted location in the live map: - If not present → emit `name = <location>` and record it. - If different → emit updated mapping and record it. 5. After processing current in-scope variables, compute the set difference vs. the previous map and emit `name = <undef>` for any that disappeared. Internally: - We respect file↔load address translation already provided by `DWARFExpressionList`. - We reuse the ABI to map LLVM register numbers to arch register names. --- ## Example output (x86_64, simplified) ``` -> 0x55c6f5f6a140 <+0>: cmpl $0x2, %edi ; argc = RDI, argv = RSI 0x55c6f5f6a143 <+3>: jl 0x55c6f5f6a176 ; <+54> at d_original_example.c:6:3 0x55c6f5f6a145 <+5>: pushq %r15 0x55c6f5f6a147 <+7>: pushq %r14 0x55c6f5f6a149 <+9>: pushq %rbx 0x55c6f5f6a14a <+10>: movq %rsi, %rbx 0x55c6f5f6a14d <+13>: movl %edi, %r14d 0x55c6f5f6a150 <+16>: movl $0x1, %r15d ; argc = R14 0x55c6f5f6a156 <+22>: nopw %cs:(%rax,%rax) ; i = R15, argv = RBX 0x55c6f5f6a160 <+32>: movq (%rbx,%r15,8), %rdi 0x55c6f5f6a164 <+36>: callq 0x55c6f5f6a030 ; symbol stub for: puts 0x55c6f5f6a169 <+41>: incq %r15 0x55c6f5f6a16c <+44>: cmpq %r15, %r14 0x55c6f5f6a16f <+47>: jne 0x55c6f5f6a160 ; <+32> at d_original_example.c:5:10 0x55c6f5f6a171 <+49>: popq %rbx ; i = <undef> 0x55c6f5f6a172 <+50>: popq %r14 ; argv = RSI 0x55c6f5f6a174 <+52>: popq %r15 ; argc = RDI 0x55c6f5f6a176 <+54>: xorl %eax, %eax 0x55c6f5f6a178 <+56>: retq ``` Only transitions are shown: the start of a location, changes, and end-of-lifetime. --- ## Scope & limitations (by design) - Handles **simple locations** first (registers, const-in-register cases surfaced by `DumpLocation`). - **Memory/composite locations** are out of scope for this PR. - Annotations appear **only at range boundaries** (start/change/end) to minimize noise. - Output is **target-independent**; register names come from the target ABI. ## Implementation notes - All annotation printing now happens in `Disassembler::PrintInstructions()`. - Uses `std::unordered_map<lldb::user_id_t, std::string>` as the live map. - No persistent state across calls; the map is rebuilt while walking instruction by instruction. - **No changes** to the `Instruction` interface. --- ## Requested feedback - Placement and wording of the `<undef>` marker. - Whether we should optionally gate this behind a setting (currently always on when disassembling with an `ExecutionContext`). - Preference for immediate inclusion of tests vs. follow-up patch. --- Thanks for reviewing! Happy to adjust behavior/format based on feedback. --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com> Co-authored-by: Adrian Prantl <adrian.prantl@gmail.com>
2025-08-26[lldb] Underline short option letters as mnemonics (#153695)Jonas Devlieghere1-1/+2
Whenever an option would use something other than the first letter of the long option as the short option, Jim would capitalized the letter we picked as a mnemonic. This has often been mistaken for a typo and Jim wondered if we should stop doing this. During the discussion, David mentioned how this reminds him of the underline in menu bars when holding down alt. I suggested we do something similar in LLDB by underlying the letter in the description. https://discourse.llvm.org/t/should-we-remove-the-capital-letter-in-option-helps/87816
2025-05-30[lldb][lldb-dap] Use the default disassembly flavour if none is provided. ↵Ebuka Ezike1-1/+0
(#141424) This is the currently the default for `SBTarget::ReadInstructions(SBAddress, uint32_t)`. But not for others, to make it consistent used the user assigned instruction flavour.
2025-04-27[lldb][lldb-dap] Respect x86 disassembly flavor setting (#134722)Ebuka Ezike1-0/+1
Ensure the disassembly respects the "target.x86-disassembly-flavor" setting for x86 and x86_64 targets. Depends on #134626 --------- Signed-off-by: Ebuka Ezike <yerimyah1@gmail.com> Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-02-12[lldb] Support disassembling discontinuous functions (#126505)Pavel Labath1-44/+50
The command already supported disassembling multiple ranges, among other reasons because inline functions can be discontinuous. The main thing that was missing was being able to retrieve the function ranges from the top level function object. The output of the command for the case where the function entry point is not its lowest address is somewhat confusing (we're showing negative offsets), but it is correct.
2025-01-14[lldb][NFC] Make the target's SectionLoadList private. (#113278)Greg Clayton1-3/+3
Lots of code around LLDB was directly accessing the target's section load list. This NFC patch makes the section load list private so the Target class can access it, but everyone else now uses accessor functions. This allows us to control the resolving of addresses and will allow for functionality in LLDB which can lazily resolve addresses in JIT plug-ins with a future patch.
2024-11-11[lldb] Support overriding the disassembly CPU & features (#115382)Jonas Devlieghere1-10/+28
Add the ability to override the disassembly CPU and CPU features through a target setting (`target.disassembly-cpu` and `target.disassembly-features`) and a `disassemble` command option (`--cpu` and `--features`). This is especially relevant for architectures like RISC-V which relies heavily on CPU extensions. The majority of this patch is plumbing the options through. I recommend looking at DisassemblerLLVMC and the test for the observable change in behavior.
2024-08-27[lldb] Turn lldb_private::Status into a value type. (#106163)Adrian Prantl1-5/+6
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-07-31[lldb] Use Target references instead of pointers in CommandObject (NFC)Jonas Devlieghere1-3/+3
The GetTarget helper returns a Target reference so there's reason to convert it to a pointer and check its validity.
2024-07-31[lldb] Unify the way we get the Target in CommandObject (#101208)Jonas Devlieghere1-5/+5
Currently, CommandObjects are obtaining a target in a variety of ways. Often the command incorrectly operates on the selected target. As an example, when a breakpoint command is running, the current target is passed into the command but the target that hit the breakpoint is not the selected target. In other places we use the CommandObject's execution context, which is frozen during the execution of the command, and comes with its own limitations. Finally, we often want to fall back to the dummy target if no real target is available. Instead of having to guess how to get the target, this patch introduces one helper function in CommandObject to get the most relevant target. In order of priority, that's the target from the command object's execution context, from the interpreter's execution context, the selected target or the dummy target. rdar://110846511
2023-10-30[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` return `void` ↵Pete Lawrence1-7/+5
(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-01-10Move from llvm::makeArrayRef to ArrayRef deduction guides - last partserge-sans-paille1-1/+1
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-07-24[lldb] Remove redundant member initialization (NFC)Kazu Hirata1-2/+1
Identified with readability-redundant-member-init.
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-07-12[trace] Add a flag to the decoder to output the instruction typeWalter Erquinigo1-0/+8
To build complex binding upon instruction trace, additional metadata 'instruction type' is needed. This diff has followings: - Add a flag -k / --kind for instruction dump - Remove SetGranularity and SetIgnoreErros from Trace cursor Sample output: ``` (lldb) thread trace dump instruction -k thread #1: tid = 3198805 libc.so.6`_IO_puts + 356 2107: 0x00007ffff7163594 ( return) retq 2106: 0x00007ffff7163592 ( other) popq %r13 2105: 0x00007ffff7163590 ( other) popq %r12 2104: 0x00007ffff716358f ( other) popq %rbp 2103: 0x00007ffff716358e ( other) popq %rbx 2102: 0x00007ffff716358c ( other) movl %ebx, %eax 2101: 0x00007ffff7163588 ( other) addq $0x8, %rsp 2100: 0x00007ffff7163570 ( cond jump) je 0x89588 ; <+344> 2099: 0x00007ffff716356e ( other) decl (%rdx) 2098: 0x00007ffff7163565 ( cond jump) je 0x8956e ; <+318> 2097: 0x00007ffff716355e ( other) cmpl $0x0, 0x33c02b(%rip) ; __libc_multiple_threads 2096: 0x00007ffff7163556 ( other) movq $0x0, 0x8(%rdx) 2095: 0x00007ffff7163554 ( cond jump) jne 0x89588 ; <+344> 2094: 0x00007ffff7163550 ( other) subl $0x1, 0x4(%rdx) 2093: 0x00007ffff7163549 ( other) movq 0x88(%rbp), %rdx 2092: 0x00007ffff7163547 ( cond jump) jne 0x89588 ; <+344> 2091: 0x00007ffff7163540 ( other) testl $0x8000, (%rbp) ; imm = 0x8000 2090: 0x00007ffff716353c ( other) cmovaq %rax, %rbx 2089: 0x00007ffff7163535 ( other) cmpq $0x7fffffff, %rbx ; imm = 0x7FFFFFFF 2088: 0x00007ffff7163530 ( other) movl $0x7fffffff, %eax ; imm = 0x7FFFFFFF ``` Reviewed By: wallace Differential Revision: https://reviews.llvm.org/D128477
2022-05-16[lldb][NFC] Make cmd a reference in GenerateOptionUsageDavid Spickett1-1/+1
Nowhere in lldb do we call this with a null pointer. If we did, the first line of the function would fault anyway. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D125218
2022-03-02Refine error msgs from CommandObject & DisassembleJason Molenda1-9/+36
Make it clearer for end users why a command cannot be used when a process is not stopped, etc. Differential Revision: https://reviews.llvm.org/D120594
2022-01-23[Commands] Remove redundant member initialization (NFC)Kazu Hirata1-2/+1
Identified with readability-redundant-member-init.
2021-08-05[lldb] Use a struct to pass function search options to Module::FindFunctionJonas Devlieghere1-4/+6
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-06-17[lldb] Remove redundant calls to set eReturnStatusFailedDavid Spickett1-5/+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/+1
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-02-25[lldb/Core] Change large function threshold variable into a setting.Med Ismail Bennani1-2/+1
This patch replaces the static large function threshold variable with a global debugger setting (`stop-disassembly-max-size`). The default threshold is now set to 32KB (instead of 8KB) and can be modified. rdar://74726362 Differential Revision: https://reviews.llvm.org/D97486 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-05-15Recommit "[lldb] Don't dissasemble large functions by default"Pavel Labath1-11/+47
This recommits f665e80c023 which was reverted in 1cbd1b8f692d for breaking TestFoundationDisassembly.py. The fix is to use --force in the test to avoid bailing out on large functions. I have also doubled the large function limit to 8000 bytes (~~ 2000 insns), as the foundation library contains a lot of large-ish functions. The intent of this feature is to prevent accidental disassembling of enormous (multi-megabyte) "functions", not to get in people's way. The original commit message follows: If we have a binary without symbol information (and without LC_FUNCTION_STARTS, if on a mac), then we have to resort to using heuristics to determine the function boundaries. However, these don't always work, and so we can easily end up thinking we have functions which are several megabytes in size. Attempting to (accidentally) disassemble these can take a very long time spam the terminal with thousands of lines of disassembly. This patch works around that problem by adding a sanity check to the disassemble command. If we are about to disassemble a function which is larger than a certain threshold, we will refuse to disassemble such a function unless the user explicitly specifies the number of instructions to disassemble, uses start/stop addresses for disassembly, or passes the (new) --force argument. The threshold is currently fairly aggressive (4000 bytes ~~ 1000 instructions). If needed, we can increase it, or even make it configurable. Differential Revision: https://reviews.llvm.org/D79789
2020-05-14Revert "[lldb] Don't dissasemble large functions by default"shafik1-47/+11
This reverts commit f665e80c023ec52557f55d7eeaf34471e4c6fa0d. Reverting because it breaks TestFoundationDisassembly.py
2020-05-14[lldb] Don't dissasemble large functions by defaultPavel Labath1-11/+47
Summary: If we have a binary without symbol information (and without LC_FUNCTION_STARTS, if on a mac), then we have to resort to using heuristics to determine the function boundaries. However, these don't always work, and so we can easily end up thinking we have functions which are several megabytes in size. Attempting to (accidentally) disassemble these can take a very long time spam the terminal with thousands of lines of disassembly. This patch works around that problem by adding a sanity check to the disassemble command. If we are about to disassemble a function which is larger than a certain threshold, we will refuse to disassemble such a function unless the user explicitly specifies the number of instructions to disassemble, uses start/stop addresses for disassembly, or passes the (new) --force argument. The threshold is currently fairly aggressive (4000 bytes ~~ 1000 instructions). If needed, we can increase it, or even make it configurable. Differential Revision: https://reviews.llvm.org/D79789
2020-03-10[lldb] Break up CommandObjectDisassemble::DoExecutePavel Labath1-176/+166
The function consisted of a complicated set of conditions to compute the address ranges which are to be disassembled (depending on the mode selected by command line switches). This patch creates a separate function for each mode, so that DoExecute is only left with the task of figuring out how to dump the relevant ranges. This is NFC-ish, except for one change in the error message, which is actually an improvement.
2020-03-09[lldb] Reduce duplication in the Disassembler classPavel Labath1-17/+11
Summary: The class has two pairs of functions whose functionalities differ in only how one specifies how much he wants to disasseble. One limits the process by the size of the input memory region. The other based on the total amount of instructions disassembled. They also differ in various features (like error reporting) that were only added to one of the versions. There are various ways in which this could be addressed. This patch does it by introducing a helper struct called "Limit", which is effectively a pair specifying the value that you want to limit, and the actual limit itself. Reviewers: JDevlieghere Subscribers: sdardis, jrtc27, atanasyan, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D75730
2020-03-05[lldb] Delete two overloads of Disassembler::DisassemblePavel Labath1-45/+55
by "inlining" them into their single caller (CommandObjectDisassemble). The functions mainly consist of long argument lists and defensive checks. These become unnecessary after inlining, so the end result is less code. Additionally, this makes the implementation of CommandObjectDisassemble more uniform (first figure out what you're going to disassemble, then actually do it), which enables further cleanups.
2020-03-04[lldb] Reduce duplication in CommandObjectDisassemblePavel Labath1-76/+46
This command had nearly identical code for the "then" and "else" branches of the "if (m_options.num_instructions != 0)" condition. This patch factors out the common parts of the two blocks to reduce duplication.
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer1-3/+3
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-3/+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-10-30Run clang-format on lldb/source/Commands (NFC)Adrian Prantl1-3/+2
These files had a lot of whitespace errors in them which was a constant source of merge conflicts downstream.
2019-09-04disassemble command: fix error message when disassembly failsPavel Labath1-1/+1
We were printing the start_addr field, which is not correct, as in this branch we are processing the memory described by cur_range. Print that instead. Ideally, in particular this case, the error message would also say something about not being able to disassemble due to not having found the module from the core file, but that is not easy to do right now, so I'm leaving that for another time. llvm-svn: 370898
2019-08-31[lldb] Unify target checking in CommandObjectRaphael Isemann1-8/+3
Summary: We currently have several CommandObjects that manually reimplement the checking for a selected target or a target in the execution context (which is the selected target when they are invoked). This patch removes all these checks and replaces them by setting the eCommandRequiresTarget flag that Pavel suggested. With this flag we are doing the same check but without having to duplicate this code in all these CommandObjects. I also added a `GetSelectedTarget()` variant of the `GetSelectedOrDummyTarget()` function to the CommandObject that checks that the flag is set and then returns a reference to the target. I didn't rewrite all the `target` variables from `Target *` to `Target &` in this patch as last time this change caused a lot of merge conflicts in Swift and I would prefer having that in a separate NFC commit. Reviewers: labath, clayborg Reviewed By: labath, clayborg Subscribers: clayborg, JDevlieghere, jingham, amccarth, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D66863 llvm-svn: 370571
2019-08-22[lldb][NFC] Remove dead code that is supposed to handle invalid command optionsRaphael Isemann1-3/+1
Summary: We currently have a bunch of code that is supposed to handle invalid command options, but all this code is unreachable because invalid options are already handled in `Options::Parse`. The only way we can reach this code is when we declare but then not implement an option (which will be made impossible with D65386, which is also when we can completely remove the `default` cases). This patch replaces all this code with `llvm_unreachable` to make clear this is dead code that can't be reached. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D66522 llvm-svn: 369625
2019-07-28[lldb] Also include the array definition in CommandOptions.incRaphael Isemann1-2/+0
Summary: Right now our CommandOptions.inc only generates the initializer for the options list but not the array declaration boilerplate around it. As the array definition is identical for all arrays, we might as well also let the CommandOptions.inc generate it alongside the initializers. This patch will also allow us to generate additional declarations related to that option list in the future (e.g. a enum class representing the specific options which would make our handling code less prone). This patch also fixes a few option tables that didn't follow our naming style. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65331 llvm-svn: 367186
2019-07-23[lldb][NFC] Tablegenify disassembleRaphael Isemann1-24/+2
llvm-svn: 366783
2019-04-27[CommandObject] Use GetDebugger() helper method (NFC)Jonas Devlieghere1-7/+7
In r359354 a GetDebugger() method was added to the CommandObject class, so that we didn't have to go through the command interpreter to obtain the script interpreter. This patch simplifies other call sites where m_interpreter.GetDebugger() was used, and replaces them with a shorter call to the new method. llvm-svn: 359373
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere1-2/+0
A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-11-11Remove header grouping comments.Jonas Devlieghere1-4/+0
This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
2018-09-26Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha1-16/+16
llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
2018-06-21Remove duplicated check and shared_ptr copying.Tatyana Krasnukha1-4/+3
llvm-svn: 335273
2018-04-30Reflow paragraphs in comments.Adrian Prantl1-8/+7
This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
2018-04-10Move Args::StringTo*** functions to a new OptionArgParser classPavel Labath1-5/+6
Summary: The idea behind this is to move the functionality which depend on other lldb classes into a separate class. This way, the Args class can be turned into a lightweight arc+argv wrapper and moved into the lower lldb layers. Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D44306 llvm-svn: 329677
2017-10-31Invert ArchSpec<->Platform dependencyPavel Labath1-2/+1
Summary: ArchSpec::SetTriple was taking a Platform as an argument, and used it to fill in missing pieces of the specified triple. I invert the dependency by moving this code to other classes. For this purpose, I've created three new functions. - HostInfo::GetAugmentedArchSpec: fills in the triple using the host platform (this used to be implemented by passing a null platform pointer). By putting this code in the Host module, we can provide a way to anyone who does not have a platform instance (lldb-server) an easy way to get Host data. - Platform::GetAugmentedArchSpec: if you have a platform instance, you can call this to let it fill in the triple. - static Platform::GetAugmentedArchSpec: implements the "if platform == 0 then use_host() else use_platform()" part. Reviewers: zturner, jingham, clayborg Subscribers: mgorny, javed.absar, lldb-commits Differential Revision: https://reviews.llvm.org/D39387 llvm-svn: 316987
2017-05-12Rename Error -> Status.Zachary Turner1-4/+4
This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
2017-03-22Delete some more dead includes.Zachary Turner1-1/+1
This breaks the cycle between Target and PluginLanguageC++, reducing the overall cycle count from 43 to 42. llvm-svn: 298561
2016-11-12Make Options::SetOptionValue take a StringRef.Zachary Turner1-9/+6
llvm-svn: 286723