forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for parsing type unit entries in .debug_names. (llvm#72952)
This is a follow up patch after .debug_names can now emit local type unit entries when we compile with type units + DWARF5 + .debug_names. The pull request that added this functionality was: llvm#70515 This patch makes sure that the DebugNamesDWARFIndex in LLDB will not manually need to parse type units if they have a valid index. It also fixes the index to be able to correctly extract name entries that reference type unit DIEs. Added a test to verify things work as expected.
- Loading branch information
Showing
4 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
48 changes: 48 additions & 0 deletions
48
lldb/test/Shell/SymbolFile/DWARF/x86/debug-types-debug-names.cpp
This file contains 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,48 @@ | ||
// Test that we can use .debug_names to lookup a type that is only referenced | ||
// from within a type unit. In the code below the type named "stype" is only | ||
// referenced within the type unit itself and when we enable .debug_names, we | ||
// expect the have an entry for this and to be able to find this type when | ||
// we do a lookup. | ||
|
||
// REQUIRES: lld | ||
|
||
// RUN: %clang %s -target x86_64-pc-linux -gdwarf-5 -fdebug-types-section \ | ||
// RUN: -gpubnames -fno-limit-debug-info -c -o %t.o | ||
// RUN: ld.lld %t.o -o %t | ||
// RUN: %lldb %t -o "type lookup stype" -b | FileCheck %s --check-prefix=BASE | ||
// RUN: %lldb %t -o "type lookup bar::stype" -b | FileCheck %s --check-prefix=PART | ||
// RUN: %lldb %t -o "type lookup foo::bar::stype" -b | FileCheck %s --check-prefix=FULL | ||
|
||
// BASE: (lldb) type lookup stype | ||
// BASE-NEXT: int | ||
|
||
// PART: (lldb) type lookup bar::stype | ||
// PART-NEXT: int | ||
|
||
// FULL: (lldb) type lookup foo::bar::stype | ||
// FULL-NEXT: int | ||
|
||
namespace foo { | ||
class bar { | ||
public: | ||
typedef unsigned utype; | ||
// This type is only referenced from within the type unit and we need to | ||
// make sure we can find it with the new type unit support in .debug_names. | ||
typedef int stype; | ||
|
||
private: | ||
utype m_unsigned; | ||
|
||
public: | ||
bar(utype u) : m_unsigned(u) {} | ||
|
||
utype get() const { return m_unsigned; } | ||
void set(utype u) { m_unsigned = u; } | ||
stype gets() const { return (stype)m_unsigned; } | ||
}; | ||
} // namespace foo | ||
|
||
int main() { | ||
foo::bar b(12); | ||
return 0; | ||
} |
This file contains 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 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