]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: Add is-stmt support to the DWARF compiler
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 4 Feb 2020 17:50:40 +0000 (17:50 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 10 Mar 2020 22:32:05 +0000 (22:32 +0000)
This commit adds the ability to set and toggle the DWARF line table
is-stmt flag.

A DWARF line table can now be created with the attribute
'default_is_stmt' like this:

  lines {version 2 default_is_stmt 0} label {
    ...
  }

If 'default_is_stmt' is not specified then the current default is 1,
which matches the existing behaviour.

Inside the DWARF line table program you can now make use of
{DW_LNS_negate_stmt} to toggle the is-stmt flag, for example this
meaningless program:

  lines {version 2 default_is_stmt 0} label {
    include_dir "some_directory"
    file_name "some_filename" 1

    program {
      {DW_LNS_negate_stmt}
      {DW_LNE_end_sequence}
    }
  }

This new functionality will be used in a later commit.

gdb/testsuite/ChangeLog:

* lib/dwarf.exp (Dwarf::lines) Add support for modifying the
is-stmt flag in the line table.

Change-Id: Ia3f61d523826382dd2333f65b9aae368ad29c4a5

gdb/testsuite/ChangeLog
gdb/testsuite/lib/dwarf.exp

index f9e0c201c1fcdc31849978065024dc9640b493a2..a98e56dca23295a3f14250f21f5206cae1db54ec 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-10  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * lib/dwarf.exp (Dwarf::lines) Add support for modifying the
+       is-stmt flag in the line table.
+
 2020-03-09  Tom de Vries  <tdevries@suse.de>
 
        * lib/gdb.exp (cached_file): Create cache dir.
index 6c6ffbe7c2fb2df6789b3534561cdb177b7905b5..417b22d2345f13009106cebe392c2b6b39d2a283 100644 (file)
@@ -1311,12 +1311,14 @@ namespace eval Dwarf {
        set _unit_addr_size default
        set _line_saw_program 0
        set _line_saw_file 0
+       set _default_is_stmt 1
 
        foreach { name value } $options {
            switch -exact -- $name {
                is_64 { set is_64 $value }
                version { set _unit_version $value }
                addr_size { set _unit_addr_size $value }
+               default_is_stmt { set _default_is_stmt $value }
                default { error "unknown option $name" }
            }
        }
@@ -1363,7 +1365,7 @@ namespace eval Dwarf {
        define_label $header_len_label
 
        _op .byte 1 "minimum_instruction_length"
-       _op .byte 1 "default_is_stmt"
+       _op .byte $_default_is_stmt "default_is_stmt"
        _op .byte 1 "line_base"
        _op .byte 1 "line_range"
        _op .byte 10 "opcode_base"
@@ -1438,6 +1440,10 @@ namespace eval Dwarf {
                _op .byte 1
            }
 
+           proc DW_LNS_negate_stmt {} {
+               _op .byte 6
+           }
+
            proc DW_LNS_advance_pc {offset} {
                _op .byte 2
                _op .uleb128 ${offset}