From e36387d7f8597e307927a8d7e1bd5d216d52e3db Mon Sep 17 00:00:00 2001 From: roland Date: Thu, 18 Aug 2005 03:41:29 +0000 Subject: 2005-08-17 Roland McGrath PR systemtap/1197 * loc2c.c (struct location): New members `fail', `fail_arg'. (alloc_location): New function. Initialize those members. (new_synthetic_loc, translate): Use that instead of obstack_alloc. (location_from_address, location_relative): Likewise. (FAIL): New macro. Use it everywhere in place of `error'. * loc2c-test.c (fail): New function. (handle_variable): Pass it to c_translate_location. * tapsets.cxx (dwflpp::loc2c_error): New static method. (dwflpp::literal_stmt_for_local): Pass it to to c_translate_location. --- tapsets.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 1315cdf6..da16750a 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -19,6 +19,7 @@ #include #include #include +#include extern "C" { #include @@ -628,6 +629,15 @@ dwflpp return false; } + static void loc2c_error (void *arg, const char *fmt, ...) + { + char *msg = NULL; + va_list ap; + va_start (ap, fmt); + vasprintf (&msg, fmt, ap); + va_end (ap); + throw semantic_error (msg); + } string literal_stmt_for_local(Dwarf_Addr pc, string const & local, @@ -692,7 +702,8 @@ dwflpp struct obstack pool; obstack_init (&pool); struct location *tail = NULL; - struct location *head = c_translate_location (&pool, 1, module_bias, + struct location *head = c_translate_location (&pool, &loc2c_error, this, + 1, module_bias, &attr_mem, pc, &tail, fb_attr); @@ -769,7 +780,8 @@ dwflpp + " :" + string(dwarf_errmsg (-1))); } else - c_translate_location (&pool, 1, module_bias, &attr_mem, pc, + c_translate_location (&pool, NULL, NULL, 1, + module_bias, &attr_mem, pc, &tail, NULL); ++i; break; -- cgit