[Dwarf-Discuss] Why "DW_LNS_advance_pc" is needed and when it be generated ?

Michael Eager eager@eagercon.com
Thu Aug 7 14:53:27 GMT 2008


Yu Zhenyang wrote:
> Hi, all,
> 
> I am working a compiler bug that relative to DW_LNS_advance_pc. In the 
> piece of C language code of "switch/case", when I send "next" to gdb for 
> the compiled binaray (with -g option) on statement "switch (n)", the PC 
> move to next function that defined next to the "switch/case" function.
> 
> When I compare the line number information with the gcc output. I found 
> there are extra "Advance PC by 36 to 214170" statement in Line Number 
> Statements at the end of the "switch/case" function.
> 
> I wonder when and why the statement is generated.  As far as I know, the 
> compiler only generate ".loc " in ".s" file. Then how and when the "as" 
> translates it. Also, why "DW_LNS_advance_pc" is needed and when it be 
> generated.
> 
> Can somebody give some advice? Thanks !

Can you tell a bit more about your environment?  What is your target?

Do all of the .loc statement appear correct?

Are there extra .loc statements which would cause additional
"DW_LNS_advance_pc" entries?

The line number table is basically a list of PC addresses with
information about each address, primarily what source statement
generated the code at that address.  The table is compressed into a list
of commands to a finite state machine which recreates the table.  There
are several commands like "DW_LNS_advance_pc" which specify the next
PC value where the information changes.  GAS generates these commands
based on the .loc statements.

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077




More information about the Dwarf-discuss mailing list