This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Speaking of DWARF-2 macro info
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: Daniel Berlin <dan at dberlin dot org>
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Mar 2002 17:44:31 +0000
- Subject: Re: Speaking of DWARF-2 macro info
- References: <Pine.LNX.4.44.0203171225020.18968-100000@dberlin.org>
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.