Commit graph

32 commits

Author SHA1 Message Date
Joakim Andersson 27ef15b8f5 debug: thread_analyzer: Implement thread analyzer
Thread analyzer is simple module that helps in printing thread
information, like stacks usage statistics.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Signed-off-by: Bartosz Gentkowski <bartosz.gentkowski@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-28 09:11:13 -04:00
Andrew Boie 7cb8f5c61e include: debug: remove old stack functions
These were unsafe.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Krzysztof Chruscinski 547d623c37 debug: stack: Add missing log_strdup
Log call was missing log_strdup wrap around thread name which
is a string in RAM.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-02-11 12:55:02 -08:00
Andrew Boie efc5fe07a2 kernel: overhaul unused stack measurement
The existing stack_analyze APIs had some problems:

1. Not properly namespaced
2. Accepted the stack object as a parameter, yet the stack object
   does not contain the necessary information to get the associated
   buffer region, the thread object is needed for this
3. Caused a crash on certain platforms that do not allow inspection
   of unused stack space for the currently running thread
4. No user mode access
5. Separately passed in thread name

We deprecate these functions and add a new API
k_thread_stack_space_get() which addresses all of these issues.

A helper API log_stack_usage() also added which resembles
STACK_ANALYZE() in functionality.

Fixes: #17852

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-08 10:02:35 +02:00
Anas Nashif 73008b427c tracing: move headers under include/tracing
Move tracing.h to include/tracing/ to align with subsystem reorg.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Wentong Wu 4f4b8ef4ea tracing: add TRACING_TEST Kconfig option
Add Kconfig option TRACING_TEST which can be used to
customize tracing packet format (currently supporting
string format and data format) for testing purpose.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-02-05 23:54:26 -05:00
Wentong Wu 8ccc04de6a tracing: add infrastructure for collection of tracing data
First, this commit adds user interface in tracing_format.h which
can trace both string format and data format packet.

Second, it adds method both for asynchronous and synchronous way.
For asynchronous method, tracing packet will be buffered in tracing
buffer first, tracing thread will output the stream data with the
help of tracing backend when tracing thread get scheduled.

Third, it adds UART and USB tracing backend for asynchronous
tracing method, and adds POSIX tracing backend for synchronous
tracing way.

Also it can receive command from host to dynamically enable and
disable tracing to have host capture tracing data conveniently.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-02-05 23:54:26 -05:00
Nicholas Lowell 797174350d debug: tracing: Remove unneeded prototypes
The initial prototypes for sys_trace_* are not needed
because they are either declared in the specified tracing header
or as empty #defines further in the header.

These actually cause linkage conflicts if CTF tracing is attempted
with C++ projects.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2020-02-01 08:06:28 -05:00
Shih-Wei Teng 5ebceeb8cb object tracing: Fix the issue that objects lost from trace list
Add a flag for identifing whether this object is on the trace
list. Ensure that link any object to the trace list only one time.
It will avoid the issue about lost object caused by adding a
object to trace list twice.

Fixes #19537

Signed-off-by: Shih-Wei Teng <swteng@andestech.com>
2019-11-14 09:13:56 -05:00
Mrinal Sen 1246cb8cef debug: tracing: Remove unneeded abstraction
Various C and Assembly modules
make function calls to z_sys_trace_*. These merely call
corresponding functions sys_trace_*. This commit
is to simplify these by making direct function calls
to the sys_trace_* functions from these modules.
Subsequently, the z_sys_trace_* functions are removed.

