summaryrefslogtreecommitdiffstats
path: root/loc2c-test.c
diff options
context:
space:
mode:
authorroland <roland>2005-08-18 03:41:29 +0000
committerroland <roland>2005-08-18 03:41:29 +0000
commite36387d7f8597e307927a8d7e1bd5d216d52e3db (patch)
tree67dda187433175c4b837a605541ee24c71c96194 /loc2c-test.c
parentbcde33fbb0a7991abbec44d76005c4acde723a86 (diff)
downloadsystemtap-steved-e36387d7f8597e307927a8d7e1bd5d216d52e3db.tar.gz
systemtap-steved-e36387d7f8597e307927a8d7e1bd5d216d52e3db.tar.xz
systemtap-steved-e36387d7f8597e307927a8d7e1bd5d216d52e3db.zip
2005-08-17 Roland McGrath <roland@redhat.com>
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.
Diffstat (limited to 'loc2c-test.c')
-rw-r--r--loc2c-test.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/loc2c-test.c b/loc2c-test.c
index 05f51c25..aab92144 100644
--- a/loc2c-test.c
+++ b/loc2c-test.c
@@ -14,7 +14,8 @@
#include <elfutils/libdwfl.h>
#include <dwarf.h>
#include <obstack.h>
-
+#include <unistd.h>
+#include <stdarg.h>
#include "loc2c.h"
#define _(msg) msg
@@ -27,6 +28,19 @@ dwarf_diename_integrate (Dwarf_Die *die)
}
+static void __attribute__ ((noreturn))
+fail (void *arg __attribute__ ((unused)), const char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf (stderr, "%s: ", program_invocation_short_name);
+
+ va_start (ap, fmt);
+ vfprintf (stderr, _(fmt), ap);
+ va_end (ap);
+
+ exit (2);
+}
static void
handle_variable (Dwarf_Die *scopes, int nscopes, int out,
@@ -71,7 +85,7 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
#define emit(fmt, ...) printf (" addr = " fmt "\n", ## __VA_ARGS__)
struct location *head, *tail = NULL;
- head = c_translate_location (&pool, 1, cubias, &attr_mem, pc,
+ head = c_translate_location (&pool, &fail, NULL, 1, cubias, &attr_mem, pc,
&tail, fb_attr);
if (dwarf_attr_integrate (vardie, DW_AT_type, &attr_mem) == NULL)
@@ -162,7 +176,7 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
*fields, dwarf_errmsg (-1));
}
else
- c_translate_location (&pool, 1, cubias, &attr_mem, pc,
+ c_translate_location (&pool, NULL, NULL, 1, cubias, &attr_mem, pc,
&tail, NULL);
++fields;
break;