summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [DWARF] Minor code style modification, no functionality change.Spyridoula Gravani2017-07-271-8/+5
| | | | llvm-svn: 309240
* [DWARF] Generalized verification of .apple_names accelerator table to be ↵Spyridoula Gravani2017-07-261-4/+1
| | | | | | | | applicable to any acceleration table. Added verification for .apple_types, .apple_namespaces and .apple_objc sections. Differential Revision: https://reviews.llvm.org/D35853 llvm-svn: 309068
* Move DWARFSectionMap to a .cpp file.Rafael Espindola2017-07-241-0/+6
| | | | | | Thanks to Paul Robinson for the suggestion. llvm-svn: 308913
* [DWARF] Added check that verifies that no abbreviation declaration has more ↵Spyridoula Gravani2017-07-201-0/+1
| | | | | | | | | | | | | than one attribute with the same name. SUMMARY This patch adds a verification check on the abbreviation declarations in the .debug_abbrev section. The check makes sure that no abbreviation declaration has more than one attributes with the same name. Differential Revision: https://reviews.llvm.org/D35643 llvm-svn: 308579
* Use llvm::make_unique once more to avoid ADL ambiguity with std::make_uniqueReid Kleckner2017-07-191-2/+3
| | | | llvm-svn: 308552
* Use llvm::make_unique to try to fix the windows build.Rafael Espindola2017-07-191-2/+2
| | | | llvm-svn: 308551
* Remove some leftover DWARFContextInMemory.Rafael Espindola2017-07-191-14/+0
| | | | | | Not sure how I missed these on the previous commit. llvm-svn: 308550
* Use delegation instead of inheritance.Rafael Espindola2017-07-191-229/+394
| | | | | | | | | | This changes DwarfContext to delegate to DwarfObject instead of having pure virtual methods. With this DwarfContextInMemory is replaced with an implementation of DwarfObject that is local to a .cpp file. llvm-svn: 308543
* [DWARF] Modification of code for the verification of .debug_info section.Spyridoula Gravani2017-07-181-2/+0
| | | | | | | | | | | | | | | Summary: This patch modifies the handleDebugInfo() function so that we verify the contents of each unit in the .debug_info section only if its header has been successfully verified. This change will allow for more/different verification checks depending on the type of the unit since from dwarf5, the .debug_info section may consist of different types of units. Subscribers: aprantl Differential Revision: https://reviews.llvm.org/D35521 llvm-svn: 308245
* [DWARF] Introduce verification for the unit header chain in .debug_info ↵Spyridoula Gravani2017-07-131-0/+2
| | | | | | | | | | | | | | | section to llvm-dwarfdump. This patch adds verification checks for the unit header chain in the .debug_info section. Specifically, for each unit in the .debug_info section, the verifier checks that: The unit length is valid (i.e. the unit can actually fit in the .debug_info section) The dwarf version of the unit is valid The address size is valid (4 or 8) The unit type (if the unit is in dwarf5) is valid The debug_abbrev_offset is valid llvm-svn: 307975
* [DWARF] Fixing a bug with processing of DWARF v5 indexed strings in Mach-O ↵Wolfgang Pieb2017-07-131-4/+4
| | | | | | | | | | | objects. Code to convert MachO - specific section debug section names to standard DWARF v5 section names was in the wrong place. Differential Revision: https://reviews.llvm.org/D35321 llvm-svn: 307872
* Don't expose a map in the DWARFContext interface.Rafael Espindola2017-07-121-6/+6
| | | | | | | | | Doing so is leaking an implementation detail. I have an implementation that uses the lld infrastructure and doesn't use a map or object::SectionRef. llvm-svn: 307846
* [DWARF] - Rename variable. NFC.George Rimar2017-07-101-3/+3
| | | | | | | | | | | | Variable was called 'Name' and contained text name of relocation type. Problem was that outside of this error handling scope we already have different 'Name' variable that contains section name. Change helps to avoid confusion. llvm-svn: 307530
* [DWARF] - Remove unused variables. NFC.George Rimar2017-07-101-6/+2
| | | | llvm-svn: 307528
* Fix variable names. NFC.Rafael Espindola2017-07-071-18/+18
| | | | llvm-svn: 307406
* Reduce code duplication.Rafael Espindola2017-07-071-33/+27
| | | | | | | By addding a mapNameToDWARFSection we only need to check section names in one place. llvm-svn: 307359
* [DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.Paul Robinson2017-06-291-34/+23
| | | | | | | | | | | Requires callers to directly associate relocations with a DataExtractor used to read data from a DWARF section, which helps a callee not make assumptions about which section it is reading. This is the next step in reducing DWARFFormValue's dependence on DWARFUnit. Differential Revision: https://reviews.llvm.org/D34704 llvm-svn: 306699
* [DWARF] - Fix message reporting about broken relocation.George Rimar2017-06-291-1/+1
| | | | | | | | | | | | | Because of mistake introduced in r306517, wrong variable ("name" instead of "Name") was used in error message. As a result it reported section name instead of relocation name. This file still needs cleanup to match LLVM coding style and more tests I think. llvm-svn: 306677
* Recommit "[ELF] - Add ability for DWARFContextInMemory to exit early when ↵George Rimar2017-06-281-9/+21
| | | | | | | | | | | | | | | | | | | | | any error happen." With fix in include folder character case: #include "llvm/Codegen/AsmPrinter.h" -> #include "llvm/CodeGen/AsmPrinter.h" Original commit message: Change introduces error reporting policy for DWARFContextInMemory. New callback provided by client is able to handle error on it's side and return Halt or Continue. That allows to either keep current behavior when parser prints all errors but continues parsing object or implement something very different, like stop parsing on a first error and report an error in a client style. Differential revision: https://reviews.llvm.org/D34328 llvm-svn: 306517
* Revert r306512 "[ELF] - Add ability for DWARFContextInMemory to exit early ↵George Rimar2017-06-281-21/+9
| | | | | | | | | | | | | | | | | when any error happen." It broke BB: [13/106] 13 0.022 Generating VCSRevision.h [25/106] 24 1.209 Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o FAILED: unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o /home/bb/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_GLOBAL_ISEL -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/DebugInfo/DWARF -I../llvm-project/llvm/unittests/DebugInfo/DWARF -Iinclude -I../llvm-project/llvm/include -I../llvm-project/llvm/utils/unittest/googletest/include -I../llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -m32 -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -UNDEBUG -Wno-variadic-macros -fno-exceptions -fno-rtti -MD -MT unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -MF unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o.d -o unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugInfoTest.cpp.o -c ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp ../llvm-project/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:18:37: fatal error: llvm/Codegen/AsmPrinter.h: No such file or directory #include "llvm/Codegen/AsmPrinter.h" ^ compilation terminated. llvm-svn: 306513
* [ELF] - Add ability for DWARFContextInMemory to exit early when any error ↵George Rimar2017-06-281-9/+21
| | | | | | | | | | | | | | | | happen. Change introduces error reporting policy for DWARFContextInMemory. New callback provided by client is able to handle error on it's side and return Halt or Continue. That allows to either keep current behavior when parser prints all errors but continues parsing object or implement something very different, like stop parsing on a first error and report an error in a client style. Differential revision: https://reviews.llvm.org/D34328 llvm-svn: 306512
* [DebugInfo] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko2017-06-231-8/+7
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 306169
* [DWARF] Removed dead code. The verifier functionality is provided bySpyridoula Gravani2017-06-151-242/+0
| | | | | | the DWARFVerifier class (as it should). llvm-svn: 305503
* Added partial verification for .apple_names accelerator table in ↵Spyridoula Gravani2017-06-141-0/+5
| | | | | | | | | | | llvm-dwarfdump output. This patch adds code which verifies that each bucket in the .apple_names accelerator table is either empty or has a valid hash index. Differential Revision: https://reviews.llvm.org/D34177 llvm-svn: 305344
* dwarfdump: Handle relocs to zlib (.zdebug*) compressed sectionsDavid Blaikie2017-06-101-1/+1
| | | | llvm-svn: 305152
* Introduce -brief command line option to llvm-dwarfdumpAdrian Prantl2017-06-061-2/+2
| | | | | | | | | | | | | This patch introduces a new command line option, called brief, to llvm-dwarfdump. When -brief is used, the attribute forms for the .debug_info section will not be emitted to output. Patch by Spyridoula Gravani! rdar://problem/21474365 Differential Revision: https://reviews.llvm.org/D33867 llvm-svn: 304844
* [DWARF] Adding support for the DWARF v5 string offsets table ↵Wolfgang Pieb2017-06-061-12/+133
| | | | | | | | | | (consumer/reader part only). Reviewers: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D32779 llvm-svn: 304759
* [DWARF] Introduce Dump OptionsAdrian Prantl2017-06-011-2/+6
| | | | | | | | | | | This commit introduces a structure that holds all the flags that control the pretty printing of dwarf output. Patch by Spyridoula Gravani! Differential Revision: https://reviews.llvm.org/D33749 llvm-svn: 304446
* Recommit "[DWARF] - Make collectAddressRanges() return section index in ↵George Rimar2017-05-271-23/+36
| | | | | | | | | | | | | | | | | | | | | | addition to Low/High PC" With fix of uninitialized variable. Original commit message: This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 304078
* Revert r304002 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-261-35/+23
| | | | | | | | in addition to Low/High PC" Revert it again. Now another bot unhappy: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/8750 llvm-svn: 304011
* [DWARF] - Make collectAddressRanges() return section index in addition to ↵George Rimar2017-05-261-23/+35
| | | | | | | | | | | | | | | | | | Low/High PC This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 304002
* Revert "[DWARF] - Make collectAddressRanges() return section index in ↵George Rimar2017-05-261-33/+23
| | | | | | | | | | | | addition to Low/High PC" Broked BB again: TEST 'LLVM :: DebugInfo/X86/dbg-value-regmask-clobber.ll' FAILED ... LLVM ERROR: Section was outside of section table. llvm-svn: 303984
* Recommit r303978 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-261-23/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | in addition to Low/High PC" With fix of test compilation. Initial commit message: This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 303983
* Revert r303978 "[DWARF] - Make collectAddressRanges() return section index ↵George Rimar2017-05-261-33/+23
| | | | | | | | in addition to Low/High PC" It failed BB. llvm-svn: 303981
* [DWARF] - Make collectAddressRanges() return section index in addition to ↵George Rimar2017-05-261-23/+33
| | | | | | | | | | | | | | | | | | | | | | Low/High PC This change is intended to use for LLD in D33183. Problem we have in LLD when building .gdb_index is that we need to know section which address range belongs to. Previously it was solved on LLD side by providing fake section addresses with use of llvm::LoadedObjectInfo interface. We assigned file offsets as addressed. Then after obtaining ranges lists, for each range we had to find section ID's. That not only was slow, but also complicated implementation and was the reason of incorrect behavior when sections share the same offsets, like D33176 shows. This patch makes DWARF parsers to return section index as well. That solves problem mentioned above. Differential revision: https://reviews.llvm.org/D33184 llvm-svn: 303978
* libDebugInfo: Support symbolizing using DWP filesDavid Blaikie2017-05-231-7/+41
| | | | llvm-svn: 303609
* libDebugInfo: Avoid independently parsing the same .dwo file for two ↵David Blaikie2017-05-231-0/+22
| | | | | | | | | separate CUs residing there NFC, just an optimization. Will be building on this for DWP support shortly. llvm-svn: 303591
* libDebugInfo/DWARF: Apply relocations for debug_addr addresses in object filesDavid Blaikie2017-05-221-13/+15
| | | | | | | | | | | llvm-symbolizer would fail to symbolize addresses in unlinked object files when handling .dwo file data because the addresses would not be relocated in the same way as the ranges in the skeleton CU in the object file. Fix that so object files can be symbolized the same as executables. llvm-svn: 303532
* [DWARF] - Simplify RelocVisitor implementation.George Rimar2017-05-181-2/+2
| | | | | | | | | We do not need to store relocation width field. Patch removes relative code, that simplifies implementation. Differential revision: https://reviews.llvm.org/D33274 llvm-svn: 303335
* [lib/Object] - Minor API update for llvm::Decompressor.George Rimar2017-05-181-1/+1
| | | | | | | | | | | | | | | | | I revisited Decompressor API (issue with it was triggered during D32865 review) and found it is probably provides more then we really need. Issue was about next method's signature: Error decompress(SmallString<32> &Out); It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out), but then found it is still not flexible because sticks to SmallVector. During reviews was suggested to use templating to simplify code. Patch do that. Differential revision: https://reviews.llvm.org/D33200 llvm-svn: 303331
* [DWARF] - Cleanup relocations proccessing.George Rimar2017-05-171-39/+22
| | | | | | | | | | | | | | | RelocAddrMap was a pair of <width, address>, where width is relocation size (4/8/x, x < 8), and width field was never used in code. Relocations proccessing loop had checks for width field. Does not look like DWARF parser should do that. There is probably no much sense to validate relocations during proccessing them in parser. Patch removes relocation's width relative code from DWARFContext. Differential revision: https://reviews.llvm.org/D33194 llvm-svn: 303251
* [DWARF] - Add RelocAddrEntry for cleanup. NFCi.George Rimar2017-05-161-2/+2
| | | | | | Was mentioned as possible cleanup during review of D33184. llvm-svn: 303171
* [DWARF] - Speedup handling of relocations in DWARFContextInMemory.George Rimar2017-05-151-4/+17
| | | | | | | | | | | | | | | | | | | I am working on a speedup of building .gdb_index in LLD and noticed that relocations that are proccessed in DWARFContextInMemory often uses the same symbol in a row. This patch introduces caching to reduce the relocations proccessing time. For benchmark, I took debug LLC binary objects configured with -ggnu-pubnames and linked it using LLD. Link time without --gdb-index is about 4,45s. Link time with --gdb-index: a) Without patch: 19,16s b) With patch: 15,52s That means time spent on --gdb-index in this configuration is 19,16s - 4,45s = 14,71s (without patch) vs 15,52s - 4,45s = 11,07s (with patch). Differential revision: https://reviews.llvm.org/D31136 llvm-svn: 303051
* [llvm-dwarfdump] - Print an error message if section decompression failed.George Rimar2017-05-051-10/+25
| | | | | | | | | | | | | llvm-dwarfdump currently prints no message if decompression fails for some reason. I noticed that during work on one of LLD patches where LLD produced an broken output. It was a bit confusing to see no output for section dumped and no any error message at all. Patch adds error message for such cases. Differential revision: https://reviews.llvm.org/D32865 llvm-svn: 302221
* Don't return an invalid line table if the DW_AT_stmt_list value is not in ↵Greg Clayton2017-05-041-0/+4
| | | | | | the .debug_line section. llvm-svn: 302180
* Create DWARFVerifier.cpp and .h and move all DWARF verification code over ↵Greg Clayton2017-05-031-7/+8
| | | | | | | | | | into it. Adrian requested we create a DWARFVerifier.cpp file to contain all of the DWARF verification stuff. This change simply moves the functionality over into DWARFVerifier.h and DWARFVerifier.cpp, renames the DWARFVerifier methods to start with lower case, and switches DWARFContext.cpp over to using the new functionality. Differential Revision: https://reviews.llvm.org/D32809 llvm-svn: 302044
* Verify that no compile units share the same line table in "llvm-dwarfdump ↵Greg Clayton2017-05-031-2/+19
| | | | | | | | | | --verify" Check to make sure no compile units have the same DW_AT_stmt_list values. Report a verification error if they do. Differential Revision: https://reviews.llvm.org/D32771 llvm-svn: 302039
* Add line table verification to lldb-dwarfdump --verifyGreg Clayton2017-05-021-0/+73
| | | | | | | | | | | | This patch verifies the .debug_line: - verify all addresses in a line table sequence have ascending addresses - verify that all line table file indexes are valid Unit tests added for both cases. Differential Revision: https://reviews.llvm.org/D32765 llvm-svn: 301984
* Verify that all references point to actual DIEs in "llvm-dwarfdump --verify"Greg Clayton2017-05-021-81/+142
| | | | | | | | | | LTO and other fancy linking previously led to DWARF that contained invalid references. We already validate that CU relative references fall into the CU, and the DW_FORM_ref_addr references fall inside the .debug_info section, but we didn't validate that the references pointed to correct DIE offsets. This new verification will ensure that all references refer to actual DIEs and not an offset in between. This caught a bug in DWARFUnit::getDIEForOffset() where if you gave it any offset, it would match the DIE that mathes the offset _or_ the next DIE. This has been fixed. Differential Revision: https://reviews.llvm.org/D32722 llvm-svn: 301971
* Adds initial llvm-dwarfdump --verify support with unit tests.Greg Clayton2017-05-011-0/+113
| | | | | | | | | | | | | | | | | | lldb-dwarfdump gets a new "--verify" option that will verify a single file's DWARF debug info and will print out any errors that it finds. It will return an non-zero exit status if verification fails, and a zero exit status if verification succeeds. Adding the --quiet option will suppress any output the STDOUT or STDERR. The first part of the verify does the following: - verifies that all CU relative references (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata) have valid CU offsets - verifies that all DW_FORM_ref_addr references have valid .debug_info offsets - verifies that all DW_AT_ranges attributes have valid .debug_ranges offsets - verifies that all DW_AT_stmt_list attributes have valid .debug_line offsets - verifies that all DW_FORM_strp attributes have valid .debug_str offsets Unit tests were added for each of the above cases. Differential Revision: https://reviews.llvm.org/D32707 llvm-svn: 301844
OpenPOWER on IntegriCloud