aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/dwarf.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/lib/dwarf.exp')
-rw-r--r--gdb/testsuite/lib/dwarf.exp42
1 files changed, 42 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 7e8778a..b347437 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -678,6 +678,11 @@ namespace eval Dwarf {
}
}
close $fd
+
+ variable _constants
+
+ # Add DW_FORM_strx_id as alias of DW_FORM_strx.
+ _process_one_constant DW_FORM_strx_id $_constants(DW_FORM_strx)
}
proc _quote {string} {
@@ -823,6 +828,12 @@ namespace eval Dwarf {
DW_FORM_indirect -
DW_FORM_exprloc -
+ # Generate a DW_FORM_str index, but assume generation of .debug_str and
+ # .debug_str_offsets is taken care of elsewhere.
+ DW_FORM_strx_id {
+ _op .uleb128 $value
+ }
+
DW_FORM_strx -
DW_FORM_strx1 -
DW_FORM_strx2 -
@@ -3385,6 +3396,37 @@ namespace eval Dwarf {
debug_names_end:
}
+ # Add the strings in ARGS to the .debug_str section, and create a
+ # .debug_str_offsets section pointing to those strings.
+ # BASE_OFFSET is the label for DW_AT_str_offsets_base.
+ proc debug_str_offsets { base_offset args } {
+ _section .debug_str
+ set num 0
+ foreach arg $args {
+ set str_label [_compute_label "str_${num}"]
+ define_label $str_label
+ _op .asciz \"$arg\" ".debug_str_offsets string $num"
+ incr num
+ }
+
+ declare_labels debug_str_offsets_start debug_str_offsets_end
+ set initial_length "$debug_str_offsets_end - $debug_str_offsets_start"
+
+ _section .debug_str_offsets
+ _op .4byte $initial_length "Initial_length"
+ debug_str_offsets_start:
+ _op .2byte 0x5 "version"
+ _op .2byte 0x0 "padding"
+ $base_offset:
+ set num 0
+ foreach arg $args {
+ set str_label [_compute_label "str_${num}"]
+ _op .4byte $str_label "string $num"
+ incr num
+ }
+ debug_str_offsets_end:
+ }
+
# The top-level interface to the DWARF assembler.
# OPTIONS is a list with an even number of elements containing
# option-name and option-value pairs.