-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Kernel objects introspection symbols #59226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @carlocaione |
Ok, I'm a bit dull about this topic. What's preventing us to extend |
Nothing really, but Peter made this comment:
and this would probably not help his efforts, so I wanted to have a discussion first. |
tagging @andyross as well |
@trond-snekvik what is the status on this? |
No progress that I am aware of |
This is a continuation of the discussion in #56293.
Is your enhancement proposal related to a problem? Please describe.
PRs #54446, #56293 and related architecture specific PRs removes several offset symbols used by tooling to do introspection on the kernel state. Together with thread_info.c, symbols like these are used by debuggers and similar tools to:
To provide this information, the tools need to interpret the kernel objects by mapping the live memory data to corresponding fields. As the kernel objects' exact layout depends on the selected options and Zephyr version, the tools use the offset symbols, absolute symbols and information in the thread_info.c object to locate the various data in the memory.
There are several shortcomings in the current support for introspection based tooling:
CONFIG_MP_MAX_NUM_CPUS > 1
, as it's missing information about the size of the_cpu
struct.It's also worth mentioning that although tools like GDB clients can understand and parse C code to interpret the raw memory, tooling like the RTOS awareness plugins run in the GDB server, which does not expose an API for this. Even if the tooling has C language intelligence, the names of the kernel object fields are not necessarily considered part of the API either, and would be subject to abrupt change.
Describe the solution you'd like
For the various introspection mechanisms to work, the address of the following objects would need to be made available:
_kernel
_system_heap
_kernel_thread_info_offsets
Additionally, the offset and size of the following fields would need to be exposed:
_kernel_t::cpus
_cpu_t::current
sizeof(_cpu_t)
_cpu_t::usage0
_cpu_t::usage
_thread_t::base::usage
struct k_cycle_stats
struct k_heap::heap
struct sys_heap::heap
struct z_heap
_kernel_t::threads
_thread_t::next_thread
(available in thread_info.c)_thread_t::base::thread_state
(available in thread_info.c)_thread_t::base::user_options
_thread_t::base::prio
(available in thread_info.c)_thread_t::entry
(available in thread_info.c)_thread_t::name
(available in thread_info.c)_thread_t::stack_info
struct _thread_stack_info
Checked items are already available in kernel_offsets.
The format and naming of the generated information would need to be considered part of the API, and should not be changeable without a deprecation period. Not all these fields would be available in all configurations, but ideally, the symbols should be available for tooling whenever the corresponding fields exist in the kernel objects, and not just when
CONFIG_DEBUG
and its child options are enabled. The current implementation of kernel_offsets could support this use case without overhead on the target.Describe alternatives you've considered
The layout of the kernel objects that can't be changed by the configuration could be frozen, but this seems less flexible, and still doesn't solve the issue for configurable objects.
The output could be provided through some additional output file in a machine readable format, but this would not work for the RTOS awareness plugins passed to the runners in
west debug
, as they can't accept arguments, and don't have portable file access mechanisms.The text was updated successfully, but these errors were encountered: