Re: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-24 Thread Peter Barada
Neo, Thanks for the explanation - I've modified my gdbstub to inspect xPSR and if STKALIGN is set then "unalign" the stack pointer. With this change I'm able to inspect threads and unwind callstacks from the captured Nuttx-12.6 crash dumps. I'll look at creating a patch to threads.py to hand

Re: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-24 Thread Xu Neo
Trying again with the screenshot in text of what's going on. > It happens that NuttX release 12.6.0 generates code that has SP not aligned to 4 bytes as shown below, right before triggering SVC. ``` │ 170 /* SVC with SYS_ call number and two parameters */ │ │ 171 │ │ 172 static inline uintptr_t

Re: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-24 Thread Xu Neo
It turns out the issue comes from the wrong SP register value getting restored by python script. TLDR, If you happen to met that GDB cannot unwind correctly, try set $sp=$sp+4 The issue is that when an exception happened, armv7-m could push 4 bytes to stack, to make sure SP is 8bytes aligned. Se

Re: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Peter Barada
) at common/arm_switchcontext.c:95/ /(gdb)/ *From:* Peter Barada *Sent:* Friday, January 24, 2025 9:22 AM *To:* Tomek CEDRO *Cc:* Nuttx-dev *Subject:* [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads [外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Andy Gao
Yep, The doc has already been updated. :-) On 1/24/25 12:05, Tomek CEDRO wrote: On Fri, Jan 24, 2025 at 5:00 AM Andy Gao wrote: The GDB plugin should work as you mentioned in you terminal output 🙂. But the way `source` the python plugin has changed as well. Looks like documentation for master

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Tomek CEDRO
On Fri, Jan 24, 2025 at 5:00 AM Andy Gao wrote: > The GDB plugin should work as you mentioned in you terminal output 🙂. > But the way `source` the python plugin has changed as well. Looks like documentation for master and NuttX 12.8 is okay and needs no update? https://nuttx.apache.org/docs/12.8

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Andy Gao
Hi Peter, I've just tested with the GDB python plugin shipped with 12.6.0 release. What I got seems like the same error what you've got: ``` (gdb) i threads Id   Thread Info Frame *0   Thread 0x20001688 (Name: Idle_Task, State: Running, Priority: 0, Stack: 1008)  0xab

Re: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread 徐兴良
9:22 AM To: Tomek CEDRO Cc: Nuttx-dev Subject: [External Mail]Re: GDB can't show QEMU ARM thread call stack/threads [外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给mi...@xiaomi.com进行反馈 On 1/23/25 19:20, Tomek CEDRO wrote: > Hey there Peter :-) > > Are you sure this is not a bug in gdb? >

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Tomek CEDRO
On Fri, Jan 24, 2025 at 2:23 AM Peter Barada wrote: > Looking further, I got the GDB command args wrong for version for 12.8 (12.8 > calls for gdbinit.py, not __init__.py), here's updated 12.8 output (which > allows looking at threads and nsh_main callstack, but generates warnings on > start):

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Peter Barada
On 1/23/25 19:20, Tomek CEDRO wrote: Hey there Peter :-) Are you sure this is not a bug in gdb? If not, then this is called thread aware debug and probably gdb changed some api or invocation parameters if that still works in older versions. Maybe simple update to tools/gdb/__init__.py will do

Re: GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Tomek CEDRO
Hey there Peter :-) Are you sure this is not a bug in gdb? If not, then this is called thread aware debug and probably gdb changed some api or invocation parameters if that still works in older versions. Maybe simple update to tools/gdb/__init__.py will do the job? -- CeDeROM, SQ7MHZ, http://ww

GDB can't show QEMU ARM thread call stack/threads

2025-01-23 Thread Peter Barada
I'm coming up to speed in Nuttx over the past few months, and I've run into an issue where gdb can't show the call stack for a thread in version 12.6.0, but can in version 12.5.1 (and can't show threads in version 12.8.0): I followed the instructions at https://nuttx.apache.org/docs/12.6.0/gu