Blame tests/testfile-backtrace-demangle.cc

Packit 032894
/* Test program for C++ demangled unwinding.
Packit 032894
   Copyright (C) 2014 Red Hat, Inc.
Packit 032894
   This file is part of elfutils.
Packit 032894
Packit 032894
   This file is free software; you can redistribute it and/or modify
Packit 032894
   it under the terms of the GNU General Public License as published by
Packit 032894
   the Free Software Foundation; either version 3 of the License, or
Packit 032894
   (at your option) any later version.
Packit 032894
Packit 032894
   elfutils is distributed in the hope that it will be useful, but
Packit 032894
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 032894
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 032894
   GNU General Public License for more details.
Packit 032894
Packit 032894
   You should have received a copy of the GNU General Public License
Packit 032894
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 032894
Packit 032894
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
Packit 032894
#define NOINLINE_NOCLONE __attribute__ ((noinline, noclone))
Packit 032894
#else
Packit 032894
#define NOINLINE_NOCLONE __attribute__ ((noinline))
Packit 032894
#endif
Packit 032894
Packit 032894
void NOINLINE_NOCLONE
Packit 032894
cxxfunc (int i)
Packit 032894
{
Packit 032894
  *(volatile int *)0=0;
Packit 032894
  // Avoid tail call optimization.
Packit 032894
  asm volatile ("");
Packit 032894
}
Packit 032894
Packit 032894
extern "C"
Packit 032894
{
Packit 032894
  void NOINLINE_NOCLONE
Packit 032894
  f (void)
Packit 032894
  {
Packit 032894
    cxxfunc(1);
Packit 032894
    // Avoid tail call optimization.
Packit 032894
    asm volatile ("");
Packit 032894
  }
Packit 032894
}
Packit 032894
Packit 032894
int
Packit 032894
main()
Packit 032894
{
Packit 032894
  f();
Packit 032894
}