From 03ba05b65a2c555d3057006ef490d958bbf07df5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 5 Oct 2009 09:11:59 +0200 Subject: Handle DW_AT_const_value as alternative to location description. * dwflpp.cxx (translate_location): Call c_translate_constant when attribute is DW_AT_const_value. (literal_stmt_for_local): Allow both DW_AT_location and DW_AT_const_value. --- dwflpp.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index c611dbe3..3356ad78 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -1654,6 +1654,14 @@ dwflpp::translate_location(struct obstack *pool, } #endif + /* There is no location expression, but a constant value instead. */ + if (dwarf_whatattr (attr) == DW_AT_const_value) + { + *tail = c_translate_constant (pool, &loc2c_error, this, + &loc2c_emit_address, 0, pc, attr); + return *tail; + } + Dwarf_Op *expr; size_t len; @@ -2216,7 +2224,8 @@ dwflpp::literal_stmt_for_local (vector& scopes, << "\n"; Dwarf_Attribute attr_mem; - if (dwarf_attr_integrate (&vardie, DW_AT_location, &attr_mem) == NULL) + if (dwarf_attr_integrate (&vardie, DW_AT_const_value, &attr_mem) == NULL + && dwarf_attr_integrate (&vardie, DW_AT_location, &attr_mem) == NULL) { throw semantic_error("failed to retrieve location " "attribute for local '" + local -- cgit