yuening1999 commented on issue #9645:
URL: https://github.com/apache/nuttx/issues/9645#issuecomment-2437394207

   > Hi @acassis I followed the previous advice and enabled the debug 
configuration. After tracing, I discovered the issue causing my ELF file to 
fail loading. It was because I used global variables in my code, and the 
compilation options lacked "-fno-common". Later, when I used GDB to debug the 
ELF file "myapp_elf", I found that in most cases, breakpoints couldn't be 
triggered, and the "step" command couldn't enter function internals. However, 
I'm not sure if it's a problem with GDB or the compiled ELF file itself. The 
compilation options I used were "-Os" and "-g". I also tried the "-O0" and "-g" 
options, but if I compile the ELF with the "-O0" option, it results in an error 
when loading the ELF. Is there a complete method for debugging ELF files using 
GDB?
   
   Hi, [xiaotailang](https://github.com/xiaotailang), Do you resolve the 
trouble?
   
   I also met the similar problem, when gdb debugging my app, I found the logic 
of my app is not correct.  Local variable for "for loop"on my app is error 
value and random.
   meanwhile, breakpoint and "s" command both work fine.  But I download my app 
to file system on board, my app run normally.
   
   I also want to know correct method to debug external elf program.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to