This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dwarf debug information support for ELF targets in the assembler


On Mar 22, 2012, at 11:36 AM, Ramana wrote:

> On Thu, Mar 22, 2012 at 3:56 PM, Tristan Gingold <gingold@adacore.com> wrote:
>> 
>> On Mar 22, 2012, at 11:22 AM, Ramana wrote:
>> 
>>> Hi Tristian,
>>> 
>>> For the following assembly, I do not get any debug info generated even
>>> after providing -g flag.
>>> 
>>>        .global g_var
>>>        .type g_var, @object
>>>        .local l_var
>>>        .type l_var, @object
>>>        .section .data
>>> g_var:
>>>        .word 10
>>>        .size g_var, .-g_var
>>> l_var:
>>>        .word 20
>>>        .size l_var, .-l_var
>> 
>> Correct, because there is no code.  GAS can emit line info for each instructions, which
>> is very useful while stepping in code.
>> 
> 
> Understood. So, if we write assembly using .line/.file/.loc
> directives, the assembler can generate .debug_line section.

Yes, but you don't need that.  If you assemble with -g, .line/.file directives
are automatically output for instructions.

> But what
> about .debug_info etc (functions defined) sections generation?

There is a .debug_info, but without subprograms.  Again, all the information available is
written in the symbol table.

>> For data, the symbol table contains all available information (symbol name, address and size).
> 
> Is .symtab and .strtab details all the debugger needs for displaying
> the object symbols?

Yes, for the address and the size.  No for the 'type' (except object vs function).

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

the type of object/functions isn't available from assembler source.
If you want the assembler to extract the type of object from the directive (e.g.: int for .word), that could be feasible but that's not implemented.

> pc_high/pc_low of function symbols?

The address and the length of a function is written in the symbol table (at least for ELF), so you know pc_low and pc_high.

> How could we get/generate
> this information?

If you want more, you need to modify gas.  A start point is dwarf2dbg.c

Tristan.


> 
>> 
>> Tristan.
>> 
>>> 
>>> Thanks,
>>> Ram
>>> 
>>> On Thu, Mar 22, 2012 at 3:47 PM, Tristan Gingold <gingold@adacore.com> wrote:
>>>> 
>>>> On Mar 22, 2012, at 11:12 AM, Ramana wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> For an ELF target, while debugging the hand written assembly code, I
>>>>> couldn't see the file local & global symbols defined in the assembly
>>>>> files in the debugger symbols list. But then I realized that there is
>>>>> no debug information in the final executable file for those symbols.
>>>>> 
>>>>> Is it possible to specify (define) and/or generate dwarf debug
>>>>> information for the hand written assembly code from the assembler?
>>>> 
>>>> Yes, assemble with -g.
>>>> 
>>>> Tristan.
>>>> 
>>>>> 
>>>>> Are there any existing mechanisms (assembler directives etc) to enable
>>>>> this support for ELF targets? If yes, any reference port available in
>>>>> the binutils mainline?
>>>>> 
>>>>> How difficult would it be if the support has to be enabled from the scratch?
>>>>> 
>>>>> Thanks,
>>>>> Ram
>>>> 
>> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]