Use dwarf assembler in gdb.dwarf2/implptr-64bit.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / lib / dwarf.exp
index 03ae63746cb5198fa360684ccb3f4a8d01976954..149038c91e9ee5f05a76de24b3e291794de54e85 100644 (file)
@@ -229,6 +229,8 @@ proc function_range { func src } {
 # * If VALUE starts with the ":" character, then it is a label
 #   reference.  The rest of VALUE is taken to be the name of a label,
 #   and DW_FORM_ref4 is used.  See 'new_label' and 'define_label'.
+# * If VALUE starts with the "%" character, then it is a label
+#   reference too, but DW_FORM_ref_addr is used.
 # * Otherwise, VALUE is taken to be a string and DW_FORM_string is
 #   used.  In order to prevent bugs where a numeric value is given but
 #   no form is specified, it is an error if the value looks like a number
@@ -554,6 +556,15 @@ namespace eval Dwarf {
                return DW_FORM_ref4
            }
 
+           % {
+               # Label reference, an offset from .debug_info.  Assuming
+               # .Lcu1_begin is on .debug_info.
+               set cu1_label [_compute_label "cu1_begin"]
+               set new_value "[string range $value 1 end] - $cu1_label"
+
+               return DW_FORM_ref_addr
+           }
+
            default {
                return DW_FORM_string
            }
@@ -649,7 +660,12 @@ namespace eval Dwarf {
                _handle_macro_at_range $attr_value
            } else {
                if {[llength $attr] > 2} {
-                   set attr_form [lindex $attr end]
+                   set attr_form [uplevel 2 [list subst [lindex $attr end]]]
+
+                   if { [string index $attr_value 0] == ":" } {
+                       # It is a label, get its value.
+                       _guess_form $attr_value attr_value
+                   }
                } else {
                    # If the value looks like an integer, a form is required.
                    if [string is integer $attr_value] {
@@ -907,6 +923,25 @@ namespace eval Dwarf {
                    _op .2byte [lindex $line 1]
                }
 
+               DW_OP_implicit_value {
+                   set l1 [new_label "value_start"]
+                   set l2 [new_label "value_end"]
+                   _op .uleb128 "$l2 - $l1"
+                   define_label $l1
+                   foreach value [lrange $line 1 end] {
+                       switch -regexp -- $value {
+                           {^0x[[:xdigit:]]{1,2}$} {_op .byte $value}
+                           {^0x[[:xdigit:]]{4}$} {_op .2byte $value}
+                           {^0x[[:xdigit:]]{8}$} {_op .4byte $value}
+                           {^0x[[:xdigit:]]{16}$} {_op .8byte $value}
+                           default {
+                               error "bad value '$value' in DW_OP_implicit_value"
+                           }
+                       }
+                   }
+                   define_label $l2
+               }
+
                DW_OP_GNU_implicit_pointer {
                    if {[llength $line] != 3} {
                        error "usage: DW_OP_GNU_implicit_pointer LABEL OFFSET"
@@ -976,6 +1011,7 @@ namespace eval Dwarf {
        set _abbrev_section ".debug_abbrev"
 
        foreach { name value } $options {
+           set value [uplevel 1 "subst \"$value\""]
            switch -exact -- $name {
                is_64 { set is_64 $value }
                version { set _cu_version $value }
This page took 0.037622 seconds and 4 git commands to generate.