+2020-12-14 Mark Wielaard <mark@klomp.org>
+
+ * lib/dwarf.exp (Dwarf::_read_constants): Don't set
+ _constants(SPECIAL_expr) here, but set it...
+ (Dwarf::cu): ...here based on _cu_version.
+
2020-12-14 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_compile_shlib): Make sure it's not necessary to
# section automatically.
#
# If FORM is 'SPECIAL_expr', then VALUE is treated as a location
-# expression. The effective form is then DW_FORM_block, and VALUE
-# is passed to the (internal) '_location' proc to be translated.
+# expression. The effective form is then DW_FORM_block or DW_FORM_exprloc
+# for DWARF version >= 4, and VALUE is passed to the (internal)
+# '_location' proc to be translated.
# This proc implements a miniature DW_OP_ assembler.
#
# If FORM is not given, it is guessed:
proc _read_constants {} {
global srcdir hex decimal
- variable _constants
# DWARF name-matching regexp.
set dwrx "DW_\[a-zA-Z0-9_\]+"
}
}
close $fd
-
- set _constants(SPECIAL_expr) $_constants(DW_FORM_block)
}
proc _quote {string} {
# BODY is Tcl code that emits the DIEs which make up the body of
# the CU. It is evaluated in the caller's context.
proc cu {options body} {
+ variable _constants
variable _cu_count
variable _abbrev_section
variable _abbrev_num
set _abbrev_section ".debug_abbrev.dwo"
}
+ if {$_cu_version < 4} {
+ set _constants(SPECIAL_expr) $_constants(DW_FORM_block)
+ } else {
+ set _constants(SPECIAL_expr) $_constants(DW_FORM_exprloc)
+ }
+
_section $section
set cu_num [incr _cu_count]