debug: coredump: dump privileged stack
This adds the bits to call into architecture code to dump the privileged stack for user threads. The weak implementation is simply there as a stub until all architectures have implemented the associated function. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
f5163d8940
commit
4f52860fe0
3 changed files with 28 additions and 0 deletions
|
@ -679,6 +679,9 @@ config ARCH_SUPPORTS_COREDUMP
|
|||
config ARCH_SUPPORTS_COREDUMP_THREADS
|
||||
bool
|
||||
|
||||
config ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
|
||||
bool
|
||||
|
||||
config ARCH_SUPPORTS_ARCH_HW_INIT
|
||||
bool
|
||||
|
||||
|
|
|
@ -107,4 +107,15 @@ config DEBUG_COREDUMP_THREADS_METADATA
|
|||
Core dump will contain the threads metadata section containing
|
||||
any necessary data to enable debugging threads
|
||||
|
||||
config DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK
|
||||
bool "Dump privilege stack of user threads"
|
||||
default y
|
||||
depends on ARCH_SUPPORTS_COREDUMP_PRIV_STACKS
|
||||
depends on USERSPACE
|
||||
help
|
||||
Dump the privilege stack of user threads.
|
||||
|
||||
Say n to conserve space on coredump backend or if you will never
|
||||
need to look into the privilege stacks.
|
||||
|
||||
endif # DEBUG_COREDUMP
|
||||
|
|
|
@ -37,6 +37,14 @@ static struct coredump_backend_api
|
|||
#define DT_DRV_COMPAT zephyr_coredump
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK)
|
||||
__weak void arch_coredump_priv_stack_dump(struct k_thread *thread)
|
||||
{
|
||||
/* Stub if architecture has not implemented this. */
|
||||
ARG_UNUSED(thread);
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK */
|
||||
|
||||
static void dump_header(unsigned int reason)
|
||||
{
|
||||
struct coredump_hdr_t hdr = {
|
||||
|
@ -81,6 +89,12 @@ static void dump_thread(struct k_thread *thread)
|
|||
end_addr = thread->stack_info.start + thread->stack_info.size;
|
||||
|
||||
coredump_memory_dump(thread->stack_info.start, end_addr);
|
||||
|
||||
#if defined(CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK)
|
||||
if ((thread->base.user_options & K_USER) == K_USER) {
|
||||
arch_coredump_priv_stack_dump(thread);
|
||||
}
|
||||
#endif /* CONFIG_DEBUG_COREDUMP_DUMP_THREAD_PRIV_STACK */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue