diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-02-20 14:56:38 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-02-20 14:56:38 +0100 |
commit | 02615365a92ca2570c1f96abc8a97674aa2ccae1 (patch) | |
tree | ebedfd91a0f6d299b39e84295e091e12c0767dc8 /loc2c.c | |
parent | c3bad3042df505a3470f1e20b09822a9df1d4761 (diff) | |
parent | adc67597f327cd43d58b1d0cb740dab14a75a058 (diff) | |
download | systemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.tar.gz systemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.tar.xz systemtap-steved-02615365a92ca2570c1f96abc8a97674aa2ccae1.zip |
Merge branch 'master' into pr6866
Conflicts:
ChangeLog: Removed
runtime/ChangeLog: Removed
runtime/sym.c: Merged
runtime/task_finder.c: Merged
tapset/ChangeLog: Removed
testsuite/ChangeLog: Removed
Diffstat (limited to 'loc2c.c')
-rw-r--r-- | loc2c.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -1021,6 +1021,43 @@ c_translate_location (struct obstack *pool, return NULL; } +/* Translate a C fragment for a direct argument VALUE. On errors, call FAIL, + which should not return. Any later errors will use FAIL and FAIL_ARG from + this translate call. On success, return the fragment created. */ +struct location * +c_translate_argument (struct obstack *pool, + void (*fail) (void *arg, const char *fmt, ...) + __attribute__ ((noreturn, format (printf, 2, 3))), + void *fail_arg, + void (*emit_address) (void *fail_arg, + struct obstack *, Dwarf_Addr), + int indent, const char *value) +{ + indent += 2; + + obstack_printf(pool, "%*saddr = %s;\n", indent * 2, "", value); + obstack_1grow (pool, '\0'); + char *program = obstack_finish (pool); + + struct location *loc = obstack_alloc (pool, sizeof *loc); + loc->next = NULL; + loc->fail = fail; + loc->fail_arg = fail_arg; + loc->emit_address = emit_address; + loc->ops = NULL; + loc->nops = 0; + loc->byte_size = 0; + loc->type = loc_address; + loc->frame_base = NULL; + loc->address.declare = NULL; + loc->address.program = program; + loc->address.stack_depth = 0; + loc->address.used_deref = false; + + return loc; +} + + /* Emit "uintNN_t TARGET = ...;". */ static bool emit_base_fetch (struct obstack *pool, Dwarf_Word byte_size, @@ -1914,3 +1951,5 @@ c_emit_location (FILE *out, struct location *loc, int indent) } #undef emit + +/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ |