Blame tests/testfile-backtrace-demangle.cc

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