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 | |
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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp | 55 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp | 15 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp | 26 | ||||
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 22 |
8 files changed, 100 insertions, 99 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9559355..7834417 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,16 @@ +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. + 2020-07-15 Andrew Burgess <andrew.burgess@embecosm.com> * gdb.fortran/ptype-on-functions.exp: Make the result pattern more diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp index 0c2c661..e826825 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp @@ -188,91 +188,91 @@ Dwarf::assemble $asm_file { program { {DW_LNE_set_address $main_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "main prologue"] - 1]} + {line [gdb_get_line_number "main prologue"]} {DW_LNS_copy} {DW_LNE_set_address main_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "main set global_var"] - [gdb_get_line_number "main prologue"]]} + {line [gdb_get_line_number "main set global_var"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "main call aaa"] - [gdb_get_line_number "main set global_var"]]} + {line [gdb_get_line_number "main call aaa"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "aaa return"] - [gdb_get_line_number "main call aaa"]]} + {line [gdb_get_line_number "aaa return"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "bbb return"] - [gdb_get_line_number "aaa return"]]} + {line [gdb_get_line_number "bbb return"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "ccc return"] - [gdb_get_line_number "bbb return"]]} + {line [gdb_get_line_number "ccc return"]} {DW_LNS_copy} {DW_LNE_set_address main_label3} - {DW_LNS_advance_line [expr [gdb_get_line_number "main end"] - [gdb_get_line_number "ccc return"]]} + {line [gdb_get_line_number "main end"]} {DW_LNS_copy} {DW_LNE_set_address $main_end} {DW_LNE_end_sequence} {DW_LNE_set_address $ddd_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "ddd prologue"] - 1]} + {line [gdb_get_line_number "ddd prologue"]} {DW_LNS_copy} {DW_LNE_set_address ddd_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "ddd return"] - [gdb_get_line_number "ddd prologue"]]} + {line [gdb_get_line_number "ddd return"]} {DW_LNS_copy} {DW_LNE_set_address ddd_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "ddd end"] - [gdb_get_line_number "ddd return"]]} + {line [gdb_get_line_number "ddd end"]} {DW_LNS_copy} {DW_LNE_set_address $ddd_end} {DW_LNE_end_sequence} {DW_LNE_set_address $eee_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "eee prologue"] - 1]} + {line [gdb_get_line_number "eee prologue"]} {DW_LNS_copy} {DW_LNE_set_address eee_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "eee return"] - [gdb_get_line_number "eee prologue"]]} + {line [gdb_get_line_number "eee return"]} {DW_LNS_copy} {DW_LNE_set_address eee_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "eee end"] - [gdb_get_line_number "eee return"]]} + {line [gdb_get_line_number "eee end"]} {DW_LNS_copy} {DW_LNE_set_address $eee_end} {DW_LNE_end_sequence} {DW_LNE_set_address $fff_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "fff prologue"] - 1]} + {line [gdb_get_line_number "fff prologue"]} {DW_LNS_copy} {DW_LNE_set_address fff_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "fff return"] - [gdb_get_line_number "fff prologue"]]} + {line [gdb_get_line_number "fff return"]} {DW_LNS_copy} {DW_LNE_set_address fff_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "ggg return"] - [gdb_get_line_number "fff return"]]} + {line [gdb_get_line_number "ggg return"]} {DW_LNS_copy} {DW_LNE_set_address fff_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "hhh return"] - [gdb_get_line_number "ggg return"]]} + {line [gdb_get_line_number "hhh return"]} {DW_LNS_copy} {DW_LNE_set_address fff_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "iii return"] - [gdb_get_line_number "hhh return"]]} + {line [gdb_get_line_number "iii return"]} {DW_LNS_copy} {DW_LNE_set_address fff_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "fff end"] - [gdb_get_line_number "fff return"]]} + {line [gdb_get_line_number "fff end"]} {DW_LNS_copy} {DW_LNE_set_address $fff_end} {DW_LNE_end_sequence} {DW_LNE_set_address $jjj_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "jjj prologue"] - 1]} + {line [gdb_get_line_number "jjj prologue"]} {DW_LNS_copy} {DW_LNE_set_address jjj_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "jjj return"] - [gdb_get_line_number "jjj prologue"]]} + {line [gdb_get_line_number "jjj return"]} {DW_LNS_copy} {DW_LNE_set_address jjj_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "jjj end"] - [gdb_get_line_number "jjj return"]]} + {line [gdb_get_line_number "jjj end"]} {DW_LNS_copy} {DW_LNE_set_address $jjj_end} {DW_LNE_end_sequence} {DW_LNE_set_address $kkk_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "kkk prologue"] - 1]} + {line [gdb_get_line_number "kkk prologue"]} {DW_LNS_copy} {DW_LNE_set_address kkk_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "kkk return"] - [gdb_get_line_number "kkk prologue"]]} + {line [gdb_get_line_number "kkk return"]} {DW_LNS_copy} {DW_LNE_set_address $kkk_end} {DW_LNE_end_sequence} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp index 4fcc3cf..12a60a0 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-small-func.exp @@ -95,14 +95,14 @@ Dwarf::assemble $asm_file { program { {DW_LNE_set_address line_label_1} - {DW_LNS_advance_line [expr $f1_l1 - 1]} + {line $f1_l1} {DW_LNS_copy} - {DW_LNS_advance_line [expr ${f1_l2} - ${f1_l1}]} + {line ${f1_l2}} {DW_LNS_copy} {DW_LNS_set_file 2} - {DW_LNS_advance_line [expr ${f2_l1} - ${f1_l2}]} + {line ${f2_l1}} {DW_LNS_copy} {DW_LNS_negate_stmt} @@ -110,7 +110,7 @@ Dwarf::assemble $asm_file { {DW_LNS_set_file 1} {DW_LNE_set_address line_label_2} - {DW_LNS_advance_line [expr ${f1_l3} - ${f2_l1}]} + {line ${f1_l3}} {DW_LNS_copy} {DW_LNE_set_address line_label_3} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp index 81a6782..1632d5e 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp @@ -95,25 +95,25 @@ Dwarf::assemble $asm_file { program { {DW_LNE_set_address $main_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "main prologue"] - 1]} + {line [gdb_get_line_number "main prologue"]} {DW_LNS_copy} {DW_LNE_set_address main_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "main set global_var"] - [gdb_get_line_number "main prologue"]]} + {line [gdb_get_line_number "main set global_var"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "main call foo"] - [gdb_get_line_number "main set global_var"]]} + {line [gdb_get_line_number "main call foo"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo call bar"] - [gdb_get_line_number "main call foo"]]} + {line [gdb_get_line_number "foo call bar"]} {DW_LNS_copy} {DW_LNE_set_address $main_end} {DW_LNE_end_sequence} {DW_LNE_set_address $bar_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "bar prologue"] - 1]} + {line [gdb_get_line_number "bar prologue"]} {DW_LNS_copy} {DW_LNE_set_address bar_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "bar return global_var"] - [gdb_get_line_number "bar prologue"]]} + {line [gdb_get_line_number "bar return global_var"]} {DW_LNS_copy} {DW_LNE_set_address $bar_end} {DW_LNE_end_sequence} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp index 2fcad93..745af04 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt-2.exp @@ -69,20 +69,15 @@ Dwarf::assemble $asm_file { program { {DW_LNE_set_address main} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main prologue"] - 1]} + {line [gdb_get_line_number "main prologue"]} {DW_LNS_copy} {DW_LNE_set_address line_label_0} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main start"] \ - - [gdb_get_line_number "main prologue"]]} + {line [gdb_get_line_number "main start"]} {DW_LNS_copy} {DW_LNE_set_address line_label_1} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 1"] \ - - [gdb_get_line_number "main start"]]} + {line [gdb_get_line_number "Line 1"]} {DW_LNS_negate_stmt} {DW_LNS_copy} @@ -91,28 +86,20 @@ Dwarf::assemble $asm_file { {DW_LNS_copy} {DW_LNE_set_address line_label_3} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 2"] \ - - [gdb_get_line_number "Line 1"]]} + {line [gdb_get_line_number "Line 2"]} {DW_LNS_negate_stmt} {DW_LNS_copy} {DW_LNE_set_address line_label_4} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 1"] \ - - [gdb_get_line_number "Line 2"]]} + {line [gdb_get_line_number "Line 1"]} {DW_LNS_copy} {DW_LNE_set_address line_label_5} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 3"] \ - - [gdb_get_line_number "Line 1"]]} + {line [gdb_get_line_number "Line 3"]} {DW_LNS_copy} {DW_LNE_set_address line_label_6} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 4"] \ - - [gdb_get_line_number "Line 3"]]} + {line [gdb_get_line_number "Line 4"]} {DW_LNS_copy} {DW_LNE_set_address line_label_7} @@ -120,9 +107,7 @@ Dwarf::assemble $asm_file { {DW_LNS_copy} {DW_LNE_set_address line_label_8} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 2"] \ - - [gdb_get_line_number "Line 4"]]} + {line [gdb_get_line_number "Line 2"]} {DW_LNS_copy} {DW_LNE_set_address line_label_9} @@ -130,15 +115,11 @@ Dwarf::assemble $asm_file { {DW_LNS_copy} {DW_LNE_set_address line_label_10} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 3"] \ - - [gdb_get_line_number "Line 2"]]} + {line [gdb_get_line_number "Line 3"]} {DW_LNS_copy} {DW_LNE_set_address line_label_11} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 5"] \ - - [gdb_get_line_number "Line 3"]]} + {line [gdb_get_line_number "Line 5"]} {DW_LNS_copy} {DW_LNE_set_address line_label_12} @@ -146,28 +127,20 @@ Dwarf::assemble $asm_file { {DW_LNS_copy} {DW_LNE_set_address line_label_13} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 3"] \ - - [gdb_get_line_number "Line 5"]]} + {line [gdb_get_line_number "Line 3"]} {DW_LNS_copy} {DW_LNE_set_address line_label_14} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 4"] \ - - [gdb_get_line_number "Line 3"]]} + {line [gdb_get_line_number "Line 4"]} {DW_LNS_negate_stmt} {DW_LNS_copy} {DW_LNE_set_address line_label_15} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "Line 5"] \ - - [gdb_get_line_number "Line 4"]]} + {line [gdb_get_line_number "Line 5"]} {DW_LNS_copy} {DW_LNE_set_address line_label_16} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main end"] \ - - [gdb_get_line_number "Line 5"]]} + {line [gdb_get_line_number "main end"]} {DW_LNS_negate_stmt} {DW_LNS_copy} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp index e200e91..62e655a 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp @@ -69,21 +69,16 @@ Dwarf::assemble $asm_file { program { {DW_LNE_set_address main} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main prologue"] - 1]} + {line [gdb_get_line_number "main prologue"]} {DW_LNS_negate_stmt} {DW_LNS_copy} {DW_LNE_set_address line_label_1} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main, set var to 99"] \ - - [gdb_get_line_number "main prologue"]]} + {line [gdb_get_line_number "main, set var to 99"]} {DW_LNS_copy} {DW_LNE_set_address line_label_2} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main, set var to 0"] \ - - [gdb_get_line_number "main, set var to 99"]]} + {line [gdb_get_line_number "main, set var to 0"]} {DW_LNS_negate_stmt} {DW_LNS_copy} @@ -96,9 +91,7 @@ Dwarf::assemble $asm_file { {DW_LNS_copy} {DW_LNE_set_address line_label_5} - {DW_LNS_advance_line \ - [expr [gdb_get_line_number "main end"] \ - - [gdb_get_line_number "main, set var to 0"]]} + {line [gdb_get_line_number "main end"]} {DW_LNS_negate_stmt} {DW_LNS_copy} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp index 0a95adc..ac37b24 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func.exp @@ -134,30 +134,30 @@ proc do_test {suffix} { # reasonably accurate as it made debugging the test case easier. program { {DW_LNE_set_address $main_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "main prologue"] - 1]} + {line [gdb_get_line_number "main prologue"]} {DW_LNS_copy} {DW_LNE_set_address main_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "main foo call"] - [gdb_get_line_number "main prologue"]]} + {line [gdb_get_line_number "main foo call"]} {DW_LNS_copy} {DW_LNE_set_address main_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "main return"] - [gdb_get_line_number "main foo call"]]} + {line [gdb_get_line_number "main return"]} {DW_LNS_copy} {DW_LNE_set_address $main_end} - {DW_LNS_advance_line [expr [gdb_get_line_number "main end"] - [gdb_get_line_number "main return"] + 1]} + {line [expr [gdb_get_line_number "main end"] + 1]} {DW_LNS_copy} {DW_LNE_end_sequence} {DW_LNE_set_address $foo_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo prologue"] - 1] } + {line [gdb_get_line_number "foo prologue"]} {DW_LNS_copy} {DW_LNE_set_address foo_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo bar call"] - [gdb_get_line_number "foo prologue"]]} + {line [gdb_get_line_number "foo bar call"]} {DW_LNS_copy} {DW_LNE_set_address foo_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo foo_cold call"] - [gdb_get_line_number "foo bar call"]]} + {line [gdb_get_line_number "foo foo_cold call"]} {DW_LNS_copy} {DW_LNE_set_address foo_label3} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo end"] - [gdb_get_line_number "foo foo_cold call"]]} + {line [gdb_get_line_number "foo end"]} {DW_LNS_copy} {DW_LNE_set_address $foo_end} {DW_LNS_advance_line 1} @@ -165,7 +165,7 @@ proc do_test {suffix} { {DW_LNE_end_sequence} {DW_LNE_set_address $bar_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "bar end"] - 1]} + {line [gdb_get_line_number "bar end"]} {DW_LNS_copy} {DW_LNS_advance_pc $bar_len} {DW_LNS_advance_line 1} @@ -173,7 +173,7 @@ proc do_test {suffix} { {DW_LNE_end_sequence} {DW_LNE_set_address $baz_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "baz end"] - 1]} + {line [gdb_get_line_number "baz end"]} {DW_LNS_copy} {DW_LNS_advance_pc $baz_len} {DW_LNS_advance_line 1} @@ -181,13 +181,13 @@ proc do_test {suffix} { {DW_LNE_end_sequence} {DW_LNE_set_address $foo_cold_start} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo_cold prologue"] - 1]} + {line [gdb_get_line_number "foo_cold prologue"]} {DW_LNS_copy} {DW_LNE_set_address foo_cold_label} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo_cold baz call"] - [gdb_get_line_number "foo_cold prologue"]]} + {line [gdb_get_line_number "foo_cold baz call"]} {DW_LNS_copy} {DW_LNE_set_address foo_cold_label2} - {DW_LNS_advance_line [expr [gdb_get_line_number "foo_cold end"] - [gdb_get_line_number "foo_cold baz call"]]} + {line [gdb_get_line_number "foo_cold end"]} {DW_LNS_copy} {DW_LNE_set_address $foo_cold_end} {DW_LNS_advance_line 1} 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} { |