summaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMemory.cpp
AgeCommit message (Collapse)Author
2022-03-31[LLDB] Applying clang-tidy modernize-use-equals-default over LLDBShafik Yaghmour
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-14[LLDB] Applying clang-tidy modernize-use-default-member-init over LLDBShafik Yaghmour
Applied modernize-use-default-member-init clang-tidy check over LLDB. It appears in many files we had already switched to in class member init but never updated the constructors to reflect that. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121481
2022-02-14Add a repeat command option for "thread backtrace --count N".Jim Ingham
This way if you have a long stack, you can issue "thread backtrace --count 10" and then subsequent <Return>-s will page you through the stack. This took a little more effort than just adding the repeat command, since the GetRepeatCommand API was returning a "const char *". That meant the command had to keep the repeat string alive, which is inconvenient. The original API returned either a nullptr, or a const char *, so I changed the private API to return an llvm::Optional<std::string>. Most of the patch is propagating that change. Also, there was a little thinko in fetching the repeat command. We don't fetch repeat commands for commands that aren't being added to history, which is in general reasonable. And we don't add repeat commands to the history - also reasonable. But we do want the repeat command to be able to generate the NEXT repeat command. So I adjusted the logic in HandleCommand to work that way. Differential Revision: https://reviews.llvm.org/D119046
2022-02-10Reland "[lldb] Remove non address bits when looking up memory regions"David Spickett
This reverts commit 0df522969a7a0128052bd79182c8d58e00556e2f. Additional checks are added to fix the detection of the last memory region in GetMemoryRegions or repeating the "memory region" command when the target has non-address bits. Normally you keep reading from address 0, looking up each region's end address until you get LLDB_INVALID_ADDR as the region end address. (0xffffffffffffffff) This is what the remote will return once you go beyond the last mapped region: [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0001000000000000-0xffffffffffffffff) --- Problem is that when we "fix" the lookup address, we remove some bits from it. On an AArch64 system we have 48 bit virtual addresses, so when we fix the end address of the [stack] region the result is 0. So we loop back to the start. [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0000000000000000-0x0000000000400000) --- To fix this I added an additional check for the last range. If the end address of the region is different once you apply FixDataAddress, we are at the last region. Since the end of the last region will be the last valid mappable address, plus 1. That 1 will be removed by the ABI plugin. The only side effect is that on systems with non-address bits, you won't get that last catch all unmapped region from the max virtual address up to 0xf...f. [0x0000fffff8000000-0x0000fffffffdf000) --- [0x0000fffffffdf000-0x0001000000000000) rw- [stack] <ends here> Though in some way this is more correct because that region is not just unmapped, it's not mappable at all. No extra testing is needed because this is already covered by TestMemoryRegion.py, I simply forgot to run it on system that had both top byte ignore and pointer authentication. This change has been tested on a qemu VM with top byte ignore, memory tagging and pointer authentication enabled. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D115508
2022-01-26[lldb] Add option to show memory tags in memory read outputDavid Spickett
This adds an option --show-tags to "memory read". (lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags 0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0) 0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1) Tags are printed on the end of each line, if that line has any tags associated with it. Meaning that untagged memory output is unchanged. Tags are printed based on the granule(s) of memory that a line covers. So you may have lines with 1 tag, with many tags, no tags or partially tagged lines. In the case of partially tagged lines, untagged granules will show "<no tag>" so that the ordering is obvious. For example, a line that covers 2 granules where the first is not tagged: (lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags 0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0) Untagged lines will just not have the "(tags: ..." at all. Though they may be part of a larger output that does have some tagged lines. To do this I've extended DumpDataExtractor to also print memory tags where it has a valid execution context and is asked to print them. There are no special alignment requirements, simply use "memory read" as usual. All alignment is handled in DumpDataExtractor. We use MakeTaggedRanges to find all the tagged memory in the current dump, then read all that into a MemoryTagMap. The tag map is populated once in DumpDataExtractor and re-used for each subsequently printed line (or recursive call of DumpDataExtractor, which some formats do). Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D107140
2022-01-24[lldb] Ignore non-address bits in "memory find" argumentsDavid Spickett
This removes the non-address bits before we try to use the addresses. Meaning that when results are shown, those results won't show non-address bits either. This follows what "memory read" has done. On the grounds that non-address bits are a property of a pointer, not the memory pointed to. I've added testing and merged the find and read tests into one file. Note that there are no API side changes because "memory find" does not have an equivalent API call. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D117299
2022-01-23[Commands] Remove redundant member initialization (NFC)Kazu Hirata
Identified with readability-redundant-member-init.
2022-01-11[lldb] Remove non address bits from memory read argumentsDavid Spickett
Addresses on AArch64 can have top byte tags, memory tags and pointer authentication signatures in the upper bits. While testing memory tagging I found that memory read couldn't read a range if the two addresses had different tags. The same could apply to signed pointers given the right circumstance. (lldb) memory read mte_buf_alt_tag mte_buf+16 error: end address (0x900fffff7ff8010) must be greater than the start address (0xa00fffff7ff8000). Or it would try to read a lot more memory than expected. (lldb) memory read mte_buf mte_buf_alt_tag+16 error: Normally, 'memory read' will not read over 1024 bytes of data. error: Please use --force to override this restriction just once. error: or set target.max-memory-read-size if you will often need a larger limit. Fix this by removing non address bits before we calculate the read range. A test is added for AArch64 Linux that confirms this by using the top byte ignore feature. This means that if you do read with a tagged pointer the output does not include those tags. This is potentially confusing but I think overall it's better that we don't pretend that we're reading memory from a range that the process is unable to map. (lldb) p ptr1 (char *) $4 = 0x3400fffffffff140 "\x80\xf1\xff\xff\xff\xff" (lldb) p ptr2 (char *) $5 = 0x5600fffffffff140 "\x80\xf1\xff\xff\xff\xff" (lldb) memory read ptr1 ptr2+16 0xfffffffff140: 80 f1 ff ff ff ff 00 00 38 70 bc f7 ff ff 00 00 ........8p...... Reviewed By: omjavaid, danielkiss Differential Revision: https://reviews.llvm.org/D103626
2021-12-08[lldb] Add missing space in C string format memory read warningDavid Spickett
Also add tests to check that we print the warning in the right circumstances. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D114877
2021-11-26[Bug 49018][lldb] Fix incorrect help text for 'memory write' commandVenkata Ramanaiah Nalamothu
Certain commands like 'memory write', 'register read' etc all use the OptionGroupFormat options but the help usage text for those options is not customized to those commands. One such example is: (lldb) help memory read -s <byte-size> ( --size <byte-size> ) The size in bytes to use when displaying with the selected format. (lldb) help memory write -s <byte-size> ( --size <byte-size> ) The size in bytes to use when displaying with the selected format. This patch allows such commands to overwrite the help text for the options in the OptionGroupFormat group as needed and fixes help text of memory write. llvm.org/pr49018. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D114448
2021-11-26[lldb] Fix 'memory write' to not allow specifying values when writing file ↵Venkata Ramanaiah Nalamothu
contents Currently the 'memory write' command allows specifying the values when writing the file contents to memory but the values are actually ignored. This patch fixes that by erroring out when values are specified in such cases. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D114544
2021-08-09[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compatMichał Górny
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-06-24[lldb][AArch64] Add "memory tag read" commandDavid Spickett
This new command looks much like "memory read" and mirrors its basic behaviour. (lldb) memory tag read new_buf_ptr new_buf_ptr+32 Logical tag: 0x9 Allocation tags: [0x900fffff7ffa000, 0x900fffff7ffa010): 0x9 [0x900fffff7ffa010, 0x900fffff7ffa020): 0x0 Important proprties: * The end address is optional and defaults to reading 1 tag if ommitted * It is an error to try to read tags if the architecture or process doesn't support it, or if the range asked for is not tagged. * It is an error to read an inverted range (end < begin) (logical tags are removed for this check so you can pass tagged addresses here) * The range will be expanded to fit the tagging granule, so you can get more tags than simply (end-begin)/granule size. Whatever you get back will always cover the original range. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D97285
2021-06-20Add a corefile style option to process save-core; skinny corefilesJason Molenda
Add a new feature to process save-core on Darwin systems -- for lldb to create a user process corefile with only the dirty (modified memory) pages included. All of the binaries that were used in the corefile are assumed to still exist on the system for the duration of the use of the corefile. A new --style option to process save-core is added, so a full corefile can be requested if portability across systems, or across time, is needed for this corefile. debugserver can now identify the dirty pages in a memory region when queried with qMemoryRegionInfo, and the size of vm pages is given in qHostInfo. Create a new "all image infos" LC_NOTE for Mach-O which allows us to describe all of the binaries that were loaded in the process -- load address, UUID, file path, segment load addresses, and optionally whether code from the binary was executing on any thread. The old "read dyld_all_image_infos and then the in-memory Mach-O load commands to get segment load addresses" no longer works when we only have dirty memory. rdar://69670807 Differential Revision: https://reviews.llvm.org/D88387
2021-06-17[lldb] Remove redundant calls to set eReturnStatusFailedDavid Spickett
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 Devlieghere
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-04-16Target::ReadMemory read from read-only binary file Section, not memoryJason Molenda
Commiting this patch for Augusto Noronha who is getting set up still. This patch changes Target::ReadMemory so the default behavior when a read is in a Section that is read-only is to fetch the data from the local binary image, instead of reading it from memory. Update all callers to use their old preferences (the old prefer_file_cache bool) using the new API; we should revisit these calls and see if they really intend to read live memory, or if reading from a read-only Section would be equivalent and important for performance-sensitive cases. rdar://30634422 Differential revision: https://reviews.llvm.org/D100338
2021-04-06[lldb] Fix bug where memory read --outfile is not truncating the fileJonas Devlieghere
The memory read --outfile command should truncate the output when unless --append-outfile. Fix the bug and add a test. rdar://76062318 Differential revision: https://reviews.llvm.org/D99890
2021-03-17[lldb] Correct unsigned decimal argument check in memory writeDavid Spickett
getAsInteger returns false when it succeeds. Before: (lldb) memory write 0x00007ffff7dd3000 99 -f "unsigned decimal" error: '99' is not a valid unsigned decimal string value. After: (lldb) memory write 0x00007ffff7dd3000 99 -f "unsigned decimal" (lldb) memory read 0x00007ffff7dd3000 0x00007ffff7dd3001 0x7ffff7dd3000: 63 c
2021-03-17[lldb] Correct typo in memory read errorDavid Spickett
Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D98770
2021-02-24[lldb] Prevent double new lines behind errors/warning/messages from LLDB ↵Raphael Isemann
commands The current API for printing errors/warnings/messages from LLDB commands sometimes adds newlines behind the messages for the caller. However, this happens unconditionally so when the caller already specified a trailing newline in the error message (or is trying to print a generated error message that ends in a newline), LLDB ends up printing both the automatically added newline and the one that was in the error message string. This leads to all the randomly appearing new lines in error such as: ``` (lldb) command a error: 'command alias' requires at least two arguments (lldb) apropos a b error: 'apropos' must be called with exactly one argument. (lldb) why is there an empty line behind the second error? ``` This code adds a check that only appends the new line if the passed message doesn't already contain a trailing new line. Also removes the AppendRawWarning which had only one caller and doesn't serve any purpose now. Reviewed By: #lldb, mib Differential Revision: https://reviews.llvm.org/D96947
2020-11-20[lldb][AArch64/Linux] Show memory tagged memory regionsDavid Spickett
This extends the "memory region" command to show tagged regions on AArch64 Linux when the MTE extension is enabled. (lldb) memory region the_page [0x0000fffff7ff8000-0x0000fffff7ff9000) rw- memory tagging: enabled This is done by adding an optional "flags" field to the qMemoryRegion packet. The only supported flag is "mt" but this can be extended. This "mt" flag is read from /proc/{pid}/smaps on Linux, other platforms will leave out the "flags" field. Where this "mt" flag is received "memory region" will show that it is enabled. If it is not or the target doesn't support memory tagging, the line is not shown. (since majority of the time tagging will not be enabled) Testing is added for the existing /proc/{pid}/maps parsing and the new smaps parsing. Minidump parsing has been updated where needed, though it only uses maps not smaps. Target specific tests can be run with QEMU and I have added MTE flags to the existing helper scripts. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D87442
2020-11-04[lldb] Remove [US]IntValueIsValidForSize from CommandObjectMemoryPavel Labath
Use llvm::is(U)IntN (MathExtras.h) instead.
2020-10-05Reland "[lldb] Don't send invalid region addresses to lldb server"David Spickett
This reverts commit c65627a1fe3be7521fc232d633bb6df577f55269. The test immediately after the new invalid symbol test was failing on Windows. This was because when we called VirtualQueryEx to get the region info for 0x0, even if it succeeded we would call GetLastError. Which must have picked up the last error that was set while trying to lookup "not_an_address". Which happened to be 2. ("The system cannot find the file specified.") To fix this only call GetLastError when we know VirtualQueryEx has failed. (when it returns 0, which we were also checking for anyway) Also convert memory region to an early return style to make the logic clearer. Reviewed By: labath, stella.stamenova Differential Revision: https://reviews.llvm.org/D88229
2020-09-17Revert "[lldb] Don't send invalid region addresses to lldb server"David Spickett
This reverts commit c687af0c30b4dbdc9f614d5e061c888238e0f9c5 due to a test failure on Windows.
2020-09-17[lldb] Don't send invalid region addresses to lldb serverDavid Spickett
Previously when <addr> in "memory region <addr>" didn't parse correctly, we'd print an error then also ask lldb-server for a region containing LLDB_INVALID_ADDRESS. (lldb) memory region not_an_address error: invalid address argument "not_an_address"... error: Server returned invalid range Only send the command to lldb-server if the address parsed correctly. (lldb) memory region not_an_address error: invalid address argument "not_an_address"... Reviewed By: labath Differential Revision: https://reviews.llvm.org/D87694
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann
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 Isemann
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-05MemoryRegion: Print "don't know" permission values as suchPavel Labath
Summary: The permissions in a memory region have ternary states (yes, no, don't know), but the memory region command only prints in binary, treating "don't know" as "yes", which is particularly confusing as for instance the unwinder will treat an unknown value as "no". This patch makes is so that we distinguish all three states when printing the values, using "?" to indicate the lack of information. It is implemented via a special argument to the format provider for the OptionalBool enumeration. Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D69106
2019-10-30Run clang-format on lldb/source/Commands (NFC)Adrian Prantl
These files had a lot of whitespace errors in them which was a constant source of merge conflicts downstream.
2019-10-14uint32_t options -> File::OpenOptions optionsLawrence D'Anna
Summary: This patch re-types everywhere that passes a File::OpenOptions as a uint32_t so it actually uses File::OpenOptions. It also converts some OpenOptions related functions that fail by returning 0 or NULL into llvm::Expected split off from https://reviews.llvm.org/D68737 Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68853 llvm-svn: 374817
2019-09-26Convert FileSystem::Open() to return Expected<FileUP>Lawrence D'Anna
Summary: This patch converts FileSystem::Open from this prototype: Status Open(File &File, const FileSpec &file_spec, ...); to this one: llvm::Expected<std::unique_ptr<File>> Open(const FileSpec &file_spec, ...); This is beneficial on its own, as llvm::Expected is a more modern and recommended error type than Status. It is also a necessary step towards https://reviews.llvm.org/D67891, and further developments for lldb_private::File. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67996 llvm-svn: 373003
2019-09-13[lldb][NFC] Remove ArgEntry::ref memberRaphael Isemann
The StringRef should always be identical to the C string, so we might as well just create the StringRef from the C-string. This might be slightly slower until we implement the storage of ArgEntry with a string instead of a std::unique_ptr<char[]>. Until then we have to do the additional strlen on the C string to construct the StringRef. llvm-svn: 371842
2019-08-22[lldb][NFC] Remove dead code that is supposed to handle invalid command optionsRaphael Isemann
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-08-21Add char8_t support (C++20)Jonas Devlieghere
This patch adds support for the char8_t type introduced in C++20 char8_t. The original patch was submitted by James Blachly on the LLDB mailing list [1]. I modified the patch a bit and added a test. [1] http://lists.llvm.org/pipermail/lldb-dev/2019-August/015393.html Differential revision: https://reviews.llvm.org/D66447 llvm-svn: 369582
2019-07-28[lldb] Also include the array definition in CommandOptions.incRaphael Isemann
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-25[lldb] Tablegenify expr/frame/log/register/memoryRaphael Isemann
llvm-svn: 367009
2019-06-12[Expression] Add PersistentExpressionState::GetCompilerTypeFromPersistentDeclAlex Langford
Summary: PersistentStateExpressions (e.g. ClangPersistentVariables) have the ability to define types using expressions that persist throughout the debugging session. GetCompilerTypeFromPersistentDecl is a useful operation to have if you need to use any of those persistently declared types, like in CommandObjectMemory. This decouples clang from CommandObjectMemory and decouples Plugins from Commands in general. Differential Revision: https://reviews.llvm.org/D62797 llvm-svn: 363183
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere
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-02-11Use std::make_shared in LLDB (NFC)Jonas Devlieghere
Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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
2019-01-15Replace auto -> llvm::Optional<uint64_t>Adrian Prantl
This addresses post-commit feedback for https://reviews.llvm.org/D56688 llvm-svn: 351237
2019-01-15Make CompilerType::getBitSize() / getByteSize() return an optional result. NFCAdrian Prantl
The code in LLDB assumes that CompilerType and friends use the size 0 as a sentinel value to signal an error. This works for C++, where no zero-sized type exists, but in many other programming languages (including I believe C) types of size zero are possible and even common. This is a particular pain point in swift-lldb, where extra code exists to double-check that a type is *really* of size zero and not an error at various locations. To remedy this situation, this patch starts by converting CompilerType::getBitSize() and getByteSize() to return an optional result. To avoid wasting space, I hand-rolled my own optional data type assuming that no type is larger than what fits into 63 bits. Follow-up patches would make similar changes to the ValueObject hierarchy. rdar://problem/47178964 Differential Revision: https://reviews.llvm.org/D56688 llvm-svn: 351214
2019-01-14[SymbolFile] Remove SymbolContext parameter from FindTypes.Zachary Turner
This parameter was only ever used with the Module set, and since a SymbolFile is tied to a module, the parameter turns out to be entirely unnecessary. Furthermore, it doesn't make a lot of sense to ask a caller to ask SymbolFile which is tied to Module X to find types for Module Y, but that possibility was open with the previous interface. By removing this parameter from the API, it makes it harder to use incorrectly as well as easier for an implementor to understand what it needs to do. llvm-svn: 351133
2018-12-19Show the memory region name if there is one in the output of the "memory ↵Greg Clayton
region" command Prior to this change we would show the name of the section that a memory region belonged to but not its actual region name. Now we show this,. Added a test that reuses the regions-linux-map.dmp minidump file to test this and verify the correct region names for various memory regions. Differential Revision: https://reviews.llvm.org/D55854 llvm-svn: 349658
2018-11-12Re-land "Extract construction of DataBufferLLVM into FileSystem"Jonas Devlieghere
This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
2018-11-12Revert "Extract construction of DataBufferLLVM into FileSystem"Davide Italiano
It broke the lldb sanitizer bots. llvm-svn: 346694
2018-11-11Remove header grouping comments.Jonas Devlieghere
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-11-10Extract construction of DataBufferLLVM into FileSystemJonas Devlieghere
This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 llvm-svn: 346598
2018-11-02[FileSystem] Open File instances through the FileSystem.Jonas Devlieghere
This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049