mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-09 04:15:52 +00:00
parent
49f7d02f80
commit
1cfa14b2f2
40
repos/os/include/spec/arm/os/backtrace.h
Normal file
40
repos/os/include/spec/arm/os/backtrace.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* \brief Backtrace helper utility
|
||||
* \date 2015-09-18
|
||||
* \author Christian Prochaska
|
||||
* \author Stefan Kalkowski
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__ARM__OS__BACKTRACE_H_
|
||||
#define _INCLUDE__SPEC__ARM__OS__BACKTRACE_H_
|
||||
|
||||
#include <base/log.h>
|
||||
|
||||
namespace Genode { void inline backtrace() __attribute__((always_inline)); }
|
||||
|
||||
/**
|
||||
* Print frame pointer based backtrace
|
||||
*
|
||||
* To use this function compile your code with the -fno-omit-frame-pointer GCC
|
||||
* option.
|
||||
*/
|
||||
void inline Genode::backtrace()
|
||||
{
|
||||
addr_t * fp;
|
||||
|
||||
asm volatile ("mov %0, %%fp" : "=r"(fp) : :);
|
||||
|
||||
while (fp && *fp) {
|
||||
Genode::log(Hex(*fp));
|
||||
fp = (addr_t*)*(fp - 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__ARM__OS__BACKTRACE_H_ */
|
41
repos/os/include/spec/x86_32/os/backtrace.h
Normal file
41
repos/os/include/spec/x86_32/os/backtrace.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* \brief Backtrace helper utility
|
||||
* \date 2015-09-18
|
||||
* \author Christian Prochaska
|
||||
* \author Stefan Kalkowski
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__X86_32__OS__BACKTRACE_H_
|
||||
#define _INCLUDE__SPEC__X86_32__OS__BACKTRACE_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
#include <base/log.h>
|
||||
|
||||
namespace Genode { void inline backtrace() __attribute__((always_inline)); }
|
||||
|
||||
/**
|
||||
* Print frame pointer based backtrace
|
||||
*
|
||||
* To use this function compile your code with the -fno-omit-frame-pointer GCC
|
||||
* option.
|
||||
*/
|
||||
void inline Genode::backtrace()
|
||||
{
|
||||
Genode::addr_t * fp;
|
||||
|
||||
asm volatile ("movl %%ebp, %0" : "=r"(fp) : :);
|
||||
|
||||
while (fp && *(fp + 1)) {
|
||||
Genode::log(Hex(*(fp + 1)));
|
||||
fp = (Genode::addr_t*)*fp;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__X86_32__OS__BACKTRACE_H_ */
|
41
repos/os/include/spec/x86_64/os/backtrace.h
Normal file
41
repos/os/include/spec/x86_64/os/backtrace.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* \brief Backtrace helper utility
|
||||
* \date 2015-09-18
|
||||
* \author Christian Prochaska
|
||||
* \author Stefan Kalkowski
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2016 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__SPEC__X86_64__OS__BACKTRACE_H_
|
||||
#define _INCLUDE__SPEC__X86_64__OS__BACKTRACE_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
#include <base/log.h>
|
||||
|
||||
namespace Genode { void inline backtrace() __attribute__((always_inline)); }
|
||||
|
||||
/**
|
||||
* Print frame pointer based backtrace
|
||||
*
|
||||
* To use this function compile your code with the -fno-omit-frame-pointer GCC
|
||||
* option.
|
||||
*/
|
||||
void inline Genode::backtrace()
|
||||
{
|
||||
Genode::addr_t * fp;
|
||||
|
||||
asm volatile ("movq %%rbp, %0" : "=r"(fp) : :);
|
||||
|
||||
while (fp && *(fp + 1)) {
|
||||
Genode::log(Hex(*(fp + 1)));
|
||||
fp = (Genode::addr_t*)*fp;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__SPEC__X86_64__OS__BACKTRACE_H_ */
|
Loading…
x
Reference in New Issue
Block a user