1 /* Test program for C++ demangled unwinding. 2 Copyright (C) 2014 Red Hat, Inc. 3 This file is part of elfutils. 4 5 This file is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 elfutils is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 18 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 19 #define NOINLINE_NOCLONE __attribute__ ((noinline, noclone)) 20 #else 21 #define NOINLINE_NOCLONE __attribute__ ((noinline)) 22 #endif 23 24 void NOINLINE_NOCLONE 25 cxxfunc (int i) 26 { 27 *(volatile int *)0=0; 28 // Avoid tail call optimization. 29 asm volatile (""); 30 } 31 32 extern "C" 33 { 34 void NOINLINE_NOCLONE 35 f (void) 36 { 37 cxxfunc(1); 38 // Avoid tail call optimization. 39 asm volatile (""); 40 } 41 } 42 43 int 44 main() 45 { 46 f(); 47 } 48