Re: debugging user app crashes

2024-01-13 Thread Nathan Hartman
On Thu, Jan 11, 2024 at 10:35 AM Gregory Nutt wrote: > Everything you need to know is in that referenced wiki page: > > https://cwiki.apache.org/confluence/display/NUTTX/Debugging+ELF+Loadable+Modules > > I don't know anything about QEMU or RISC-V. But assuming that NSH is > your init applicatio

Re: debugging user app crashes

2024-01-11 Thread Gregory Nutt
Everything you need to know is in that referenced wiki page: https://cwiki.apache.org/confluence/display/NUTTX/Debugging+ELF+Loadable+Modules I don't know anything about QEMU or RISC-V.  But assuming that NSH is your init application... * NSH is not in memory when you start the OS; it reside

Re: debugging user app crashes

2024-01-09 Thread Gregory Nutt
On 1/9/2024 8:06 PM, yfliu2008 wrote: Yes, in kernel mode each user space program has similar but isolated virtual address spaces. So it seems that we can't set break points to them like FLAT or PROTECTED build. Not sure if we need some sort of debug agent in KERNEL build so that it can hel

Re: debugging user app crashes

2024-01-09 Thread Alan C. Assis
Yes! For kernel mode each program has its own main() implementation, not the definition. BR, Alan On Tue, Jan 9, 2024 at 10:34 PM Gregory Nutt wrote: > > On 1/9/2024 7:28 PM, Alan C. Assis wrote: > > Hi Yf, > > Just look at your System.map and you will see that all those main() > became > > _mai

Re: debugging user app crashes

2024-01-09 Thread Gregory Nutt
On 1/9/2024 7:28 PM, Alan C. Assis wrote: Hi Yf, Just look at your System.map and you will see that all those main() became _main. It isn't possible to have a unique main() symbol, otherwise we will have a duplicated symbol, also even if the compiler accepted that, how could NuttX know you want

Re: debugging user app crashes

2024-01-09 Thread Gregory Nutt
This is old and does not specifically address kernel mode, but I think most of the debug tips do apply in kernel mode too. The load address is a constant for kernel ELF modules so at least that part doesn't apply. But the rest probably does. On 1/9/2024 7:20 PM, yfliu2008 wrote: Alan, Than

Re: Re: debugging user app crashes

2024-01-09 Thread Alan C. Assis
Hi Yf, Just look at your System.map and you will see that all those main() became _main. It isn't possible to have a unique main() symbol, otherwise we will have a duplicated symbol, also even if the compiler accepted that, how could NuttX know you want to call the main from Hello instead of the m

Re: debugging user app crashes

2024-01-09 Thread Alan C. Assis
Hi Yf Liu, I don't know if this minidump server works on 64-bit and with QEMU, but about the other question how to setup breakpoint in the NSH user space program, just set the break point to the nsh_main if you want to debug the NSH itself or set it to program_main to put the breakpoint to some use