diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-11-16 21:41:13 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-11-16 21:41:13 +0100 |
commit | 5409e5bf98ddc994931754d0cb1cae36ba9a08fd (patch) | |
tree | 7c0be46d2a2bb69882104987fef3aa3692265fcb /testsuite/systemtap.base/externalvar_lib.c | |
parent | a295050e60affe0bb55fc2d46637314c0822f35d (diff) | |
download | systemtap-steved-5409e5bf98ddc994931754d0cb1cae36ba9a08fd.tar.gz systemtap-steved-5409e5bf98ddc994931754d0cb1cae36ba9a08fd.tar.xz systemtap-steved-5409e5bf98ddc994931754d0cb1cae36ba9a08fd.zip |
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.
Diffstat (limited to 'testsuite/systemtap.base/externalvar_lib.c')
-rw-r--r-- | testsuite/systemtap.base/externalvar_lib.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 <stdlib.h> + +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 (); +} |