From 6b92b8e50d7e5b48407865c3aaf9966c01416c69 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Fri, 7 Apr 2006 20:44:42 +0000 Subject: Make sure that debug labels are defined within the same section and after the entry point of a function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27494 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/DwarfWriter.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen') diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 19b1d840..ab00a99 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -1626,15 +1626,13 @@ void DwarfWriter::ConstructRootScope(DebugScope *RootScope) { CompileUnitDesc *UnitDesc = static_cast(SPD->getContext()); CompileUnit *Unit = FindCompileUnit(UnitDesc); - // Generate the mangled name. - std::string MangledName = Asm->Mang->getValueName(MF->getFunction()); - // Get the subprogram die. DIE *SPDie = Unit->getDieMapSlotFor(SPD); assert(SPDie && "Missing subprogram descriptor"); // Add the function bounds. - SPDie->AddObjectLabel(DW_AT_low_pc, DW_FORM_addr, MangledName); + SPDie->AddLabel(DW_AT_low_pc, DW_FORM_addr, + DWLabel("func_begin", SubprogramCount)); SPDie->AddLabel(DW_AT_high_pc, DW_FORM_addr, DWLabel("func_end", SubprogramCount)); MachineLocation Location(RI->getFrameRegister(*MF)); @@ -2408,8 +2406,8 @@ void DwarfWriter::EndModule() { EmitDebugMacInfo(); } -/// BeginFunction - Gather pre-function debug information. -/// +/// BeginFunction - Gather pre-function debug information. Assumes being +/// emitted immediately after the function entry point. void DwarfWriter::BeginFunction(MachineFunction *MF) { this->MF = MF; @@ -2419,8 +2417,7 @@ void DwarfWriter::BeginFunction(MachineFunction *MF) { if (!ShouldEmitDwarf()) return; EOL("Dwarf Begin Function"); - // Define begin label for subprogram. - Asm->SwitchSection(TextSection, 0); + // Assumes in correct section after the entry point. EmitLabel("func_begin", ++SubprogramCount); } -- cgit v1.1