From 5409e5bf98ddc994931754d0cb1cae36ba9a08fd Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 16 Nov 2009 21:41:13 +0100 Subject: Add testcase for retrieving $global vars from execs and shared libs. Explicit testcase for PR10010 and PR10622. * testsuite/systemtap.base/externalvar.c: New file. * testsuite/systemtap.base/externalvar.exp: New file. * testsuite/systemtap.base/externalvar.stp: New file. * testsuite/systemtap.base/externalvar_lib.c: New file. --- testsuite/systemtap.base/externalvar_lib.c | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 testsuite/systemtap.base/externalvar_lib.c (limited to 'testsuite/systemtap.base/externalvar_lib.c') diff --git a/testsuite/systemtap.base/externalvar_lib.c b/testsuite/systemtap.base/externalvar_lib.c new file mode 100644 index 00000000..9017e798 --- /dev/null +++ b/testsuite/systemtap.base/externalvar_lib.c @@ -0,0 +1,43 @@ +/* external var test case - library helper + * Copyright (C) 2009, Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + * + * Tests that an external exported variable can be accessed. + */ + +#include + +struct libstruct +{ + int i; + long l; + char c; + struct libstruct *s1; + struct libstruct *s2; +}; + +int libvar; +struct libstruct *lib_s; + +static void +lib_call () +{ + asm(""); // dummy method, just to probe and extract. +} + +void +lib_main () +{ + libvar = 42; + lib_s = (struct libstruct *) malloc(sizeof(struct libstruct)); + lib_s->i = 1; + lib_s->l = 2; + lib_s->c = 3; + lib_s->s1 = lib_s; + lib_s->s2 = NULL; + lib_call (); +} -- cgit