diff options
author | Tom de Vries <tdevries@suse.de> | 2020-07-16 15:34:00 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-07-16 15:34:00 +0200 |
commit | 853772cc1874a858406ad9b02cdb14cc8b88392a (patch) | |
tree | 97c0e0a36f490fbb1350c4640d1955819b5dbeb4 /gdb/testsuite/lib | |
parent | 8ed8e29f059739c431e67a116230c5c60049ebae (diff) | |
download | gdb-853772cc1874a858406ad9b02cdb14cc8b88392a.zip gdb-853772cc1874a858406ad9b02cdb14cc8b88392a.tar.gz gdb-853772cc1874a858406ad9b02cdb14cc8b88392a.tar.bz2 |
[gdb/testsuite] Add pseudo line number program instruction: line
There's an idiom in dwarf assembly test-cases:
...
set line1 [gdb_get_line_number "line 1"]
set line2 [gdb_get_line_number "line 2"]
set line3 [gdb_get_line_number "line 3"]
...
{DW_LNS_advance_line [expr $line1 - 1]}
...
{DW_LNS_advance_line [expr $line2 - $line1]}
...
{DW_LNS_advance_line [expr $line3 - $line2]}
...
Add a pseudo line number program instruction "line", such that we can simply
write:
...
{line $line1}
...
{line $line2}
...
{line $line3}
...
Build and reg-tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-07-16 Tom de Vries <tdevries@suse.de>
* lib/dwarf.exp (program): Initialize _line.
(DW_LNE_end_sequence): Reinitialize _line.
(DW_LNS_advance_line): Update _line.
(line): New proc.
* gdb.dwarf2/dw2-inline-many-frames.exp: Use line.
* gdb.dwarf2/dw2-inline-small-func.exp: Same.
* gdb.dwarf2/dw2-inline-stepping.exp: Same.
* gdb.dwarf2/dw2-is-stmt-2.exp: Same.
* gdb.dwarf2/dw2-is-stmt.exp: Same.
* gdb.dwarf2/dw2-ranges-func.exp: Same.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 5febc75..21dc0f6 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -1423,6 +1423,9 @@ namespace eval Dwarf { proc program {statements} { variable _line_saw_program variable _line_header_end_label + variable _line + + set _line 1 if "! $_line_saw_program" { # Terminate the file list. @@ -1447,9 +1450,11 @@ namespace eval Dwarf { } proc DW_LNE_end_sequence {} { + variable _line _op .byte 0 _op .uleb128 1 _op .byte 1 + set _line 1 } proc DW_LNS_copy {} { @@ -1466,8 +1471,25 @@ namespace eval Dwarf { } proc DW_LNS_advance_line {offset} { + variable _line _op .byte 3 _op .sleb128 ${offset} + set _line [expr $_line + $offset] + } + + # A pseudo line number program instruction, that can be used instead + # of DW_LNS_advance_line. Rather than writing: + # {DW_LNS_advance_line [expr $line1 - 1]} + # {DW_LNS_advance_line [expr $line2 - $line1]} + # {DW_LNS_advance_line [expr $line3 - $line2]} + # we can just write: + # {line $line1} + # {line $line2} + # {line $line3} + proc line {line} { + variable _line + set offset [expr $line - $_line] + DW_LNS_advance_line $offset } proc DW_LNS_set_file {num} { |