aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-07-16Split DWARFFormValue::getReference into four functions (#98905)Pavel Labath1-49/+138
The result of the function cannot be correctly interpreted without knowing the precise form type (a type signature needs to be looked up very differently from a supplementary debug info reference). The function sort of worked because the two reference types (unit-relative and section-relative) that can be handled uniformly are also the most common types of references, but this setup made it easy to write code which does not support other kinds of reference (and if one tried to support them, the result didn't look pretty -- https://github.com/llvm/llvm-project/pull/97423/files#r1676217081). The split is based on the reference type classification from DWARFv5 (Section 7.5.5 Classes and Forms), and it should enable uniform (if slightly more verbose) hadling. Note that this only affects users which want more control of how (or if) the references are resolved. Users which just want to access the referenced DIE can use the higher level API (DWARFDie::GetAttributeValueAsReferencedDie) which returns (or will return after #97423 is merged) the correct die for all reference types (except for supplementary references, which we don't support right now).
2023-12-07[libDebugInfo] Prevent infinite recursion in DWARFDie::getTypeSize() (#74681)Adrian Prantl1-0/+36
when run on invalid input.
2023-11-10[AIX] Enable tests relating to 64-bit XCOFF object files (#71814)Jake Egan1-57/+13
We now have 64-bit XCOFF object file support, so these tests can be enabled again. However, some tests still fail due to unsupported debug sections, so I cleaned up their comments.
2023-10-22[llvm] Stop including llvm/ADT/SmallString.h (NFC)Kazu Hirata1-1/+0
Identified with misc-include-cleaner.
2023-10-18[DebugInfo] Separate error generation from reporting in ↵Alex Langford1-1/+5
DWARFHeaderUnit::extract (#68242) Instead of reporting the error directly through the DWARFContext passed in as an argument, it would be more flexible to have extract return the error and allow the caller to react appropriately. This will be useful for using llvm's DWARFHeaderUnit from lldb which may report header extraction errors through a different mechanism.
2023-10-03[llvm] Remove unused using decls (NFC)Kazu Hirata1-1/+0
Identified with misc-unused-using-decls.
2023-06-25[llvm] Add missing StringExtras.h includesElliot Goodrich1-0/+1
In preparation for removing the `#include "llvm/ADT/StringExtras.h"` from the header to source file of `llvm/Support/Error.h`, first add in all the missing includes that were previously included transitively through this header.
2023-04-14[AIX] enable the cases that are excluded by XCOFF 64 integrated-as supportChen Zheng1-22/+5
These case are excluded in https://reviews.llvm.org/D113049. Now AIX XCOFF 64 integrated-as support improves a lot and all these cases pass now, so enable them.
2023-02-10[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 casesBenjamin Maxwell1-2/+7
This fixes a few places where the addrx3 and strx3 forms were missed. Previously this meant if one of these forms appeared somewhere various errors could occur. This now also adds an extra test case for the addrx3 form (which previously failed). Differential Revision: https://reviews.llvm.org/D143488
2023-02-07[NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott1-1/+1
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
2023-02-06[DebugInfo] Handle fixed-width DW_FORM_addrx variants in ↵Benjamin Maxwell1-1/+40
DWARFFormValue::getAsSectionedAddress() Previously this would incorrectly return the raw offset into the .debug_addr section for the DW_FORM_addrx1/2/3/4 forms rather than the actual address. Note that this was handled correctly in the dump() function so this issue only occurs for users of this API and not in tools such as llvm-dwarfdump. The dump() method has now been updated to use this method to increase coverage. This also now adds a few unit tests for indexed addresses to DWARFDebugInfoTest. Differential Revision: https://reviews.llvm.org/D143073
2022-12-17std::optional::value => operator*/operator->Fangrui Song1-8/+8
value() has undesired exception checking semantics and calls __throw_bad_optional_access in libc++. Moreover, the API is unavailable without _LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). This fixes check-llvm.
2022-12-05Remove unused #include "llvm/ADT/Optional.h"Fangrui Song1-1/+0
2022-12-05[DebugInfo] llvm::Optional => std::optionalFangrui Song1-13/+13
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-09-20Change isLittleEndian to follow llvm style and add an accessorShubham Sandeep Rastogi1-0/+1
Differential Revision: https://reviews.llvm.org/D134290
2022-07-14[test] Remove zlib-gnu testsFangrui Song1-34/+0
2022-07-13[llvm] Use value instead of getValue (NFC)Kazu Hirata1-8/+8
2022-07-12[llvm] Use has_value instead of hasValue (NFC)Kazu Hirata1-51/+51
2022-06-25Revert "Don't use Optional::hasValue (NFC)"Kazu Hirata1-59/+59
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.
2022-06-25Don't use Optional::hasValue (NFC)Kazu Hirata1-59/+59
2022-06-25[llvm] Don't use Optional::{hasValue,getValue} (NFC)Kazu Hirata1-4/+3
2022-06-19Use value_or instead of getValueOr (NFC)Kazu Hirata1-3/+3
2022-06-10[MC] De-capitalize SwitchSection. NFCFangrui Song1-2/+2
Add SwitchSection to return switchSection. The API will be removed soon.
2022-02-15Cleanup LLVMDWARFDebugInfoserge-sans-paille1-0/+1
As usual with that header cleanup series, some implicit dependencies now need to be explicit: llvm/DebugInfo/DWARF/DWARFContext.h no longer includes: - "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h" - "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" - "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h" - "llvm/DebugInfo/DWARF/DWARFDebugAranges.h" - "llvm/DebugInfo/DWARF/DWARFDebugFrame.h" - "llvm/DebugInfo/DWARF/DWARFDebugLoc.h" - "llvm/DebugInfo/DWARF/DWARFDebugMacro.h" - "llvm/DebugInfo/DWARF/DWARFGdbIndex.h" - "llvm/DebugInfo/DWARF/DWARFSection.h" - "llvm/DebugInfo/DWARF/DWARFTypeUnit.h" - "llvm/DebugInfo/DWARF/DWARFUnitIndex.h" Plus llvm/Support/Errc.h not included by a bunch of llvm/DebugInfo/DWARF/DWARF*.h files Preprocessed lines to build llvm on my setup: after: 1065629059 before: 1066621848 Which is a great diff! Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D119723
2022-01-09[AIX] Disable tests that fail because of no 64-bit XCOFF object file supportJake Egan1-0/+28
The modified tests fail because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on 64-bit AIX for now. This patch is similar to D111887 except the failures on this patch are on a 64-bit build. Reviewed By: shchenz, #powerpc Differential Revision: https://reviews.llvm.org/D113049
2021-12-22[unittest][DebugInfo/DWARF] Do not report skipped tests as passedIgor Kudrin1-13/+13
This is similar to what we have already done to some other tests. See D102643, D102710, D102754. Differential Revision: https://reviews.llvm.org/D116108
2021-12-22[unittest][DebugInfo/DWARF] Do not create dwarfgen::Generator if ↵Igor Kudrin1-12/+12
MCAsmBackend is missing dwarfgen::Generator cannot be created if there is no asm backend for a target. For example, if the default target triple is nvptx-nvidia-cuda, some tests fail even after D98400, which added checks for most cases. This patch extends the approach to the remaining cases. Differential Revision: https://reviews.llvm.org/D116107
2021-12-14DebugInfo: Migrate callers from getAsCString to dwarf::toStringDavid Blaikie1-1/+1
This makes a bunch of these call sites independent of a follow-up change I'm making to have getAsCString return Expected<const char*> for more descriptive error messages so that the failures there can be communicated up to DWARFVerifier (or other callers who want to provide more verbose diagnostics) so DWARFVerifier doesn't have to re-implement the string lookup logic and error checking.
2021-10-18[AIX] Disable tests failing due to lack of 64-bit XCOFF object file supportJake Egan1-0/+48
The following tests are failing because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on AIX for now. Reviewed By: shchenz Differential Revision: https://reviews.llvm.org/D111887
2021-10-08Move TargetRegistry.(h|cpp) from Support to MCReid Kleckner1-1/+1
This moves the registry higher in the LLVM library dependency stack. Every client of the target registry needs to link against MC anyway to actually use the target, so we might as well move this out of Support. This allows us to ensure that Support doesn't have includes from MC/*. Differential Revision: https://reviews.llvm.org/D111454
2021-10-08[AIX] Disable tests failing due to missing DWARF sectionsJake Egan1-0/+12
The following tests are failing due to missing DWARF sections. This patch sets these tests as XFAIL/DISABLED on AIX until a more permanent solution is implemented. Reviewed By: shchenz Differential Revision: https://reviews.llvm.org/D111336
2021-09-01[DWARF] Find offset of attribute.Alexander Yermolovich1-0/+8
This is used by BOLT to do patching of DebugInfo section, and Line Table. Directly by using find, and through getAttrFieldOffsetForUnit. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D107874
2021-08-13Migrate DWARFVerifier tests to lit-based yaml instead of gtest with embedded ↵David Blaikie1-1050/+1
yaml Improves maintainability (edit/modify the tests without recompiling) and error messages (previously the failure would be a gtest failure mentioning nothing of the input or desired text) and the option to improve tests with more checks. (maybe these tests shouldn't all be in separate files - we could probably have DWARF yaml that contains multiple errors while still being fairly maintainable - the various invalid offsets (ref_addr, rnglists, ranges, etc) could probably be all in one test, but for the simple sake of the migration I just did the mechanical thing here)
2021-08-02[DWARF] Don't process .debug_info relocations for DWO ContextAlexander Yermolovich1-2/+3
When we build with split dwarf in single mode the .o files that contain both "normal" debug sections and dwo sections, along with relocaiton sections for "normal" debug sections. When we create DWARF context in DWARFObjInMemory we process relocations and store them in the map for .debug_info, etc section. For DWO Context we also do it for non dwo dwarf sections. Which I believe is not necessary. This leads to a lot of memory being wasted. We observed 70GB extra memory being used. I went with context sensitive approach, flag is passed in. I am not sure if it's always safe not to process relocations for regular debug sections if Obj contains .dwo sections. If it is alternatvie might be just to scan, in constructor, sections and if there are .dwo sections not to process regular debug ones. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D106624
2021-03-18[Test][DebugInfo] Check for backend object emission support.Nigel Perks1-12/+12
The XCore backend does not support object emission. Several tests fail for this reason when XCore is the default target. See staging buildbot builder: clang-xcore-ubuntu-20-x64. So check for backend object emission before running the tests requiring it. Incorporate isConfigurationSupported functionality in isObjectEmissionSupported, to avoid calling them both in the same tests. Differential Revision: https://reviews.llvm.org/D98400
2020-08-31[Test] Simplify DWARF test cases. NFC.Xing GUO1-58/+20
The Length, AbbrOffset and Values fields of the debug_info section are optional. This patch helps remove them and simplify test cases. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D86857
2020-08-29[DWARFYAML] Make the debug_abbrev_offset field optional.Xing GUO1-21/+0
This patch helps make the debug_abbrev_offset field optional. We don't need to calculate the value of this field in the future. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D86614
2020-08-26[DWARFYAML] Make the unit_length and header_length fields optional.Xing GUO1-15/+5
This patch makes the unit_length and header_length fields of line tables optional. yaml2obj is able to infer them for us. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D86590
2020-08-25[DWARFYAML] Make the 'Attributes' field optional.Xing GUO1-1/+0
This patch makes the 'Attributes' field optional. We don't need to explicitly specify the 'Attributes' field in the future. Reviewed By: jhenderson, grimar Differential Revision: https://reviews.llvm.org/D86537
2020-08-21Recommit: [DWARFYAML] Add support for referencing different abbrev tables.Xing GUO1-0/+1
The original commit (7ff0ace96db9164dcde232c36cab6519ea4fce8) was causing build failure and was reverted in 6d242a73264ef1e3e128547f00e0fe2d20d3ada0 ==================== Original Commit Message ==================== This patch adds support for referencing different abbrev tables. We use 'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly assign an abbrev table to compilation units. The syntax is: ``` debug_abbrev: - ID: 0 Table: ... - ID: 1 Table: ... debug_info: - ... AbbrevTableID: 1 ## Reference the second abbrev table. - ... AbbrevTableID: 0 ## Reference the first abbrev table. ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D83116
2020-08-21Revert "[DWARFYAML] Add support for referencing different abbrev tables."Xing GUO1-1/+0
This reverts commit f7ff0ace96db9164dcde232c36cab6519ea4fce8. This change is causing build failure. http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/10400
2020-08-21[DWARFYAML] Add support for referencing different abbrev tables.Xing GUO1-0/+1
This patch adds support for referencing different abbrev tables. We use 'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly assign an abbrev table to compilation units. The syntax is: ``` debug_abbrev: - ID: 0 Table: ... - ID: 1 Table: ... debug_info: - ... AbbrevTableID: 1 ## Reference the second abbrev table. - ... AbbrevTableID: 0 ## Reference the first abbrev table. ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D83116
2020-08-21[DWARFYAML] Add support for emitting multiple abbrev tables.Xing GUO1-258/+278
This patch adds support for emitting multiple abbrev tables. Currently, compilation units will always reference the first abbrev table. Reviewed By: jhenderson, labath Differential Revision: https://reviews.llvm.org/D86194
2020-07-23[DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.Xing GUO1-1/+1
This patch refactors `emitDebugInfo()` to make the length field be inferred from its content. Besides, the `Visitor` class is removed in this patch. The original `Visitor` class helps us determine an appropriate length and emit the .debug_info section. These two processes can be merged into one process. Besides, the length field should be inferred when it's missing rather than when it's zero. Reviewed By: jhenderson, labath Differential Revision: https://reviews.llvm.org/D84008
2020-07-22[DWARFYAML] Make the length field of compilation units optional. NFC.Xing GUO1-2/+1
This patch makes the length field of compilation units optional (0 by default).
2020-06-30[DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.Xing GUO1-42/+21
'InitialLength' is replaced with 'Format' (DWARF32 by default) and 'Length' in this patch. Besides, test cases for DWARFv4 and DWARFv5, DWARF32 and DWARF64 is added. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D82622
2020-06-13Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and ↵Xing GUO1-10/+5
`Length`." This recommits fcc0c186e9cea0af644581069058f0e00469d20e
2020-06-08[DWARFYAML] Rename function names to match the coding style. NFC.Xing GUO1-20/+20
2020-04-28[llvm/DebugInfo] Fix invalid verifier error for DWARF5Jonas Devlieghere1-0/+38
We unconditionally compared the DW_AT_ranges offset to the length of the .debug_ranges section. For DWARF5 we should look at the debug_rnglists section instead. Differential revision: https://reviews.llvm.org/D78971
2020-04-27[llvm/DebugInfo] Print DW_AT_ranges offset as part of verifier error.Jonas Devlieghere1-2/+3
Print the DW_AT_ranges offset as part of the verifier error, like we do for the DW_AT_stmt_list offset.