1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

DebugInfo: Hash DIE referevences (DW_OP_convert) when computing Split DWARF signatures

This commit is contained in:
David Blaikie 2020-10-22 20:08:54 -07:00
parent a4afb246fb
commit f4f0edfc5e
5 changed files with 20 additions and 3 deletions

View File

@ -247,6 +247,7 @@ public:
unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;
void print(raw_ostream &O) const;
uint64_t getIndex() const { return Index; }
};
//===--------------------------------------------------------------------===//

View File

@ -12,6 +12,7 @@
#include "DIEHash.h"
#include "ByteStreamer.h"
#include "DwarfCompileUnit.h"
#include "DwarfDebug.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
@ -214,7 +215,15 @@ void DIEHash::hashDIEEntry(dwarf::Attribute Attribute, dwarf::Tag Tag,
// all of the data is going to be added as integers.
void DIEHash::hashBlockData(const DIE::const_value_range &Values) {
for (const auto &V : Values)
Hash.update((uint64_t)V.getDIEInteger().getValue());
if (V.getType() == DIEValue::isBaseTypeRef) {
const DIE &C =
*CU->ExprRefedBaseTypes[V.getDIEBaseTypeRef().getIndex()].Die;
StringRef Name = getDIEStringAttr(C, dwarf::DW_AT_name);
assert(!Name.empty() &&
"Base types referenced from DW_OP_convert should have a name");
hashNestedType(C, Name);
} else
Hash.update((uint64_t)V.getDIEInteger().getValue());
}
// Hash the contents of a loclistptr class.

View File

@ -31,7 +31,8 @@ class DIEHash {
};
public:
DIEHash(AsmPrinter *A = nullptr) : AP(A) {}
DIEHash(AsmPrinter *A = nullptr, DwarfCompileUnit *CU = nullptr)
: AP(A), CU(CU) {}
/// Computes the CU signature.
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die);
@ -101,6 +102,7 @@ private:
private:
MD5 Hash;
AsmPrinter *AP;
DwarfCompileUnit *CU;
DenseMap<const DIE *, unsigned> Numbering;
};
}

View File

@ -1288,7 +1288,7 @@ void DwarfDebug::finalizeModuleInfo() {
Asm->TM.Options.MCOptions.SplitDwarfFile);
// Emit a unique identifier for this CU.
uint64_t ID =
DIEHash(Asm).computeCUSignature(DWOName, TheCU.getUnitDie());
DIEHash(Asm, &TheCU).computeCUSignature(DWOName, TheCU.getUnitDie());
if (getDwarfVersion() >= 5) {
TheCU.setDWOId(ID);
SkCU->setDWOId(ID);

View File

@ -19,6 +19,11 @@
; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable | llvm-dwarfdump - \
; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
; Test DW_OP_convert + Split DWARF
; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
; RUN: | FileCheck %s --check-prefix=CONV --check-prefix=SPLITCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
; SPLITCONV: Compile Unit:{{.*}} DWO_id = 0xe91d8d1d7f9782c0
; SPLIT: DW_TAG_skeleton_unit
; CONV: DW_TAG_compile_unit