From b0be9bdb8c6972d847cad50a1e699f1fa806ad99 Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 3 Mar 2008 21:36:50 +0000 Subject: PR5516: assignment to $pointers 2008-03-03 Frank Ch. Eigler PR5516 * elaborate.cxx (symbol_fetcher, dead_assignment_remover): Support unresolved $target lvalues. Propagate pretty error messages. * staptree.cxx (varuse_collecting_visitor target_symbol): Ditto. * staptree.h: Corresponding decl. * loc2c.c: c_translate_pointer_store: New function. * loc2c.h: Corresponding decl. * tapsets.cxx (dwflpp::translate_final_fetch_or_store): Call it for $target pointer assignments. 2008-03-03 Frank Ch. Eigler PR5516 * buildok/twentynine.stp: New test. --- loc2c.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'loc2c.c') diff --git a/loc2c.c b/loc2c.c index 6834e9f6..52381b82 100644 --- a/loc2c.c +++ b/loc2c.c @@ -1601,6 +1601,37 @@ c_translate_addressof (struct obstack *pool, int indent, } +/* Translate a fragment to write the given pointer value, + where *INPUT is the location of the pointer with that type. +*/ + +void +c_translate_pointer_store (struct obstack *pool, int indent, + Dwarf_Addr dwbias __attribute__ ((unused)), + Dwarf_Die *typedie, struct location **input, + const char *rvalue) +{ + assert (dwarf_tag (typedie) == DW_TAG_pointer_type); + + Dwarf_Attribute attr_mem; + Dwarf_Word byte_size; + if (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem) == NULL) + byte_size = 0; + else if (dwarf_formudata (&attr_mem, &byte_size) != 0) + FAIL (*input, + N_("cannot get byte_size attribute for type %s: %s"), + dwarf_diename (typedie) ?: "", + dwarf_errmsg (-1)); + + translate_base_store (pool, indent + 1, byte_size, + input, *input, rvalue); + + // XXX: what about multiple-location lvalues? +} + + + + /* Determine the element stride of an array type. */ static Dwarf_Word array_stride (Dwarf_Die *typedie, struct location *origin) -- cgit