diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-07-12 20:59:03 +0200 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2015-07-15 17:42:51 +0200 |
commit | 0a94970d663a053c523f23ac0d71deb25a77f709 (patch) | |
tree | 9a696e90e2650ff7c27b53bc235ae6fe6521c968 /gdb/testsuite/gdb.base/solib-mismatch.c | |
parent | ca5268b6be265580b91ef75c1a1a9815f581ae42 (diff) | |
download | gdb-0a94970d663a053c523f23ac0d71deb25a77f709.zip gdb-0a94970d663a053c523f23ac0d71deb25a77f709.tar.gz gdb-0a94970d663a053c523f23ac0d71deb25a77f709.tar.bz2 |
Tests for validate symbol file using build-id
New testcase.
gdb/testsuite/ChangeLog
2015-07-15 Aleksandar Ristovski <aristovski@qnx.com
Tests for validate symbol file using build-id.
* gdb.base/solib-mismatch-lib.c: New file.
* gdb.base/solib-mismatch-libmod.c: New file.
* gdb.base/solib-mismatch.c: New file.
* gdb.base/solib-mismatch.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/solib-mismatch.c')
-rw-r--r-- | gdb/testsuite/gdb.base/solib-mismatch.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/solib-mismatch.c b/gdb/testsuite/gdb.base/solib-mismatch.c new file mode 100644 index 0000000..f739f3b --- /dev/null +++ b/gdb/testsuite/gdb.base/solib-mismatch.c @@ -0,0 +1,56 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <stdio.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> + +/* The following defines must correspond to solib-mismatch.exp . */ + +/* DIRNAME and LIB must be defined at compile time. */ +#ifndef DIRNAME +# error DIRNAME not defined +#endif +#ifndef LIB +# error LIB not defined +#endif + +int +main (int argc, char *argv[]) +{ + void *h; + int (*foo) (void); + + if (chdir (DIRNAME) != 0) + { + printf ("ERROR - Could not cd to %s\n", DIRNAME); + return 1; + } + + h = dlopen (LIB, RTLD_NOW); + + if (h == NULL) + { + printf ("ERROR - could not open lib %s\n", LIB); + return 1; + } + foo = dlsym (h, "foo"); /* set breakpoint 1 here */ + dlclose (h); + return 0; +} |