summaryrefslogtreecommitdiff
path: root/tests/testfilecfaloop.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2014-01-03 22:06:12 +0100
committerJan Kratochvil <jan.kratochvil@redhat.com>2014-01-03 22:06:36 +0100
commit305705207e0831e6387706065e59f91296ba0d0a (patch)
treeed834da7297a96dc1faf31eadabb7352df57f2fb /tests/testfilecfaloop.c
parenta6141d27691a68a4af5eb48ab10d27e74d3c2a6b (diff)
downloadelfutils-jankratochvil/cfaloop.tar.gz
Detect infinite backtraces.jankratochvil/cfaloop
libdwfl/ 2014-01-03 Jan Kratochvil <jan.kratochvil@redhat.com> Detect infinite backtraces. * dwfl_frame.c (state_alloc): Initialize CFA. * frame_unwind.c (expr_eval): Remove parameter frame, add parameter elfclass. Move elfclass to handle_cfi. Replace recursive call by state->unwound->CFA. (new_unwound): Initialize CFA. (handle_cfi): Move elfclass here. Compute CFA. Update expr_eval caller parameters. * libdwflP.h (DWFL_ERRORS): Add UNWIND_BAD_CFA. (struct Dwfl_Frame): Add field cfa. tests/ 2014-01-03 Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.am (TESTS): Add run-cfaloop.sh. (EXTRA_DIST): Add run-cfaloop.sh, testfilecfaloop.S, testfilecfaloop.bz2, testfilecfaloop.c and testfilecfaloop.core.bz2. * run-cfaloop.sh: New file. * testfilecfaloop.S: New file. * testfilecfaloop.bz2: New file. * testfilecfaloop.c: New file. * testfilecfaloop.core.bz2: New file. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Diffstat (limited to 'tests/testfilecfaloop.c')
-rw-r--r--tests/testfilecfaloop.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/testfilecfaloop.c b/tests/testfilecfaloop.c
new file mode 100644
index 00000000..14a2fca8
--- /dev/null
+++ b/tests/testfilecfaloop.c
@@ -0,0 +1,22 @@
+/* Test program for run-cfaloop.sh.
+ 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/>. */
+
+// gcc -o testfilecfaloop.S testfilecfaloop.c -Wall -O2 -dA -fno-dwarf2-cfi-asm -nostdlib -S
+void _start(void) {
+ volatile int *volatile p = 0;
+ *p = 0;
+}