Consider:

# 1 "dj.c"
# 1 "dj.h" 1 3
int dj(int x);
# 2 "dj.c" 2

int dj(int x)
{
}

If you compile with -g and look at the dwarf output, you see:

 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2e>   DW_AT_external    : 1
    <2e>   DW_AT_name        : dj
    <31>   DW_AT_decl_file   : 2
    <32>   DW_AT_decl_line   : 1

 The File Name Table:
  Entry Dir     Time    Size    Name
  1     0       0       0       dj.c
  2     0       0       0       dj.h


Note that the DW_AT_decl_file refers to "dj.h" and not "dj.c".  If you
remove the "3" from the '# 1 "dj.h" 1 3' line, the DW_AT_decl_file
instead refers to "dj.c".  It's been this way for many releases.

Is this intentional?

If so, what is the rationalization for it?

Reply via email to