-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[lldb] Enable support for DWARF64 format handling #145645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a85d648
[lldb][DWARF64] Enable support for DWARF64 format handling
HemangGadhavi 845b1c5
Added testcase for the DWARF64 and review comments
HemangGadhavi edeb253
Addressed review comment
HemangGadhavi a6244b9
Update lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp
HemangGadhavi f622d2b
Updated ReleaseNotes
HemangGadhavi 5e86233
small correction
HemangGadhavi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| //===-- DWARF64UnitTest.cpp--------------------------------------------=---===// | ||
HemangGadhavi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h" | ||
| #include "Plugins/SymbolFile/DWARF/DWARFUnit.h" | ||
| #include "TestingSupport/Symbol/YAMLModuleTester.h" | ||
|
|
||
| using namespace lldb_private; | ||
| using namespace lldb_private::dwarf; | ||
| using namespace lldb_private::plugin::dwarf; | ||
|
|
||
| TEST(DWARF64UnitTest, DWARF64DebugInfoAndCU) { | ||
| const char *yamldata = R"( | ||
| --- !ELF | ||
| FileHeader: | ||
| Class: ELFCLASS64 | ||
| Data: ELFDATA2LSB | ||
| Type: ET_EXEC | ||
| Machine: EM_PPC64 | ||
| DWARF: | ||
| debug_str: | ||
| - 'clang version 18.1.8 (clang-18.1.8-1)' | ||
| - 'main' | ||
| debug_abbrev: | ||
| - Table: | ||
| - Code: 0x1 | ||
| Tag: DW_TAG_compile_unit | ||
| Children: DW_CHILDREN_yes | ||
| Attributes: | ||
| - Attribute: DW_AT_producer | ||
| Form: DW_FORM_strp | ||
| - Attribute: DW_AT_language | ||
| Form: DW_FORM_data2 | ||
| - Attribute: DW_AT_stmt_list | ||
| Form: DW_FORM_sec_offset | ||
| - Attribute: DW_AT_low_pc | ||
| Form: DW_FORM_addr | ||
| - Attribute: DW_AT_high_pc | ||
| Form: DW_FORM_data4 | ||
| - Code: 0x02 | ||
| Tag: DW_TAG_subprogram | ||
| Children: DW_CHILDREN_no | ||
| Attributes: | ||
| - Attribute: DW_AT_name | ||
| Form: DW_FORM_strp | ||
| debug_info: | ||
| - Format: DWARF64 | ||
| Version: 4 | ||
| AbbrOffset: 0x0 | ||
| AddrSize: 8 | ||
| Entries: | ||
| - AbbrCode: 0x1 | ||
| Values: | ||
| - Value: 0x0 | ||
| - Value: 0x04 | ||
| - Value: 0x0 | ||
| - Value: 0xdeadbeef | ||
| - Value: 0xdeadbeef | ||
| - AbbrCode: 0x2 | ||
| Values: | ||
| - Value: 0x1 | ||
| - AbbrCode: 0x0 | ||
| )"; | ||
|
|
||
| YAMLModuleTester t(yamldata); | ||
| auto *symbol_file = | ||
| llvm::cast<SymbolFileDWARF>(t.GetModule()->GetSymbolFile()); | ||
| DWARFUnit *unit = symbol_file->DebugInfo().GetUnitAtIndex(0); | ||
| ASSERT_TRUE(unit); | ||
| ASSERT_EQ(unit->GetFormParams().Format, DwarfFormat::DWARF64); | ||
| ASSERT_EQ(unit->GetVersion(), 4); | ||
| ASSERT_EQ(unit->GetAddressByteSize(), 8); | ||
|
|
||
| DWARFFormValue form_value; | ||
| const DWARFDebugInfoEntry *cu_entry = unit->DIE().GetDIE(); | ||
| ASSERT_EQ(cu_entry->Tag(), DW_TAG_compile_unit); | ||
| ASSERT_EQ(unit->GetProducer(), eProducerClang); | ||
| ASSERT_EQ(unit->GetDWARFLanguageType(), DW_LANG_C_plus_plus); | ||
| auto attrs = cu_entry->GetAttributes(unit, DWARFDebugInfoEntry::Recurse::yes); | ||
| attrs.ExtractFormValueAtIndex(2, form_value); // Validate DW_AT_stmt_list | ||
| ASSERT_EQ(form_value.Unsigned(), 0UL); | ||
| attrs.ExtractFormValueAtIndex(3, form_value); // Validate DW_AT_low_pc | ||
| ASSERT_EQ(form_value.Unsigned(), 0xdeadbeef); | ||
| attrs.ExtractFormValueAtIndex(4, form_value); // Validate DW_AT_high_pc | ||
| ASSERT_EQ(form_value.Unsigned(), 0xdeadbeef); | ||
HemangGadhavi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| DWARFDIE cu_die(unit, cu_entry); | ||
| auto declaration = cu_die.GetFirstChild(); | ||
| ASSERT_TRUE(declaration.IsValid()); | ||
| ASSERT_EQ(declaration.Tag(), DW_TAG_subprogram); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.