The DW_AT_name is supposed to be relative to the DW_AT_comp_dir.  The DWARF 
spec is actually a little fuzzy about this when describing the compilation 
unit, it says it has:


        • A DW_AT_name attribute whose value is a null-terminated string 
containing the full or relative path name of the primary source file from which 
the compilation unit was derived.

and:

        • A DW_AT_comp_dir attribute whose value is a null-terminated string 
containing the current working directory of the compilation command that 
produced this compilation unit in whatever form makes sense for the host system.

It doesn't actually say "relative to what" in the DW_AT_name description, but 
there isn't anything for it to be relative to but the DW_AT_comp_dir, and when 
file names are used in the line tables it makes it clear that they are relative 
to the DW_AT_comp_dir for the compilation unit.  So you have to fix your DWARF 
output so that either the DW_AT_name is a full path, or a path relative to the 
DW_AT_comp_dir.

Jim


On Jul 17, 2013, at 6:07 AM, chansarav <[email protected]> wrote:

> Source listing is not working in my lldb port. For the command "source list 
> -n main" I got the following output:
> 
> (snip)
> File: workplace/app/src/workplace/app/src/main.c.
> (snip)
> 
> Also when a breakpoint is hit, the corresponding source code lines are not 
> displayed.
> 
> 
> I debugged lldb and found that the path to source file is calculated by 
> combining 'cu_comp_dir' (DW_AT_comp_dir) and 'cu_die_name' (DW_AT_name).
> 
> The DWARF info generated is as follows:
> 
> (snip)
>     <1cb>   DW_AT_name        : (indirect string, offset: 0x129): 
> workplace/app/src/main.c
>     <1cf>   DW_AT_comp_dir    : (indirect string, offset: 0x14d): 
> workplace/app/src
> (snip)
> 
> Just for experimentation, I removed the inclusion of 'cu_comp_dir' 
> (DW_AT_comp_dir) in the source file path calculation (by editing 
> DWARFDebugLine.cpp and SymbolFileDWARF.cpp). After this, the 'source list' 
> command works, also the source lines are displayed for the breakpoint hit. 
> 
> I need a clarification on where the problem is? Can someone help me on this?
> 
> Thanks,
> Chandra Kumar R.
> _______________________________________________
> lldb-dev mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev


_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to