source: rtems/cpukit/libmisc/stackchk/stackchk.h @ 575c2e21

5
Last change on this file since 575c2e21 was 575c2e21, checked in by Stavros Passas <stavros.passas@…>, on 01/30/17 at 10:24:57

Complete STACK_CHECKER_EXTENSION. Fixes #2889

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/**
2 * @file rtems/stackchk.h
3 *
4 * @defgroup libmisc_stackchk Stack Checker Mechanism
5 *
6 * @ingroup libmisc
7 * @brief Stack Checker Information
8 *
9 * This include file contains information necessary to utilize
10 * and install the stack checker mechanism.
11 */
12
13/*
14 *  COPYRIGHT (c) 1989-2009.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef _RTEMS_STACKCHK_H
23#define _RTEMS_STACKCHK_H
24
25#include <stdbool.h> /* bool */
26
27#include <rtems/score/thread.h> /* Thread_Control */
28#include <rtems/print.h>
29
30/**
31 *  @defgroup libmisc_stackchk Stack Checker Mechanism
32 *
33 *  @ingroup libmisc
34 */
35/**@{*/
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/**
41 * @brief Checks if current task is blown its stack.
42 *
43 * This method is used to determine if the current stack pointer
44 * of the currently executing task is within bounds.
45 *
46 * @retval This method returns true if the currently executing task
47 * has blown its stack.
48 *
49 */
50bool rtems_stack_checker_is_blown( void );
51
52/**
53 * @brief Print the stack usage report using printk.
54 *
55 * This method prints a stack usage report for the curently executing
56 * task.
57 *
58 * @note It uses printk to print the report.
59 */
60void rtems_stack_checker_report_usage( void );
61
62/**
63 * @brief Print the stack usage report using caller's routine.
64 *
65 * This method prints a stack usage report for the curently executing
66 * task.
67 *
68 * @param[in] context is the context to pass to the print handler
69 * @param[in] print is the print handler
70 *
71 * @note It uses the caller's routine to print the report.
72 */
73void rtems_stack_checker_report_usage_with_plugin(
74  const rtems_printer *printer
75);
76
77/*************************************************************
78 *************************************************************
79 **  Prototyped only so the user extension can be installed **
80 *************************************************************
81 *************************************************************/
82
83/**
84 * @brief Stack Checker Task Create Extension
85 *
86 * This method is the task create extension for the stack checker.
87 *
88 * @param[in] running points to the currently executing task
89 * @param[in] the_thread points to the newly created task
90 *
91 * @note If this this the first task created, the stack checker
92 *       will automatically intialize itself.
93 */
94bool rtems_stack_checker_create_extension(
95  Thread_Control *running,
96  Thread_Control *the_thread
97);
98
99/**
100 * @brief Stack Checker Task Context Switch Extension
101 *
102 * This method is the task context switch extension for the stack checker.
103 *
104 * @param[in] running points to the currently executing task which
105 *            is being context switched out
106 * @param[in] running points to the heir task which we are switching to
107 *
108 * @note This is called from the internal method _Thread_Dispatch.
109 */
110void rtems_stack_checker_switch_extension(
111  Thread_Control *running,
112  Thread_Control *heir
113);
114
115/**
116 *  @brief Stack Checker Extension Set Definition
117 *
118 *  This macro defines the user extension handler set for the stack
119 *  checker.  This macro is normally only used by confdefs.h.
120 */
121#define RTEMS_STACK_CHECKER_EXTENSION \
122{ \
123  rtems_stack_checker_create_extension,        /* rtems_task_create  */ \
124  0,                                           /* rtems_task_start   */ \
125  0,                                           /* rtems_task_restart */ \
126  0,                                           /* rtems_task_delete  */ \
127  rtems_stack_checker_switch_extension,        /* task_switch  */ \
128  0,                                           /* task_begin   */ \
129  0,                                           /* task_exitted */ \
130  0 /* rtems_stack_checker_fatal_extension */, /* fatal        */ \
131  0,                                           /* terminate    */ \
132}
133
134#ifdef __cplusplus
135}
136#endif
137/**@}*/
138#endif
139/* end of include file */
Note: See TracBrowser for help on using the repository browser.