]> sourceware.org Git - systemtap.git/commitdiff
2005-08-10 Roland McGrath <roland@redhat.com>
authorroland <roland>
Thu, 11 Aug 2005 04:26:33 +0000 (04:26 +0000)
committerroland <roland>
Thu, 11 Aug 2005 04:26:33 +0000 (04:26 +0000)
* 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.

loc2c-test.c

index c71326641cdc7c643f2d2bb6faff6584cdef3ff9..5edcd1498f253a2bf768529c4b98ff2fc7df7304 100644 (file)
@@ -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 ("}");
 }
This page took 0.028702 seconds and 5 git commands to generate.