From 73267b89ea6ede28b1a0a10667774bca6eb2b37e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 28 Jan 2009 17:01:20 -0800 Subject: Add Vim modelines for GNU style in stap --- loc2c.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'loc2c.h') diff --git a/loc2c.h b/loc2c.h index 03f9e74c..67f4a38a 100644 --- a/loc2c.h +++ b/loc2c.h @@ -93,3 +93,5 @@ c_translate_pointer_store (struct obstack *pool, int indent, Writes complete lines of C99, code forming a complete C block, to STREAM. Return value is true iff that code uses the `deref' runtime macros. */ bool c_emit_location (FILE *stream, struct location *loc, int indent); + +/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ -- cgit From c4ce66a13b44386263ede8ac13924d666b69d53e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 17 Feb 2009 18:15:06 -0800 Subject: Enable dwarf expansion of @casts This will iterate over the module and its CUs looking for the type definition, and then work with loc2c to dereference the pointer. * loc2c.c (c_translate_argument): Create a dummy location to start the address computation from a function parameter. * translate.cxx (base_query, dwarf_query): Move some members from base_query to dwarf_query, so the former can be more generic. Also add a constructor using a module string instead of probe parameters. (dwflpp::query_modules, dwflpp::iterate_over_modules): Use a generic base_query instead of a dwarf_query. (dwarf_cast_query): New query to scan the modules and CUs for a matching type definition, and then produce a code fragment to deref each component. (dwarf_cast_expanding_visitor): Tries to replace @casts with a function call to the result of a dwarf_cast_query. (dwflpp::declaration_resolve): Search by name instead of by die. (dwflpp::translate_components): Use the incoming vardie as the first type die, so we don't assume that attr_mem has a DW_AT_type already. (dwflpp::literal_stmt_for_pointer): Construct a C fragment that starts with a pointer argument (THIS->pointer) and dereferences each member component from there. (*_derived_probe::register_patterns): Take a session parameter instead of a match_node, so we can manipulate session-wide data. (dwarf_derived_probe::register_patterns): Add a session code filter to expand @casts with a dwarf_cast_expanding_visitor. --- loc2c.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'loc2c.h') diff --git a/loc2c.h b/loc2c.h index 67f4a38a..0ad5ae99 100644 --- a/loc2c.h +++ b/loc2c.h @@ -85,6 +85,21 @@ c_translate_pointer_store (struct obstack *pool, int indent, Dwarf_Die *typedie, struct location **input, const char *rvalue); +/* 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 *, + 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); + + /* Emit the C fragment built up at LOC (i.e., the return value from the first c_translate_location call made). INDENT should match that -- cgit