dwarf debug information support for ELF targets in the assembler

Ian Lance Taylor iant@google.com
Thu Mar 22 18:51:00 GMT 2012


Ramana <ramana.venkat83@gmail.com> writes:

> Doesn't it need to know the type (int etc) of
> object

The assembler doesn't know the type, so it can't automatically generate
debug info describing the type.

Of course you can add that debug info yourself--that's what the compiler
does, after all.  But you have to write it out yourself.  E.g., this is
the debug info that gcc generates for "int i = 2;":

	.section	.debug_info
	.long	0x41
	.value	0x2
	.long	.Ldebug_abbrev0
	.byte	0x8
	.uleb128 0x1
	.long	.LASF0
	.byte	0x1
	.long	.LASF1
	.quad	.Ltext0
	.quad	.Letext0
	.long	.Ldebug_line0
	.uleb128 0x2
	.string	"i"
	.byte	0x1
	.byte	0x1
	.long	0x3d
	.byte	0x1
	.byte	0x9
	.byte	0x3
	.quad	i
	.uleb128 0x3
	.byte	0x4
	.byte	0x5
	.string	"int"
	.byte	0x0
	.section	.debug_abbrev
	.uleb128 0x1
	.uleb128 0x11
	.byte	0x1
	.uleb128 0x25
	.uleb128 0xe
	.uleb128 0x13
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0xe
	.uleb128 0x11
	.uleb128 0x1
	.uleb128 0x12
	.uleb128 0x1
	.uleb128 0x10
	.uleb128 0x6
	.byte	0x0
	.byte	0x0
	.uleb128 0x2
	.uleb128 0x34
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x8
	.uleb128 0x3a
	.uleb128 0xb
	.uleb128 0x3b
	.uleb128 0xb
	.uleb128 0x49
	.uleb128 0x13
	.uleb128 0x3f
	.uleb128 0xc
	.uleb128 0x2
	.uleb128 0xa
	.byte	0x0
	.byte	0x0
	.uleb128 0x3
	.uleb128 0x24
	.byte	0x0
	.uleb128 0xb
	.uleb128 0xb
	.uleb128 0x3e
	.uleb128 0xb
	.uleb128 0x3
	.uleb128 0x8
	.byte	0x0
	.byte	0x0
	.byte	0x0
	.section	.debug_pubnames,"",@progbits
	.long	0x14
	.value	0x2
	.long	.Ldebug_info0
	.long	0x45
	.long	0x29
	.string	"i"
	.long	0x0

Ian



More information about the Binutils mailing list