summaryrefslogtreecommitdiffstats
path: root/tests/deleted-lib.c
diff options
context:
space:
mode:
authorJan Kratochvil <[email protected]>2014-08-17 18:49:36 +0200
committerJan Kratochvil <[email protected]>2014-08-29 22:35:52 +0200
commit0375056af003d7676fb852e09782a985f3a52b1a (patch)
tree6d101dbae653236bc7f9f0e5234f3a8c0e8dd792 /tests/deleted-lib.c
parentf1ec744b5747a3bd66297c9f965be6ea10cb7f86 (diff)
Fix resolving ELF symbols for live PIDs with deleted files
For deleted shared library files the offsets to the symbol table were calculated wrongly from the phdrs because the main_bias wasn't taken into account. Formerly shared libraries did not get resolved properly: #2 0x00007fc4d86c56d6 #3 0x0000000000400938 main Fixed elfutils produce: #2 0x00007f61094876d6 libfunc #3 0x0000000000400938 main Signed-off-by: Jan Kratochvil <[email protected]>
Diffstat (limited to 'tests/deleted-lib.c')
-rw-r--r--tests/deleted-lib.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/deleted-lib.c b/tests/deleted-lib.c
new file mode 100644
index 00000000..1ff411b7
--- /dev/null
+++ b/tests/deleted-lib.c
@@ -0,0 +1,27 @@
+/* Test program for opening already deleted running binaries.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file 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.
+
+ elfutils 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 <config.h>
+#include <unistd.h>
+
+void
+libfunc (void)
+{
+ sleep (60000);
+ /* Avoid tail call optimization for the sleep call. */
+ asm volatile ("");
+}