Record debug location information in the Dwarf writer.

A simple test program shows that debugging works. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63968 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-02-06 21:45:08 +00:00
parent 8fcf170a66
commit ac06d004a0
2 changed files with 16 additions and 2 deletions

View File

@ -207,6 +207,7 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
const Function *F = MF.getFunction();
this->MF = &MF;
unsigned CC = F->getCallingConv();
SetupMachineFunction(MF);
@ -718,12 +719,24 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
return false;
}
/// printMachineInstruction -- Print out a single X86 LLVM instruction
/// MI in AT&T syntax to the current output stream.
/// printMachineInstruction -- Print out a single X86 LLVM instruction MI in
/// AT&T syntax to the current output stream.
///
void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
++EmittedInsts;
if (TAI->doesSupportDebugInformation()) {
static DebugLoc PrevDL = DebugLoc::getUnknownLoc();
DebugLoc CurDL = MI->getDebugLoc();
if (!CurDL.isInvalid() && !CurDL.isUnknown() && PrevDL != CurDL) {
DebugLocTuple DLT = MF->getDebugLocTuple(CurDL);
printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src));
}
PrevDL = CurDL;
}
// Call the autogenerated instruction printer routines.
printInstruction(MI);
}

View File

@ -29,6 +29,7 @@ namespace llvm {
struct MachineJumpTableInfo;
struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
MachineFunction *MF;
DwarfWriter *DW;
MachineModuleInfo *MMI;
const X86Subtarget *Subtarget;