summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/RegisterValue.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add check for self-assignment. NFCDon Hinton2017-11-141-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D39578 llvm-svn: 318164
* Rename Error -> Status.Zachary Turner2017-05-121-12/+12
| | | | | | | | | | | | | | | 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
* iwyu fixes for lldbCore.Zachary Turner2017-04-061-9/+14
| | | | | | | | | | | | | | This adjusts header file includes for headers and source files in Core. In doing so, one dependency cycle is eliminated because all the includes from Core to that project were dead includes anyway. In places where some files in other projects were only compiling due to a transitive include from another header, fixups have been made so that those files also include the header they need. Tested on Windows and Linux, and plan to address failures on OSX and FreeBSD after watching the bots. llvm-svn: 299714
* Delete some more dead includes.Zachary Turner2017-03-221-1/+0
| | | | | | | This breaks the cycle between Target and PluginLanguageC++, reducing the overall cycle count from 43 to 42. llvm-svn: 298561
* Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner2017-03-041-1/+1
| | | | llvm-svn: 296943
* Isolate Target-specific functionality of DataExtractor.Zachary Turner2017-03-031-9/+10
| | | | | | | | | | | | | | | | In an effort to move the various DataBuffer / DataExtractor classes from Core -> Utility, we have to separate the low-level functionality from the higher level functionality. Only a few functions required anything other than reading/writing raw bytes, so those functions are separated out into a more appropriate area. Specifically, Dump() and DumpHexBytes() are moved into free functions in Core/DumpDataExtractor.cpp, and GetGNUEHPointer is moved into a static function in the only file that it's referenced from. Differential Revision: https://reviews.llvm.org/D30560 llvm-svn: 296910
* Move classes from Core -> Utility.Zachary Turner2017-02-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* Resubmit "Change RegisterValue getters / setters to use StringRef."Zachary Turner2016-11-171-89/+90
| | | | | | | This resubmits r287279 with a fix for the original issue, which was a trivial typo. llvm-svn: 287282
* Revert "Change RegisterValue getters / setters to use StringRef."Zachary Turner2016-11-171-90/+89
| | | | | | | This reverts commit r287279, which breaks some register tests on Linux. llvm-svn: 287281
* Change RegisterValue getters / setters to use StringRef.Zachary Turner2016-11-171-89/+90
| | | | | | | | In the process, found some functions that were duplicates of existing StringRef member functions. So deleted those functions and used the StringRef functions instead. llvm-svn: 287279
* Don't allow direct access to StreamString's internal buffer.Zachary Turner2016-11-161-5/+5
| | | | | | | | | | | | | | | This is a large API change that removes the two functions from StreamString that return a std::string& and a const std::string&, and instead provide one function which returns a StringRef. Direct access to the underlying buffer violates the concept of a "stream" which is intended to provide forward only access, and makes porting to llvm::raw_ostream more difficult in the future. Differential Revision: https://reviews.llvm.org/D26698 llvm-svn: 287152
* [LLDB][MIPS] Fix register read/write for 32 bit big endian systemNitesh Jain2016-10-101-0/+3
| | | | | | | | | | Reviewers: clayborg, labath Subscribers: jaydeep, bhushan, mohit.bhakkad, slthakur, llvm-commits Differential Revision: https://reviews.llvm.org/D24124 llvm-svn: 283728
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-930/+852
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Fix cmake build after r266524.Oleksiy Vyalov2016-04-161-0/+1
| | | | llvm-svn: 266530
* Make Scalar::GetBytes and RegisterValue::GetBytes constUlrich Weigand2016-04-141-93/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scalar::GetBytes provides a non-const access to the underlying bytes of the scalar value, supposedly allowing for modification of those bytes. However, even with the current implementation, this is not really possible. For floating-point scalars, the pointer returned by GetBytes refers to a temporary copy; modifications to that copy will be simply ignored. For integer scalars, the pointer refers to internal memory of the APInt implementation, which isn't supposed to be directly modifyable; GetBytes simply casts aways the const-ness of the pointer ... With my upcoming patch to fix Scalar::GetBytes for big-endian systems, this problem is going to get worse, since there we need temporary copies even for some integer scalars. Therefore, this patch makes Scalar::GetBytes const, fixing all those problems. As a follow-on change, RegisterValues::GetBytes must be made const as well. This in turn means that the way of initializing a RegisterValue by doing a SetType followed by writing to GetBytes no longer works. Instead, I've changed SetValueFromData to do the equivalent of SetType itself, and then re-implemented SetFromMemoryData to work on top of SetValueFromData. There is still a need for RegisterValue::SetType, since some platform-specific code uses it to reinterpret the contents of an already filled RegisterValue. To make this usage work in all cases (even changing from a type implemented via Scalar to a type implemented as a byte buffer), SetType now simply copies the old contents out, and then reloads the RegisterValue from this data using the new type via SetValueFromData. This in turn means that there is no remaining caller of Scalar::SetType, so it can be removed. The only other follow-on change was in MIPS EmulateInstruction code, where some uses of RegisterValue::GetBytes could be made const trivially. Differential Revision: http://reviews.llvm.org/D18980 llvm-svn: 266310
* Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; ↵Eugene Zelenko2016-03-121-19/+15
| | | | | | other minor fixes. llvm-svn: 263312
* Certain hardware architectures have registers of 256 bits in sizeEnrico Granata2016-03-101-2/+9
| | | | | | This patch extends Scalar such that it can support data living in such registers (e.g. float values living in the XMM registers) llvm-svn: 263079
* Support floating point values in 128-bit SSE vector registersAdrian Prantl2016-03-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The System-V x86_64 ABI requires floating point values to be passed in 128-but SSE vector registers (xmm0, ...). When printing such a variable this currently yields an <invalid load address>. This patch makes LLDB's DWARF expression evaluator accept 128-bit registers as scalars. It also relaxes the check that the size of the result of the DWARF expression be equal to the size of the variable to a greater-than. DWARF defers to the ABI how smaller values are being placed in a larger register. Implementation note: I found the code in Value::SetContext() that changes the m_value_type after the fact to be questionable. I added a sanity check that the Value's memory buffer has indeed been written to (this is necessary, because we may have a scalar value in a vector register), but really I feel like this is the wrong place to be setting it. Reviewed by Greg Clayton. http://reviews.llvm.org/D17897 rdar://problem/24944340 llvm-svn: 262947
* Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton2016-02-261-8/+9
| | | | | | the right thing and break. llvm-svn: 261950
* Fix typos.Bruce Mitchener2015-09-221-1/+1
| | | | | | | | | | | | Summary: Another round of minor typo fixes. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13026 llvm-svn: 248243
* Fix assertion failure caused by a bug in 128bit register handling in ↵Tamas Berghammer2015-09-081-1/+1
| | | | | | RegisterValue llvm-svn: 247022
* [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValueSagar Thakur2015-08-201-387/+194
| | | | | | | | | Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and use llvm::APInt and llvm::APFloat for all integer and floating point types. Also used Scalar in RegisterValue.cpp Reviewers: tberghammer, ovyalov, clayborg, labath Subscribers: lldb-commits, nitesh.jain, jaydeep Differential: http://reviews.llvm.org/D12100 llvm-svn: 245547
* Revert "[LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue"Pavel Labath2015-08-171-192/+387
| | | | | | Reverting as this commit causes an infinite loop. llvm-svn: 245222
* [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValueSagar Thakur2015-08-171-387/+192
| | | | | | | | | Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and use llvm::APInt and llvm::APFloat for all integer and floating point types. Also used Scalar in RegisterValue.cpp Reviewers: jaydeep, clayborg, jasonmolenda, ovyalov, emaste Subscribers: tberghammer, ovyalov, emaste, mohit.bhakkad, nitesh.jain, bhushan Differential: http://reviews.llvm.org/D10919 llvm-svn: 245216
* Revert r244308 since it's introducing test regressions on Linux:Oleksiy Vyalov2015-08-101-191/+387
| | | | | | | | - TestLldbGdbServer.py both clang & gcc, i386 and x86_64 - TestConstVariables.py gcc, i386 and x86_64 - 112 failures clang, i386 llvm-svn: 244514
* [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 ↵Sagar Thakur2015-08-071-387/+191
| | | | | | | | | | | | | | | | | | mode support This change : - Fixes offsets of all register sets for Mips. - Adds MSA register set and FRE=1 mode support for FP register set. - Separates lldb register numbers and register infos of freebsd/mips64 from linux/mips64. - Re-orders the register numbers of all kinds for mips to be consistent with freebsd order of register numbers. - Eliminates ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and uses llvm::APInt and llvm::APFloat for all integer and floating point types. Reviewers : emaste, jaydeep, clayborg Subscribers : emaste, mohit.bhakkad, nitesh.jain, bhushan Differential : http://reviews.llvm.org/D10919 llvm-svn: 244308
* Fix typos.Bruce Mitchener2015-07-221-2/+2
| | | | | | | | | | | | Summary: Fix a bunch of typos. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11386 llvm-svn: 242856
* Moved Args::StringToXIntYZ to StringConvert::ToXIntYZVince Harron2015-01-151-2/+3
| | | | | | | | | | The refactor was motivated by some comments that Greg made http://reviews.llvm.org/D6918 and also to break a dependency cascade that caused functions linking in string->int conversion functions to pull in most of lldb llvm-svn: 226199
* RegisterValues can now report their contents asSean Callanan2013-04-301-1/+58
| | | | | | | | | | UInts even if their contents were set as bytes. This makes expressions using registers work better, especially with core files. <rdar://problem/13743427> llvm-svn: 180810
* Introduces extended register sets whose availability can vary with the ↵Ashok Thirumurthi2013-03-281-2/+1
| | | | | | | | | | target processor. - Includes a stub for AVX support in the x86-64 register context and a failing test for register sets that are unavailable. Thanks to Greg Clayton for his review feedback. llvm-svn: 178252
* Fix assert in RegisterValue::SetBytes if we're trying toJason Molenda2013-03-091-1/+1
| | | | | | | | write a 32-byte value into a 32-byte ymm vector reg - that is allowed. <rdar://problem/13350587> llvm-svn: 176740
* <rdar://problem/13069948>Greg Clayton2013-01-251-1/+1
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
* More Linux warnings fixes (remove default labels as needed):Daniel Malea2012-12-071-2/+0
| | | | | | | | - as per http://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations Patch by Matt Kopec! llvm-svn: 169633
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-2/+2
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* For the eEncodingIEEE754 registers in RegisterValue::SetType,Jason Molenda2012-09-061-2/+2
| | | | | | | only accept the first matching type based on lldb's sizeofs. <rdar://problem/12222109> llvm-svn: 163285
* rdar://problem/11598332Johnny Chen2012-06-051-5/+18
| | | | | | | | | | | | | The output of 'register read' should be prettier. Modify RegisterValue::Dump() to take an additional parameter: uint32_t reg_name_right_align_at which defaults to 0 (i.e., no alignment at all). Update the 'register read' command impl to pass 8 as the alignment to RegisterValue::Dump() method. If more sophisticated scheme is desired, we will need to introduce an additional command option to 'register read' later on. llvm-svn: 158039
* rdar://problem/10611315Johnny Chen2012-03-071-0/+3
| | | | | | | | | | | | expression command doesn't handle xmm or stmm registers... o Update ClangASTContext::GetBuiltinTypeForEncodingAndBitSize() to now handle eEncodingVector. o Modify RegisterValue::SetFromMemoryData() to fix the subtle error due to unitialized variables. o Add a test file for "expr $xmm0". llvm-svn: 152190
* rdar://problem/10652076Johnny Chen2012-03-021-1/+54
| | | | | | | | | | | | | | | | | | | | | | | Add logic to GDBRemoteRegisterContext class to be able to read/write a "composite" register which has "primordial" registers as its constituents. In particular, Read/WriteRegisterBytes() now delegate to Get/SetPrimordialRegister() helper methods to read/write register contents. Also modify RegisterValue class to be able to parse "register write" string value for the NEON quadword registers which is displayed as a vector of uint8's. Example: (lldb) register write q0 "{0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10}" (lldb) register read q0 q0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10} (lldb) register read --format uint8_t[] s0 s0 = {0x01 0x02 0x03 0x04} (lldb) register read --format uint8_t[] d0 d0 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08} (lldb) register read --format uint8_t[] d1 d1 = {0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10} llvm-svn: 151939
* Cleaned up many error codes. For any who is filling in error strings intoGreg Clayton2011-10-261-13/+13
| | | | | | | | | | | | | lldb_private::Error objects the rules are: - short strings that don't start with a capitol letter unless the name is a class or anything else that is always capitolized - no trailing newline character - should be one line if possible Implemented a first pass at adding "--gdb-format" support to anything that accepts format with optional size/count. llvm-svn: 142999
* Fix a logic error caught by the static analyzer.Johnny Chen2011-08-121-1/+1
| | | | llvm-svn: 137407
* Fixed some issues with ARM backtraces by not processing any push/pop Greg Clayton2011-07-061-0/+147
| | | | | | | | | | | | | | instructions if they are conditional. Also fixed issues where the PC wasn't getting bit zero stripped for ARM targets when a stack frame was thumb. We now properly call through the GetOpcodeLoadAddress() functions to make sure the addresses are properly stripped for any targets that may decorate up their addresses. We now don't pass the SIGSTOP signals along. We can revisit this soon, but currently this was interfering with debugging some older ARM targets that don't have vCont support in the GDB server. llvm-svn: 134461
* Added a way to resolve an load address from a target:Greg Clayton2011-05-181-1/+71
| | | | | | | | | | | | | | | | | | | | bool Address::SetLoadAddress (lldb::addr_t load_addr, Target *target); Added an == and != operator to RegisterValue. Modified the ThreadPlanTracer to use RegisterValue objects to store the register values when single stepping. Also modified the output to be a bit less wide. Fixed the ABIMacOSX_arm to not overwrite stuff on the stack. Also made the trivial function call be able to set the ARM/Thumbness of the target correctly, and also sets the return value ARM/Thumbness. Fixed the encoding on the arm s0-s31 and d16 - d31 registers when the default register set from a standard GDB server register sets. llvm-svn: 131517
* Added generic register numbers for simple ABI argument registers and definedGreg Clayton2011-05-151-3/+39
| | | | | | | | | | | | | | | | | the appropriate registers for arm and x86_64. The register names for the arguments that are the size of a pointer or less are all named "arg1", "arg2", etc. This allows you to read these registers by name: (lldb) register read arg1 arg2 arg3 ... You can also now specify you want to see alternate register names when executing the read register command: (lldb) register read --alternate (lldb) register read -A llvm-svn: 131376
* While implementing unwind information using UnwindAssemblyInstEmulation I ranGreg Clayton2011-05-091-0/+896
into some cleanup I have been wanting to do when reading/writing registers. Previously all RegisterContext subclasses would need to implement: virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data); virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0); There is now a new class specifically designed to hold register values: lldb_private::RegisterValue The new register context calls that subclasses must implement are: virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0; virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0; The RegisterValue class must be big enough to handle any register value. The class contains an enumeration for the value type, and then a union for the data value. Any integer/float values are stored directly in an appropriate host integer/float. Anything bigger is stored in a byte buffer that has a length and byte order. The RegisterValue class also knows how to copy register value bytes into in a buffer with a specified byte order which can be used to write the register value down into memory, and this does the right thing when not all bytes from the register values are needed (getting a uint8 from a uint32 register value..). All RegiterContext and other sources have been switched over to using the new regiter value class. llvm-svn: 131096
OpenPOWER on IntegriCloud