summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2009-08-21 21:03:57 +0000
committerReid Kleckner <reid@kleckner.net>2009-08-21 21:03:57 +0000
commit48ca915be9966bf940c8c50a6a9f147e43a57588 (patch)
treee7b0c232673813e308e4ce5761bf560b6500cc4a /llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
parenta70623102eda7883b9c0f36235d7289cdd939241 (diff)
downloadbcm5719-llvm-48ca915be9966bf940c8c50a6a9f147e43a57588.tar.gz
bcm5719-llvm-48ca915be9966bf940c8c50a6a9f147e43a57588.zip
Fix a bug where the DWARF emitter in the JIT was not initializing alignment
bytes. libgcc doesn't seem to mind, but if you pass this DWARF to GDB, it doesn't like it. Also make the JIT memory manager to initialize it's memory to garbage in debug mode, so that it's easier to find bugs like these in the future. llvm-svn: 79674
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp46
1 files changed, 18 insertions, 28 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
index c661168487a..a3a050635fe 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
@@ -396,20 +396,10 @@ unsigned char* JITDwarfEmitter::EmitExceptionTable(MachineFunction* MF,
TargetAsmInfo::getULEB128Size(SizeSites) +
SizeSites + SizeActions + SizeTypes;
- unsigned TotalSize = sizeof(int8_t) + // LPStart format
- sizeof(int8_t) + // TType format
- TargetAsmInfo::getULEB128Size(TypeOffset) + // TType base offset
- TypeOffset;
-
- unsigned SizeAlign = (4 - TotalSize) & 3;
-
// Begin the exception table.
- JCE->emitAlignment(4);
- for (unsigned i = 0; i != SizeAlign; ++i) {
- JCE->emitByte(0);
- // Asm->EOL("Padding");
- }
-
+ JCE->emitAlignmentWithFill(4, 0);
+ // Asm->EOL("Padding");
+
unsigned char* DwarfExceptionTable = (unsigned char*)JCE->getCurrentPCValue();
// Emit the header.
@@ -496,8 +486,8 @@ unsigned char* JITDwarfEmitter::EmitExceptionTable(MachineFunction* MF,
JCE->emitULEB128Bytes(TypeID);
//Asm->EOL("Filter TypeInfo index");
}
-
- JCE->emitAlignment(4);
+
+ JCE->emitAlignmentWithFill(4, 0);
return DwarfExceptionTable;
}
@@ -546,11 +536,12 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
std::vector<MachineMove> Moves;
RI->getInitialFrameState(Moves);
EmitFrameMoves(0, Moves);
- JCE->emitAlignment(PointerSize);
-
- JCE->emitInt32At((uintptr_t*)StartCommonPtr,
- (uintptr_t)((unsigned char*)JCE->getCurrentPCValue() -
- FrameCommonBeginPtr));
+
+ JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop);
+
+ JCE->emitInt32At((uintptr_t*)StartCommonPtr,
+ (uintptr_t)((unsigned char*)JCE->getCurrentPCValue() -
+ FrameCommonBeginPtr));
return StartCommonPtr;
}
@@ -590,14 +581,14 @@ JITDwarfEmitter::EmitEHFrame(const Function* Personality,
// Indicate locations of function specific callee saved registers in
// frame.
EmitFrameMoves((intptr_t)StartFunction, MMI->getFrameMoves());
-
- JCE->emitAlignment(PointerSize);
-
+
+ JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop);
+
// Indicate the size of the table
- JCE->emitInt32At((uintptr_t*)StartEHPtr,
- (uintptr_t)((unsigned char*)JCE->getCurrentPCValue() -
- StartEHPtr));
-
+ JCE->emitInt32At((uintptr_t*)StartEHPtr,
+ (uintptr_t)((unsigned char*)JCE->getCurrentPCValue() -
+ StartEHPtr));
+
// Double zeroes for the unwind runtime
if (PointerSize == 8) {
JCE->emitInt64(0);
@@ -606,7 +597,6 @@ JITDwarfEmitter::EmitEHFrame(const Function* Personality,
JCE->emitInt32(0);
JCE->emitInt32(0);
}
-
return StartEHPtr;
}
OpenPOWER on IntegriCloud