This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d24622888f arm64_backtrace: use running_task if arch_get_current_tcb 
return NULL
d24622888f is described below

commit d24622888f0d3d260c12b87c295102693681278c
Author: Bowen Wang <[email protected]>
AuthorDate: Tue Jul 4 23:11:49 2023 +0800

    arm64_backtrace: use running_task if arch_get_current_tcb return NULL
    
    In the init phase of the OS, arch_get_current_tcb return NULL. Enable
    the memory backatrace default will crash in backtrace function.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 arch/arm64/src/common/arm64_backtrace.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/src/common/arm64_backtrace.c 
b/arch/arm64/src/common/arm64_backtrace.c
index 5af4f6e472..489ef2c7f4 100644
--- a/arch/arm64/src/common/arm64_backtrace.c
+++ b/arch/arm64/src/common/arm64_backtrace.c
@@ -116,6 +116,11 @@ int up_backtrace(struct tcb_s *tcb,
   irqstate_t flags;
   int ret;
 
+  if (rtcb == NULL)
+    {
+      rtcb = running_task();
+    }
+
   if (size <= 0 || !buffer)
     {
       return 0;

Reply via email to