Signed-off-by: Mrinal Sen <msen@oticon.com>
2019-09-26 06:26:22 -04:00
Nicholas Lowell 5b322d9331 debug: tracing: add sys_trace_thread_name_set
Initial thread creation and tracing information
occurs with empty thread names.  For better tracing information,
we need to a way to get actual thread names if they are set
in order to better track thread names and their IDs.

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2019-09-19 00:37:35 -04:00
Anas Nashif d53c87a3ca doc: tracing: include API docs into documentation
Group tracing documentation in header file and include them into
documentation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-17 04:44:42 +08:00
Andrew Boie 89430b33e9 include: gcov: fix compilation error
These empty functions needed to be declared static inline
or we get build errors if the header is included by more
than one C file.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-07-03 07:19:49 -07:00
Anas Nashif 8f1780f6de docs: make doxygen happy with new locations
Change @file entry on some headers due to duplicated files in the
include/ tree (real header + shim).
Adapt the doxygen configuration file to the new locations and remove
directories which are already included.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif efb8df5366 cleanup: include/: move misc/stack.h to debug/stack.h
move misc/stack.h to debug/stack.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif fa1c60014b cleanup: include/: move misc/gcov.h to debug/gcov.h
move misc/gcov.h to debug/gcov.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 10291a0789 cleanup: include/: move tracing.h to debug/tracing.h
move tracing.h to debug/tracing.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 858c00bd6b include: remove unused header file gdb_server.h
A leftover header file from the past.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-01-22 07:45:22 -05:00
Peter A. Bigot bfad9721d2 kernel: remove k_alert API
This API was used in only one place in non-test code.  See whether we
can remove it.

Closes #12232

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-01-16 21:34:07 -05:00
Flavio Ceolin 6fdc56d286 kernel: Using boolean types for boolean constants
Make boolean expressions use boolean types.

MISRA-C rule 14.4

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-28 06:28:41 +05:30
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Spoorthi K 300b060ee1 obj_tracing: Declare object trace list for queue
Trace list is required to obtain the queue objects
created and parse the list to get
the object count.

Signed-off-by: Spoorthi K <spoorthi.k@intel.com>
2018-07-27 07:51:26 -04:00
Anas Nashif 11a9625eaf debug: remove DEBUG_INFO option
This feature is X86 only and is not used or being tested. It is legacy
feature and no one can prove it actually works. Remove it until we have
proper documentation and samples and multi architecture support.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-12 13:58:28 -08:00
Anas Nashif 89c1ab6b18 ring_buffer: remove broken object_tracing support
The library has incomplete tracing support. Given that we are not a true
kernel object, remove support instead of fixing it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-18 17:44:38 -05:00
Andrew Boie 5305f36d4f object_tracing: fix definition
This is a header file, the definition for _trace_list_sys_ring_buf
needs to be 'extern' otherwise multiple instances of this variable
could be instantiated, leading to linker errors.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andrew Boie 0f669132a0 kernel: remove gdb_server
This is unmaintained and currently has no known users. It was
added to support a Wind River project. If in the future we need it
again, we should re-introduce it with an exception-based mechanism
for catching out-of-bounds memory queries from the debugger.

The mem_safe subsystem is also removed, it is only used by the
GDB server. If its functionality is needed in the future, it
shoudl be replaced with an exception-based mechanism.

The _image_{ram, rom, text}_{start, end} linker variables have
been left in place, they will be re-purposed and expanded to
support memory protection.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-19 14:29:40 -04:00
Anas Nashif 919b3f0878 kconfig: fixed Kconfig name in comments
Change-Id: Ia22e9df4b9d836635aef1d4b59efec8ce58815d6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-10 16:07:09 +00:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif ea8c6aad24 kernel: remove last nanokernel ocrrurances from include/
Jira: ZEP-1323
Change-Id: I32e2dc33406a74c2e592bb2df215bd9170bf286d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
Anas Nashif 2f203c2f92 tracing: rename CONFIG_DEBUG_TRACING_KERNEL_OBJECTS
Use a short name for this option CONFIG_OBJECT_TRACING.

Change-Id: Id27de7ef9ca299492b6b7d2324d9f5bcf8059a31
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 14:59:35 -05:00
Anas Nashif aa2154772a object_tracing: fixed style
Change-Id: I0881bead44b935e432559225e4f5f5b7051f1469
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:41 +00:00
Anas Nashif 569f0b4105 debug: move debug features from misc to subsys/debug
Change-Id: I446be0202325cf3cead7ce3024ca2047e3f7660d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:40 +00:00