summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorfche <fche>2008-03-03 21:36:50 +0000
committerfche <fche>2008-03-03 21:36:50 +0000
commitb0be9bdb8c6972d847cad50a1e699f1fa806ad99 (patch)
tree66b3e148a84447d69f1340447c5edba8bf2055cd /tapsets.cxx
parentaae3e9a9a9cb64560070de2d1de30b08252b1e81 (diff)
downloadsystemtap-steved-b0be9bdb8c6972d847cad50a1e699f1fa806ad99.tar.gz
systemtap-steved-b0be9bdb8c6972d847cad50a1e699f1fa806ad99.tar.xz
systemtap-steved-b0be9bdb8c6972d847cad50a1e699f1fa806ad99.zip
PR5516: assignment to $pointers
2008-03-03 Frank Ch. Eigler <fche@elastic.org> 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 <fche@elastic.org> PR5516 * buildok/twentynine.stp: New test.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx49
1 files changed, 29 insertions, 20 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 52c14024..147ea3f0 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1601,7 +1601,7 @@ struct dwflpp
if (components[i].first == target_symbol::comp_literal_array_index)
throw semantic_error ("cannot index pointer");
// XXX: of course, we should support this the same way C does,
- // by explicit pointer arithmetic etc.
+ // by explicit pointer arithmetic etc. PR4166.
c_translate_pointer (pool, 1, module_bias, die, tail);
break;
@@ -1773,10 +1773,7 @@ struct dwflpp
case DW_TAG_array_type:
case DW_TAG_pointer_type:
- if (lvalue)
- throw semantic_error ("cannot store into target pointer value");
-
- {
+ {
Dwarf_Die pointee_typedie_mem;
Dwarf_Die *pointee_typedie;
Dwarf_Word pointee_encoding;
@@ -1790,21 +1787,33 @@ struct dwflpp
dwarf_formudata (dwarf_attr_integrate (pointee_typedie, DW_AT_encoding, attr_mem),
&pointee_encoding);
- // We have the pointer: cast it to an integral type via &(*(...))
-
- // NB: per bug #1187, at one point char*-like types were
- // automagically converted here to systemtap string values.
- // For several reasons, this was taken back out, leaving
- // pointer-to-string "conversion" (copying) to tapset functions.
-
- ty = pe_long;
- if (typetag == DW_TAG_array_type)
- c_translate_array (pool, 1, module_bias, typedie, tail, NULL, 0);
- else
- c_translate_pointer (pool, 1, module_bias, typedie, tail);
- c_translate_addressof (pool, 1, module_bias, NULL, pointee_typedie, tail,
- "THIS->__retvalue");
- }
+ if (lvalue)
+ {
+ ty = pe_long;
+ if (typetag == DW_TAG_array_type)
+ throw semantic_error ("cannot write to array address");
+ assert (typetag == DW_TAG_pointer_type);
+ c_translate_pointer_store (pool, 1, module_bias, typedie, tail,
+ "THIS->value");
+ }
+ else
+ {
+ // We have the pointer: cast it to an integral type via &(*(...))
+
+ // NB: per bug #1187, at one point char*-like types were
+ // automagically converted here to systemtap string values.
+ // For several reasons, this was taken back out, leaving
+ // pointer-to-string "conversion" (copying) to tapset functions.
+
+ ty = pe_long;
+ if (typetag == DW_TAG_array_type)
+ c_translate_array (pool, 1, module_bias, typedie, tail, NULL, 0);
+ else
+ c_translate_pointer (pool, 1, module_bias, typedie, tail);
+ c_translate_addressof (pool, 1, module_bias, NULL, pointee_typedie, tail,
+ "THIS->__retvalue");
+ }
+ }
break;
}
}