Merge pull request #14204 from kaspar030/rename_native_trace
cpu/native: rename trace -> backtrace
This commit is contained in:
commit
6c65fa72d7
@ -26,8 +26,8 @@ endif
|
|||||||
ifneq (,$(filter can_linux,$(USEMODULE)))
|
ifneq (,$(filter can_linux,$(USEMODULE)))
|
||||||
DIRS += can
|
DIRS += can
|
||||||
endif
|
endif
|
||||||
ifneq (,$(filter trace,$(USEMODULE)))
|
ifneq (,$(filter backtrace,$(USEMODULE)))
|
||||||
DIRS += trace
|
DIRS += backtrace
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
|||||||
@ -17,14 +17,14 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "trace.h"
|
#include "backtrace.h"
|
||||||
|
|
||||||
void trace_print(void)
|
void backtrace_print(void)
|
||||||
{
|
{
|
||||||
void *array[TRACE_SIZE + 1];
|
void *array[BACKTRACE_SIZE + 1];
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
size = backtrace(array, TRACE_SIZE + 1);
|
size = backtrace(array, BACKTRACE_SIZE + 1);
|
||||||
|
|
||||||
/* skip above line's return address and start with 1 */
|
/* skip above line's return address and start with 1 */
|
||||||
for (size_t i = 1; i < size; i++) {
|
for (size_t i = 1; i < size; i++) {
|
||||||
@ -7,12 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup trace Stack traceback (only under native)
|
* @defgroup backtrace Stack backtrace (only under native)
|
||||||
* @ingroup core_util
|
* @ingroup core_util
|
||||||
* @brief Address-trace back.
|
* @brief Backtrace functionalitry
|
||||||
*
|
*
|
||||||
* If you call the @ref trace_print() function a stack traceback of all return
|
* If you call the @ref backtrace_print() function a stack backtrace of all return
|
||||||
* addresses up to @ref TRACE_SIZE will be printed from the point of execution.
|
* addresses up to @ref BACKTRACE_SIZE will be printed from the point of execution.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
@ -21,8 +21,8 @@
|
|||||||
*
|
*
|
||||||
* @author Martine Lenders <m.lenders@fu-berlin.de>
|
* @author Martine Lenders <m.lenders@fu-berlin.de>
|
||||||
*/
|
*/
|
||||||
#ifndef TRACE_H
|
#ifndef BACKTRACE_H
|
||||||
#define TRACE_H
|
#define BACKTRACE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -31,19 +31,19 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Maximum number of return addresses to print
|
* @brief Maximum number of return addresses to print
|
||||||
*/
|
*/
|
||||||
#ifndef TRACE_SIZE
|
#ifndef BACKTRACE_SIZE
|
||||||
#define TRACE_SIZE (4U)
|
#define BACKTRACE_SIZE (4U)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Print the last @ref TRACE_SIZE return addresses from call of this
|
* @brief Print the last @ref BACKTRACE_SIZE return addresses from call of this
|
||||||
* function
|
* function
|
||||||
*/
|
*/
|
||||||
void trace_print(void);
|
void backtrace_print(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* TRACE_H */
|
#endif /* BACKTRACE_H */
|
||||||
/** @} */
|
/** @} */
|
||||||
@ -1,6 +1,6 @@
|
|||||||
include ../Makefile.tests_common
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
USEMODULE += trace
|
USEMODULE += backtrace
|
||||||
|
|
||||||
BOARD_WHITELIST := native
|
BOARD_WHITELIST := native
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* @file
|
* @file
|
||||||
* @brief Tests od module.
|
* @brief Tests backtrace module.
|
||||||
*
|
*
|
||||||
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
||||||
*
|
*
|
||||||
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "trace.h"
|
#include "backtrace.h"
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("TRACE_SIZE: %u\n", TRACE_SIZE);
|
printf("BACKTRACE_SIZE: %u\n", BACKTRACE_SIZE);
|
||||||
trace_print();
|
backtrace_print();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -11,7 +11,7 @@ from testrunner import run
|
|||||||
|
|
||||||
|
|
||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
child.expect(r"TRACE_SIZE: (\d+)\r\n")
|
child.expect(r"BACKTRACE_SIZE: (\d+)\r\n")
|
||||||
trace_size = int(child.match.group(1))
|
trace_size = int(child.match.group(1))
|
||||||
for i in range(trace_size):
|
for i in range(trace_size):
|
||||||
child.expect(r"0x[0-9a-f]{7,8}")
|
child.expect(r"0x[0-9a-f]{7,8}")
|
||||||
Loading…
x
Reference in New Issue
Block a user