mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-01 10:57:21 +00:00
Follow-up for r217020: actually commit the fix for PR20800,
revert the accidentally committed changes to LLVMSymbolize.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fac68d2d70
commit
42ebff8c99
@ -437,10 +437,30 @@ class DarwinX86AsmBackend : public X86AsmBackend {
|
|||||||
bool Is64Bit;
|
bool Is64Bit;
|
||||||
|
|
||||||
unsigned OffsetSize; ///< Offset of a "push" instruction.
|
unsigned OffsetSize; ///< Offset of a "push" instruction.
|
||||||
unsigned PushInstrSize; ///< Size of a "push" instruction.
|
|
||||||
unsigned MoveInstrSize; ///< Size of a "move" instruction.
|
unsigned MoveInstrSize; ///< Size of a "move" instruction.
|
||||||
unsigned StackDivide; ///< Amount to adjust stack size by.
|
unsigned StackDivide; ///< Amount to adjust stack size by.
|
||||||
protected:
|
protected:
|
||||||
|
/// \brief Size of a "push" instruction for the given register.
|
||||||
|
unsigned PushInstrSize(unsigned Reg) const {
|
||||||
|
switch (Reg) {
|
||||||
|
case X86::EBX:
|
||||||
|
case X86::ECX:
|
||||||
|
case X86::EDX:
|
||||||
|
case X86::EDI:
|
||||||
|
case X86::ESI:
|
||||||
|
case X86::EBP:
|
||||||
|
case X86::RBX:
|
||||||
|
case X86::RBP:
|
||||||
|
return 1;
|
||||||
|
case X86::R12:
|
||||||
|
case X86::R13:
|
||||||
|
case X86::R14:
|
||||||
|
case X86::R15:
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Implementation of algorithm to generate the compact unwind encoding
|
/// \brief Implementation of algorithm to generate the compact unwind encoding
|
||||||
/// for the CFI instructions.
|
/// for the CFI instructions.
|
||||||
uint32_t
|
uint32_t
|
||||||
@ -530,7 +550,7 @@ protected:
|
|||||||
unsigned Reg = MRI.getLLVMRegNum(Inst.getRegister(), true);
|
unsigned Reg = MRI.getLLVMRegNum(Inst.getRegister(), true);
|
||||||
SavedRegs[SavedRegIdx++] = Reg;
|
SavedRegs[SavedRegIdx++] = Reg;
|
||||||
StackAdjust += OffsetSize;
|
StackAdjust += OffsetSize;
|
||||||
InstrOffset += PushInstrSize;
|
InstrOffset += PushInstrSize(Reg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -724,7 +744,6 @@ public:
|
|||||||
OffsetSize = Is64Bit ? 8 : 4;
|
OffsetSize = Is64Bit ? 8 : 4;
|
||||||
MoveInstrSize = Is64Bit ? 3 : 2;
|
MoveInstrSize = Is64Bit ? 3 : 2;
|
||||||
StackDivide = Is64Bit ? 8 : 4;
|
StackDivide = Is64Bit ? 8 : 4;
|
||||||
PushInstrSize = 1;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -306,26 +306,19 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
// Check if it's a universal binary.
|
// Check if it's a universal binary.
|
||||||
Bin = ParsedBinary.getBinary().get();
|
Bin = ParsedBinary.getBinary().get();
|
||||||
addOwningBinary(std::move(ParsedBinary));
|
addOwningBinary(std::move(ParsedBinary));
|
||||||
errs() << "HERE: " << __FILE__ << ":" << __LINE__ << ", DbgBin: " << DbgBin << "\n";
|
|
||||||
if (Bin->isMachO() || Bin->isMachOUniversalBinary()) {
|
if (Bin->isMachO() || Bin->isMachOUniversalBinary()) {
|
||||||
// On Darwin we may find DWARF in separate object file in
|
// On Darwin we may find DWARF in separate object file in
|
||||||
// resource directory.
|
// resource directory.
|
||||||
const std::string &ResourcePath =
|
const std::string &ResourcePath =
|
||||||
getDarwinDWARFResourceForPath(Path);
|
getDarwinDWARFResourceForPath(Path);
|
||||||
errs() << "Resource path: " << ResourcePath << "\n";
|
|
||||||
BinaryOrErr = createBinary(ResourcePath);
|
BinaryOrErr = createBinary(ResourcePath);
|
||||||
std::error_code EC = BinaryOrErr.getError();
|
std::error_code EC = BinaryOrErr.getError();
|
||||||
errs() << "HERE: " << __FILE__ << ":" << __LINE__ << ", DbgBin: " << DbgBin << "\n";
|
|
||||||
if (EC != errc::no_such_file_or_directory && !error(EC)) {
|
if (EC != errc::no_such_file_or_directory && !error(EC)) {
|
||||||
errs() << "HERE: " << __FILE__ << ":" << __LINE__ << ", DbgBin: " << DbgBin << "\n";
|
|
||||||
OwningBinary<Binary> B = std::move(BinaryOrErr.get());
|
OwningBinary<Binary> B = std::move(BinaryOrErr.get());
|
||||||
DbgBin = B.getBinary().get();
|
DbgBin = B.getBinary().get();
|
||||||
addOwningBinary(std::move(B));
|
addOwningBinary(std::move(B));
|
||||||
}
|
}
|
||||||
if (EC == errc::no_such_file_or_directory)
|
|
||||||
errs() << "no_such_file_or_directory: " << ResourcePath << "\n";
|
|
||||||
}
|
}
|
||||||
errs() << "HERE: " << __FILE__ << ":" << __LINE__ << ", DbgBin: " << DbgBin << "\n";
|
|
||||||
// Try to locate the debug binary using .gnu_debuglink section.
|
// Try to locate the debug binary using .gnu_debuglink section.
|
||||||
if (!DbgBin) {
|
if (!DbgBin) {
|
||||||
std::string DebuglinkName;
|
std::string DebuglinkName;
|
||||||
@ -342,11 +335,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
errs() << "HERE: " << __FILE__ << ":" << __LINE__ << ", DbgBin: " << DbgBin << "\n";
|
if (!DbgBin)
|
||||||
if (!DbgBin) {
|
|
||||||
errs() << "Failed to open DbgBin, falling back to Bin\n";
|
|
||||||
DbgBin = Bin;
|
DbgBin = Bin;
|
||||||
}
|
|
||||||
BinaryPair Res = std::make_pair(Bin, DbgBin);
|
BinaryPair Res = std::make_pair(Bin, DbgBin);
|
||||||
BinaryForPath[Path] = Res;
|
BinaryForPath[Path] = Res;
|
||||||
return Res;
|
return Res;
|
||||||
|
Loading…
Reference in New Issue
Block a user