[llvm-commits] [llvm] r119777 - in /llvm/trunk: include/llvm/MC/MCDwarf.h include/llvm/MC/MCStreamer.h include/llvm/Target/TargetMachine.h lib/CodeGen/LLVMTargetMachine.cpp lib/MC/MCAsmStreamer.cpp lib/MC/MCDwarf.cpp lib/MC/MCELFStreamer.cpp lib/

Devang Patel dpatel at apple.com
Wed Dec 1 07:12:41 PST 2010


On Nov 30, 2010, at 6:48 PM, Rafael EspĂ­ndola wrote:

>> This means debug_line section entries do not have comments. We need these comments to debug line table bugs. How are you going to address this ?
> 
> By using .loc the assembler is a lot easier to read. The llvm-gcc
> output already had no comments in it.

It does not help when .loc is not used, say darwin9 :)
> 
>> Right now I am debugging a regression caused by related patches in .debug_line output and it is very difficult to investigate with comments in assembly output.
> 
> There are two possibilities, the output with .loc is incorrect, in
> which case reading the assembly and finding out that a ".loc 1 2 3"
> should actually be ".loc 2 2 3" is not that hard.
> 
> The assembler (MC) is wrong. In this case you should be able to
> compare the output of llvm-mc and the system assembler.

When 1) .loc is not used and 2) the code generator does not integrated assembler then the emitted .s file has wrong line table entries. I looked at the  _clz.s (from libgcc during llvm-gcc bootstrap).

	.section	__DWARF,__debug_line,regular,debug
Ltmp0:
	.long	(Ltmp1-Ltmp0)-4
	.short	2
	.long	(Ltmp2-Ltmp0)-10
	.byte	1
	.byte	1
	.byte	-5
	.byte	14
	.byte	13
	.byte	0
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	0
	.byte	0
	.byte	0
	.byte	1
	.byte	0
	.byte	0
	.byte	1
	.byte	0
	.ascii	 "libgcc2.c"
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.ascii	 "libgcc2.h"
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
Ltmp2:
Ltmp1:


AFAICT, this line table is incomplete. Here lack of comments does not make it easier. Note, use of integrated assembler + set UseMCLoc to true, results in correct .o file. So the bug is in 

//
// This emits the Dwarf file and the line tables.
//
void MCDwarfFileTable::Emit(MCStreamer *MCOS,
                            const MCSection *DwarfLineSection,
                            MCSectionData *DLS,
                            int PointerSize) {


This is a new code that replaced its alternative in DwarfDebug.cpp

Can you take a look ? This is causing llvm-gcc-i388-darwin9 buildbot failures. You should be able to use following simple c input.
---
char *c[4] = "hi\n";
---

Thanks,
-
Devang





More information about the llvm-commits mailing list