This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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: Speaking of DWARF-2 macro info


Daniel Berlin wrote:-

> It appears we now (this didn't happen before) end up generating two start 
> files for the same file.
> But only one end file.
> So the macro info looks like:
> .byte   0x3      # Start new file
>         .uleb128 0x0     # Included from line number 0
>         .uleb128 0x1     # Filename we just started
>         .byte   0x3      # Start new file
>         .uleb128 0x0     # Included from line number 0
>         .uleb128 0x1     # Filename we just started
> ...
>      .byte   0x4      # End file
> 
> As one can see, the two start file lines are identical.
> 
> Either of you know why we see two starts?
> 
> The macro debug info outputter doesn't do anything special. It completely 
> relies on the preprocessor stage to tell it when it sees the start of a 
> new file/the end of a file/a define/an undefine.
> So if we get two starts outputted, it means cpp is calling the hook twice.

If you look at preprocessed output, I imagine that answers your
question.

$ cpp /dev/null
# 1 "/dev/null"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/dev/null"

The first /dev/null is so that re-compiling preprocessed output can get
the original source file from the first line [the .i -> .c translation].

The built-in and command-line pseudo-files are there so that diagnostics
(such as macro redefinition) that refer there give a sensible file name
naturally, and so that this location information is preserved when
compiling preprocessed output.  [It gets more complicated when there
are -include and -imacros on the command line.]

Of course, we then read the first line of the input file, so a new,
duplicate, line marker is needed.

Neil.


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