summaryrefslogtreecommitdiff
path: root/lldb/source/Target/DynamicRegisterInfo.cpp
AgeCommit message (Collapse)Author
2025-05-21[lldb] Remove unused local variables (NFC) (#140989)Kazu Hirata
2025-05-15[lldb] Use llvm::unique (NFC) (#139910)Kazu Hirata
While I am at it, this patch removes the "if" statement. std::vector::erase(first, last) doesn't do anything when first == last.
2025-01-23[lldb] Avoid repeated map lookups (NFC) (#124077)Kazu Hirata
2024-01-08[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsInteger ↵Alex Langford
(#71993) This is a follow-up to (#71613) and (#71961).
2023-11-10[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsDictionary ↵Alex Langford
(#71961) Similar to my previous patch (#71613) where I changed `GetItemAtIndexAsString`, this patch makes the same change to `GetItemAtIndexAsDictionary`. `GetItemAtIndexAsDictionary` now returns a std::optional that is either `std::nullopt` or is a valid pointer. Therefore, if the optional is populated, we consider the pointer to always be valid (i.e. no need to check pointer validity).
2023-11-09[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsString ↵Alex Langford
(#71613) This patch changes the interface of StructuredData::Array::GetItemAtIndexAsString to return a `std::optional<llvm::StringRef>` instead of taking an out parameter. More generally, this commit serves as proposal that we change all of the sibling APIs (`GetItemAtIndexAs`) to do the same thing. The reason this isn't one giant patch is because it is rather unwieldy changing just one of these, so if this is approved, I will do all of the other ones as individual follow-ups.
2023-09-19[lldb][AArch64] Implement resizing of SME's ZA registerDavid Spickett
The size of ZA depends on the streaming vector length regardless of the active mode. So in addition to vg (which reports the active mode) we must send the client svg. Otherwise the mechanics are the same as for non-streaming SVE. Use the svg value to update the defined size of ZA, accounting for the fact that ZA is not a single vector but a suqare matrix. So if svg is 8, a single streaming vector would be 8*8 = 64 bytes. ZA is that squared, so 64*64 = 4096 bytes. Testing is included in a later patch. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D159504
2023-08-29[lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads ↵Alex Langford
with ConstString This is the next step in removing ConstString from StructuredData. There are StringRef overloads already, let's use those where we can. Differential Revision: https://reviews.llvm.org/D152870
2023-08-09[lldb] Sink StreamFile into lldbHostAlex Langford
StreamFile subclasses Stream (from lldbUtility) and is backed by a File (from lldbHost). It does not depend on anything from lldbCore or any of its sibling libraries, so I think it makes sense for this to live in lldbHost instead. Differential Revision: https://reviews.llvm.org/D157460
2023-06-15[lldb] Introduce DynamicRegisterInfo::CreateFromDictAlex Langford
I want to add some error handling to DynamicRegisterInfo because there are many operations that can fail and many of these operations do not give meaningful information back to the caller. To begin that process, I want to add a static method that is responsible for creating a DynamicRegisterInfo from a StructuredData::Dictionary (and ArchSpec). This is meant to replace the equivalent constructor because constructors are ill-equipped to perform error handling. Differential Revision: https://reviews.llvm.org/D152594
2023-06-13[lldb][NFCI] Remove StructuredData::Dictionary::GetValueForKeyAsString ↵Alex Langford
overloads involving ConstString In an effort to keep the ConstString StringPool small, I plan on removing use of ConstString in StructuredData. The only class that really uses it is StructuredData::Dictionary. This one was fairly easy to remove, I plan on removing the others in follow-up changes. Differential Revision: https://reviews.llvm.org/D152597
2023-05-22[lldb] Add support for negative integer to {SB,}StructuredDataMed Ismail Bennani
This patch refactors the `StructuredData::Integer` class to make it templated, makes it private and adds 2 public specialization for both `int64_t` & `uint64_t` with a public type aliases, respectively `SignedInteger` & `UnsignedInteger`. It adds new getter for signed and unsigned interger values to the `StructuredData::Object` base class and changes the implementation of `StructuredData::Array::GetItemAtIndexAsInteger` and `StructuredData::Dictionary::GetValueForKeyAsInteger` to support signed and unsigned integers. This patch also adds 2 new `Get{Signed,Unsigned}IntegerValue` to the `SBStructuredData` class and marks `GetIntegerValue` as deprecated. Finally, this patch audits all the caller of `StructuredData::Integer` or `StructuredData::GetIntegerValue` to use the proper type as well the various tests that uses `SBStructuredData.GetIntegerValue`. rdar://105575764 Differential Revision: https://reviews.llvm.org/D150485 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-04-13[lldb] Read register fields from target XMLDavid Spickett
This teaches ProcessGDBRemote to look for "flags" nodes in the target XML that tell you what fields a register has. https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html It will check for various invalid inputs like: * Flags nodes with 0 fields in them. * Start or end being > the register size. * Fields that overlap. * Required properties not being present (e.g. no name). * Flag sets being redefined. If anything untoward is found, we'll just drop the field or the flag set altogether. Register fields are a "nice to have" so LLDB shouldn't be crashing because of them, instead just log anything we throw away. So the user can fix their XML/file a bug with their vendor. Once that is done it will sort the fields and pass them to the RegisterFields class I added previously. There is no way to see these fields yet, so tests for this code will come later when the formatting code is added. The fields are stored in a map of unique pointers on the ProcessGDBRemote class. It will give out raw pointers on the assumption that the GDB process lives longer than the users of those pointers do. Which means RegisterInfo is still a trivial struct but we are properly destroying the fields when the GDB process ends. We can't store the fields directly in the map because adding new items may cause its storage to be reallocated, which would invalidate pointers we've already given out. Reviewed By: jasonmolenda, JDevlieghere Differential Revision: https://reviews.llvm.org/D145574
2023-04-13[lldb] Add dummy field to RegisterInfo for register flags use laterDavid Spickett
This structure is supposed to be trivial, so we cannot simply do "= nullptr;" on the new member. Doing that means you are non trivial, regardless of whether you emulate the previously implied constructor somehow. The next option is to update every use of brace initialisation. Given that this is some hundreds of lines, this change just adds a dummy pointer that is set to nullptr. Subsequent changes will actually use that to point to register flags information. Note: This change is not clang-format-ted because it changes a bunch of areas that are not themselves formatted. It would just add noise. Reviewed By: jasonmolenda, JDevlieghere Differential Revision: https://reviews.llvm.org/D145568
2022-07-23Use the range-based overload of llvm::sort where possibleDmitri Gribenko
Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D130403
2022-02-03[lldb] Rename Logging.h to LLDBLog.h and clean up includesPavel Labath
Most of our code was including Log.h even though that is not where the "lldb" log channel is defined (Log.h defines the generic logging infrastructure). This worked because Log.h included Logging.h, even though it should. After the recent refactor, it became impossible the two files include each other in this direction (the opposite inclusion is needed), so this patch removes the workaround that was put in place and cleans up all files to include the right thing. It also renames the file to LLDBLog to better reflect its purpose.
2022-02-02[lldb] Convert "LLDB" log channel to the new APIPavel Labath
2021-10-25[lldb] [DynamicRegisterInfo] Remove AddRegister() and make Finalize() protectedMichał Górny
Now that AddRegister() is no longer used, remove it. While at it, we can also make Finalize() protected as all supported API methods call it internally. Differential Revision: https://reviews.llvm.org/D111498
2021-10-20[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*Michał Górny
gdbserver does not expose combined ymm* registers but rather XSAVE-style split xmm* and ymm*h portions. Extend value_regs to support combining multiple registers and use it to create user-friendly ymm* registers that are combined from split xmm* and ymm*h portions. Differential Revision: https://reviews.llvm.org/D108937
2021-10-19Revert "[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*"Michał Górny
This reverts commit 5352ea4a721ef252129994111b83dc350ecc71da. It seems to have broken the arm buildbot.
2021-10-19[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*Michał Górny
gdbserver does not expose combined ymm* registers but rather XSAVE-style split xmm* and ymm*h portions. Extend value_regs to support combining multiple registers and use it to create user-friendly ymm* registers that are combined from split xmm* and ymm*h portions. Differential Revision: https://reviews.llvm.org/D108937
2021-10-15[lldb] [DynamicRegisterInfo] Support value_regs with offsetMichał Górny
Support specifying an offset for value_regs[0], and add the offset to the computed derived register offset. This makes it possible to e.g. create the "ah" register on x86. Differential Revision: https://reviews.llvm.org/D111489
2021-10-11[lldb] [DynamicRegisterInfo] Support setting from vector<Register>Michał Górny
Add an overload of DynamicRegisterInfo::SetRegisterInfo() that accepts a std::vector<Register> as an argument. This moves the conversion from DRI::Register to RegisterInfo directly into DynamicRegisterInfo, and avoids the necessity of creating fully-compatible intermediate RegisterInfo instances. While the new method could technically reuse AddRegister(), the ultimate goal is to replace AddRegister() with SetRegisterInfo() entirely. Differential Revision: https://reviews.llvm.org/D111435
2021-10-11[lldb] [Target] Make addSupplementaryRegister() work on Register vectorMichał Górny
Move DynamicRegisterInfo::AddSupplementaryRegister() into a standalone function working on std::vector<DynamicRegisterInfo::Register>. Differential Revision: https://reviews.llvm.org/D111295
2021-10-11[lldb] [DynamicRegisterInfo] Remove non-const GetRegisterInfoAtIndex()Michał Górny
Differential Revision: https://reviews.llvm.org/D111408
2021-10-07Recommit: [lldb] Remove "dwarf dynamic register size expressions" from ↵Pavel Labath
RegisterInfo The previous version of the patch did not update the definitions in conditionally compiled code. This patch includes changes to ARC and windows targets. Original commit message was: These were added to support some mips registers on linux, but linux mips support has now been removed due. They are still referenced in the freebds mips implementation, but the completeness of that implementation is also unknown. All other architectures just set these fields to zero, which is a cause of significant bloat in our register info definitions. Arm also has registers with variable sizes, but they were implemented in a more gdb-compatible fashion and don't use this feature. Differential Revision: https://reviews.llvm.org/D110914
2021-10-06Revert "[lldb] Remove "dwarf dynamic register size expressions" from ↵Michael Forster
RegisterInfo" This reverts commit 00e704bf080ffeeb9e334fb3ab71594f9aa50969. This commit should should have updated llvm/llvm-project/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp like the other architectures.
2021-10-06[lldb] Remove "dwarf dynamic register size expressions" from RegisterInfoPavel Labath
These were added to support some mips registers on linux, but linux mips support has now been removed due. They are still referenced in the freebds mips implementation, but the completeness of that implementation is also unknown. All other architectures just set these fields to zero, which is a cause of significant bloat in our register info definitions. Arm also has registers with variable sizes, but they were implemented in a more gdb-compatible fashion and don't use this feature. Differential Revision: https://reviews.llvm.org/D110914
2021-10-05[lldb] Move DynamicRegisterInfo to public Target libraryMichał Górny
Move DynamicRegisterInfo from the internal lldbPluginProcessUtility library to the public lldbTarget library. This is a prerequisite towards ABI plugin changes that are going to pass DynamicRegisterInfo parameters. Differential Revision: https://reviews.llvm.org/D110942