summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Object
Commit message (Collapse)AuthorAgeFilesLines
* [unittests] Fix "comparison of integers of different signs" warningsMiloš Stojanović2020-01-141-1/+1
| | | | | | | | A warning is sent because `std::distance()` returns a signed type so `CmpHelperEQ()` gets instantiated into a function that compares differently signed arguments. Differential Revision: https://reviews.llvm.org/D72632
* Add operator<< for object::SectionedAddressPavel Labath2019-11-192-0/+21
| | | | | | The main motivation for this is better failure messages in unit tests. Split off from D70394.
* Add ExceptionStream to llvm::Object::minidumpJoseph Tremoulet2019-10-181-0/+58
| | | | | | | | | | | | | | | | | | Summary: This will allow updating MinidumpYAML and LLDB to use this common definition. Reviewers: labath, jhenderson, clayborg Reviewed By: labath Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68656 llvm-svn: 375239
* Object/minidump: Add support for the MemoryInfoList streamPavel Labath2019-10-081-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the definitions of the constants and structures necessary to interpret the MemoryInfoList minidump stream, as well as the object::MinidumpFile interface to access the stream. While the code is fairly simple, there is one important deviation from the other minidump streams, which is worth calling out explicitly. Unlike other "List" streams, the size of the records inside MemoryInfoList stream is not known statically. Instead it is described in the stream header. This makes it impossible to return ArrayRef<MemoryInfo> from the accessor method, as it is done with other streams. Instead, I create an iterator class, which can be parameterized by the runtime size of the structure, and return iterator_range<iterator> instead. Reviewers: amccarth, jhenderson, clayborg Subscribers: JosephTremoulet, zturner, markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68210 llvm-svn: 374051
* Minidump: Add support for the MemoryList streamPavel Labath2019-05-161-0/+48
| | | | | | | | | | | | | | | | | | Summary: the stream format is exactly the same as for ThreadList and ModuleList streams, only the entry types are slightly different, so the changes in this patch are just straight-forward applications of established patterns. Reviewers: amccarth, jhenderson, clayborg Subscribers: markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61885 llvm-svn: 360908
* Object/Minidump: Add support for the ThreadList streamPavel Labath2019-05-021-1/+68
| | | | | | | | | | | | | | | | | | Summary: The stream contains the list of threads belonging to the process described by the minidump. Its structure is the same as the ModuleList stream, and in fact, I have generalized the ModuleList reading code to handle this stream too. Reviewers: amccarth, jhenderson, clayborg Subscribers: llvm-commits, lldb-commits, markmentovai, zturner Tags: #llvm Differential Revision: https://reviews.llvm.org/D61064 llvm-svn: 359762
* Object/Minidump: Add support for reading the ModuleList streamPavel Labath2019-04-081-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The ModuleList stream consists of an integer giving the number of entries in the list, followed by the list itself. Each entry in the list describes a module (dynamically loaded objects which were loaded in the process when it crashed (or when the minidump was generated). The code for reading the list is relatively straight-forward, with a single gotcha. Some minidump writers are emitting padding after the "count" field in order to align the subsequent list on 8 byte boundary (this depends on how their ModuleList type was defined and the native alignment of various types on their platform). Fortunately, the minidump format contains enough redundancy (in the form of the stream length field in the stream directory), which allows us to detect this situation and correct it. This patch just adds the ability to parse the stream. Code for conversion to/from yaml will come in a follow-up patch. Reviewers: zturner, amccarth, jhenderson, clayborg Subscribers: jdoerfert, markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60121 llvm-svn: 357897
* Minidump: Add support for reading/writing stringsPavel Labath2019-04-051-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Strings in minidump files are stored as a 32-bit length field, giving the length of the string in *bytes*, which is followed by the appropriate number of UTF16 code units. The string is also supposed to be null-terminated, and the null-terminator is not a part of the length field. This patch: - adds support for reading these strings out of the minidump file (this implementation does not depend on proper null-termination) - adds support for writing them to a minidump file - using the previous two pieces implements proper (de)serialization of the CSDVersion field of the SystemInfo stream. Previously, this was only read/written as hex, and no attempt was made to access the referenced string -- now this string is read and written correctly. The changes are tested via yaml2obj|obj2yaml round-trip as well as a unit test which checks the corner cases of the string deserialization logic. Reviewers: jhenderson, zturner, clayborg Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59775 llvm-svn: 357749
* Fix two more issues with r356652Pavel Labath2019-03-212-134/+130
| | | | | | | | | | | | The first problem was a use-after-free in the tests (detected by asan bots). The temporary array created for the "create" call is guaranteed to live only until the end of the statement. The fix there is to store the test data in a local variable to ensure it has the right lifetime The second issue is broken BUILD_SHARED_LIBS build, which I fix by adding the appropriate BinaryFormat dependency to the Object unit tests. llvm-svn: 356655
* [Object] Add basic minidump supportPavel Labath2019-03-212-0/+258
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds basic support for reading minidump files. It contains the definitions of various important minidump data structures (header, stream directory), and of one minidump stream (SystemInfo). The ability to read other streams will be added in follow-up patches. However, all streams can be read even now as raw data, which means lldb's minidump support (where this code is taken from) can be immediately rebased on top of this patch as soon as it lands. As we don't have any support for generating minidump files (yet), this tests the code via unit tests with some small handcrafted binaries in the form of c char arrays. Reviewers: Bigcheese, jhenderson, zturner Subscribers: srhines, dschuff, mgorny, fedor.sergeev, lemo, clayborg, JDevlieghere, aprantl, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59291 llvm-svn: 356652
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-192-8/+6
| | | | | | | | | | | | | | | | | 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
* Fix unittest for buildbot with mips host (32bit big endian) from r295174David Bozier2017-02-151-6/+4
| | | | llvm-svn: 295188
* Attempt to fix buildbots after commit of r295173. David Bozier2017-02-151-1/+11
| | | | | | Unit tests needed to check on the endianness of the host platform. (Test was failing for big endian hosts). llvm-svn: 295174
* Fix incorrect formatting of DataRefImpl members in operator<< functionDavid Bozier2017-02-152-0/+35
| | | | | | | | | | | Changed format specifiers to use format macro constant for pointer type. Moved width part of format specifier in the correct place for formatting members a and b. Added a unit test to confirm the output. Differential Revision: https://reviews.llvm.org/D28957 llvm-svn: 295173
* Fix llvm-symbolizer to correctly sort a symbol array and calculate symbol sizesKuba Brecka2016-11-152-0/+41
| | | | | | | | Sometimes, llvm-symbolizer gives wrong results due to incorrect sizes of some symbols. The reason for that was an incorrectly sorted array in computeSymbolSizes. The comparison function used subtraction of unsigned types, which is incorrect. Let's change this to return explicit -1 or 1. Differential Revision: https://reviews.llvm.org/D26537 llvm-svn: 287028
* Invert the MC -> Object dependency.Rafael Espindola2014-07-034-102/+0
| | | | | | | | | Now that we have a lib/MC/MCAnalysis, the dependency was there just because of two helper classes. Move the two over to MC. This will allow IRObjectFile to parse inline assembly. llvm-svn: 212248
* ELFObjectWriter: deduplicate suffices in strtabHans Wennborg2014-04-302-0/+41
| | | | | | | | | | | | | | | We already do this for shstrtab, so might as well do it for strtab. This extracts the string table building code into a separate class. The idea is to use it for other object formats too. I mostly wanted to do this for the general principle, but it does save a little bit on object file size. I tried this on a clang bootstrap and saved 0.54% on the sum of object file sizes (1.14 MB out of 212 MB for a release build). Differential Revision: http://reviews.llvm.org/D3533 llvm-svn: 207670
* Object: Don't double-escape empty hexdataDavid Majnemer2014-03-201-1/+1
| | | | | | | We would emit a pair of double quotes inside a pair of single quotes. Just use a pair of single quotes. llvm-svn: 204312
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-101-1/+2
| | | | llvm-svn: 196908
* Update incorrect file headers.Sean Silva2013-08-011-1/+1
| | | | | | One of these was spotted in review by Rafael. llvm-svn: 187598
* Attempt at fixing a mingw bot.Rafael Espindola2013-07-131-2/+0
| | | | | | | | | It is failing with YAMLTest.cpp:38: instantiated from here YAMLTraits.h:226: error: 'llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping' is not a valid template argument for type 'void (*)(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' because function 'static void llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' has not external linkage llvm-svn: 186245
* Make BinaryRef output correctly in case of empty data.Sean Silva2013-07-093-0/+62
Previously, it would simply output nothing, but it should output an empty string `""`. llvm-svn: 185894
OpenPOWER on IntegriCloud