public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/26092] New: Complain about contradictory DW_LNE_end_sequence marker
@ 2020-06-08  8:34 vries at gcc dot gnu.org
  2020-06-08  8:59 ` [Bug symtab/26092] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2020-06-08  8:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26092

            Bug ID: 26092
           Summary: Complain about contradictory DW_LNE_end_sequence
                    marker
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider test-case gdb.dwarf2/dw2-ranges-base.exp.  It has a line-table for
dw2-ranges-base.c like this:
...
     Line Number Statements:
      [0x0000014e]  Extended opcode 2: set Address to 0x4004ba
      [0x00000159]  Advance Line by 10 to 11
      [0x0000015b]  Copy
      [0x0000015c]  Advance PC by 12 to 0x4004c6
      [0x0000015e]  Advance Line by 19 to 30
      [0x00000160]  Copy
      [0x00000161]  Extended opcode 1: End of Sequence

      [0x00000164]  Extended opcode 2: set Address to 0x4004ae
      [0x0000016f]  Advance Line by 20 to 21
      [0x00000171]  Copy
      [0x00000172]  Advance PC by 12 to 0x4004ba
      [0x00000174]  Advance Line by 29 to 50
      [0x00000176]  Copy
      [0x00000177]  Extended opcode 1: End of Sequence

      [0x0000017a]  Extended opcode 2: set Address to 0x4004a7
      [0x00000185]  Advance Line by 30 to 31
      [0x00000187]  Copy
      [0x00000188]  Advance PC by 7 to 0x4004ae
      [0x0000018a]  Advance Line by 39 to 70
      [0x0000018c]  Copy
      [0x0000018d]  Extended opcode 1: End of Sequence
...

The Copy followed by End-of-Sequence is as specified in the dwarf assembly, but
incorrect.  F.i., consider:
 ...
      [0x0000015c]  Advance PC by 12 to 0x4004c6
      [0x0000015e]  Advance Line by 19 to 30
      [0x00000160]  Copy
      [0x00000161]  Extended opcode 1: End of Sequence
 ...

Both the Copy and the End-of-Sequence append a row to the matrix using the same
addres: 0x4004c6.

The Copy declares a target instruction at that address.

The End-of-Sequence declares that the sequence ends before that address.

It's a contradiction that the target instruction is both part of the sequence
(according to Copy) and not part of the sequence (according to
End-of-Sequence).

[ Relevant dwarf standard bits:

DW_LNS_copy

The DW_LNS_copy opcode takes no operands. It appends a row to the matrix using
the current values of the state machine registers. Then it sets the
discriminator register to 0, and sets the basic_block, prologue_end and
epilogue_begin registers to “false.”

end_sequence:

A boolean indicating that the current address is that of the first byte
after the end of a sequence of target machine instructions. end_sequence
terminates a sequence of lines; therefore other information in the same
row is not meaningful.

DW_LNE_end_sequence:

The DW_LNE_end_sequence opcode takes no operands. It sets the
end_sequence register of the state machine to “true” and appends a row
to the matrix using the current values of the state-machine registers.
Then it resets the registers to the initial values specified above (see
Section 6.2.2). Every line number program sequence must end with a
DW_LNE_end_sequence instruction which creates a row whose address is
that of the byte after the last target machine instruction of the sequence.

]

The offending Copy is currently silently skipped by
buildsym_compunit::record_line.

It would be good to warn about this invalid use of dwarf, through the
complaints mechanism, or some such.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-08 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08  8:34 [Bug symtab/26092] New: Complain about contradictory DW_LNE_end_sequence marker vries at gcc dot gnu.org
2020-06-08  8:59 ` [Bug symtab/26092] " vries at gcc dot gnu.org
2020-06-08  9:38 ` vries at gcc dot gnu.org
2020-06-08 10:04 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).