summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroland <roland>2005-08-11 04:26:33 +0000
committerroland <roland>2005-08-11 04:26:33 +0000
commit23038bd15115627068fd2c3931e2d36481fc8189 (patch)
tree1836fd6d66cfe68d8f71f24d16365439225c3024
parente141cc199c57f12410f666b79e2dc4bc209edcba (diff)
downloadsystemtap-steved-23038bd15115627068fd2c3931e2d36481fc8189.tar.gz
systemtap-steved-23038bd15115627068fd2c3931e2d36481fc8189.tar.xz
systemtap-steved-23038bd15115627068fd2c3931e2d36481fc8189.zip
2005-08-10 Roland McGrath <roland@redhat.com>
* loc2c.c (emit_base_store): New function. (emit_bitfield): Rewritten to handle stores, change parameters. (c_translate_fetch): Update caller. (c_translate_store): New function. * loc2c-test.c (handle_variable): Grok "=" last argument to do a store.
-rw-r--r--loc2c-test.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/loc2c-test.c b/loc2c-test.c
index c7132664..5edcd149 100644
--- a/loc2c-test.c
+++ b/loc2c-test.c
@@ -78,11 +78,20 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
error (2, 0, _("cannot get type of variable: %s"),
dwarf_errmsg (-1));
+ bool store = false;
Dwarf_Die die_mem, *die = vardie;
while (*fields != NULL)
{
die = dwarf_formref_die (&attr_mem, &die_mem);
+ if (!strcmp (*fields, "="))
+ {
+ store = true;
+ if (fields[1] != NULL)
+ error (2, 0, _("extra fields after ="));
+ break;
+ }
+
const int typetag = dwarf_tag (die);
switch (typetag)
{
@@ -179,22 +188,29 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
}
- c_translate_fetch (&pool, 1, cubias, die, &attr_mem, &tail, "value");
+ if (store)
+ c_translate_store (&pool, 1, cubias, die, &attr_mem, &tail, "value");
+ else
+ c_translate_fetch (&pool, 1, cubias, die, &attr_mem, &tail, "value");
printf ("#define PROBEADDR %#" PRIx64 "ULL\n", pc);
- puts ("static void print_value(struct pt_regs *regs)\n"
+
+ puts (store
+ ? "static void set_value(struct pt_regs *regs, intptr_t value)\n{"
+ : "static void print_value(struct pt_regs *regs)\n"
"{\n"
" intptr_t value;");
bool deref = c_emit_location (stdout, head, 1);
- puts (" printk (\" ---> %ld\\n\", (unsigned long) value);\n"
+ puts (store ? " return;" :
+ " printk (\" ---> %ld\\n\", (unsigned long) value);\n"
" return;");
if (deref)
puts ("\n"
" deref_fault:\n"
- " printk (\" => BAD FETCH\\n\");");
+ " printk (\" => BAD ACCESS\\n\");");
puts ("}");
}