Merge pull request #14204 from kaspar030/rename_native_trace

cpu/native: rename trace -> backtrace
This commit is contained in:
Francisco 2020-06-09 16:37:26 +02:00 committed by GitHub
commit 6c65fa72d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 23 deletions

View File

@ -26,8 +26,8 @@ endif
ifneq (,$(filter can_linux,$(USEMODULE)))
DIRS += can
endif
ifneq (,$(filter trace,$(USEMODULE)))
DIRS += trace
ifneq (,$(filter backtrace,$(USEMODULE)))
DIRS += backtrace
endif
include $(RIOTBASE)/Makefile.base

View File

@ -17,14 +17,14 @@
#include <stddef.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 = backtrace(array, TRACE_SIZE + 1);
size = backtrace(array, BACKTRACE_SIZE + 1);
/* skip above line's return address and start with 1 */
for (size_t i = 1; i < size; i++) {

View File

@ -7,12 +7,12 @@
*/
/**
* @defgroup trace Stack traceback (only under native)
* @defgroup backtrace Stack backtrace (only under native)
* @ingroup core_util
* @brief Address-trace back.
* @brief Backtrace functionalitry
*
* If you call the @ref trace_print() function a stack traceback of all return
* addresses up to @ref TRACE_SIZE will be printed from the point of execution.
* If you call the @ref backtrace_print() function a stack backtrace of all return
* 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>
*/
#ifndef TRACE_H
#define TRACE_H
#ifndef BACKTRACE_H
#define BACKTRACE_H
#ifdef __cplusplus
extern "C" {
@ -31,19 +31,19 @@ extern "C" {
/**
* @brief Maximum number of return addresses to print
*/
#ifndef TRACE_SIZE
#define TRACE_SIZE (4U)
#ifndef BACKTRACE_SIZE
#define BACKTRACE_SIZE (4U)
#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
*/
void trace_print(void);
void backtrace_print(void);
#ifdef __cplusplus
}
#endif
#endif /* TRACE_H */
#endif /* BACKTRACE_H */
/** @} */

View File

@ -1,6 +1,6 @@
include ../Makefile.tests_common
USEMODULE += trace
USEMODULE += backtrace
BOARD_WHITELIST := native

View File

@ -11,7 +11,7 @@
* @{
*
* @file
* @brief Tests od module.
* @brief Tests backtrace module.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*
@ -20,11 +20,11 @@
#include <stdio.h>
#include "trace.h"
#include "backtrace.h"
int main(void)
{
printf("TRACE_SIZE: %u\n", TRACE_SIZE);
trace_print();
printf("BACKTRACE_SIZE: %u\n", BACKTRACE_SIZE);
backtrace_print();
return 0;
}

View File

@ -11,7 +11,7 @@ from testrunner import run
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))
for i in range(trace_size):
child.expect(r"0x[0-9a-f]{7,8}")