Page 1 of 2
Breakpoints in UserMain
Posted: Mon Sep 12, 2011 2:01 pm
by sblair
I'm just getting started with the NBEclipse and the Netburner products here, but I'm running into a bit of an issue with getting breakpoints to work in the debugger.
I've tried creating a new project and using the MOD5270 FactoryDemo project. In both cases I can add iprintf() statements to UserMain, complile and see that they are working. But I can never hit any breakpoints I set in UserMain at all though. I have been able to set breakpoints in the WebLeds() in Webfuncs.cpp and those work. I've also tried setting the Debug configuration to 'stop on startup at:' both UserMain and main and that never seems to work either.
Help?
Thanks.
Scott
Re: Breakpoints in UserMain
Posted: Mon Sep 12, 2011 5:01 pm
by tod
Have you watched the
Debug Demo screencast on the Wiki? You can also get to it
directly on youtube. I find most screencasts easier to watch on YouTub because you can increase the resolution and make it full screen. In the screencast not the statement used in the code to get the debugger to start and wait.
Re: Breakpoints in UserMain
Posted: Mon Sep 12, 2011 5:55 pm
by sblair
I hadn't seen the video before, but it didn't address the issues.
I figured out earlier the issue with hitting the breakpoints was that my breakpoints were all too soon after Network GDB was enabled. Once I gave it a bit more time after that call, then they started working.
I still have not solved the issue of why the 'stop at startup at:' set to Main or UserMain doesn't work in the debug settings.
Re: Breakpoints in UserMain
Posted: Mon Sep 12, 2011 6:05 pm
by mhoyt
Try adding a short delay after the call to wait for gdb. I use OSTimeDly(1).
--Mike
Re: Breakpoints in UserMain
Posted: Mon Sep 12, 2011 6:16 pm
by sblair
mhoyt wrote:Try adding a short delay after the call to wait for gdb. I use OSTimeDly(1).
--Mike
Mike, that is what I did and it solved the issue. Is there any way to be able to set it to break on startup though? So you can stop at the top of Main or UserMain?
Re: Breakpoints in UserMain
Posted: Tue Sep 13, 2011 11:14 am
by rnixon
I don't think you can break at the start of main for any network debugger. The reason is you need a functioning stack, and in my normal case, a dhcp address (you could use static, but I usually don't).
Re: Breakpoints in UserMain
Posted: Tue Sep 13, 2011 11:52 am
by sblair
I was worried this might be the case. I was hoping there was some hook or logic that allowed it to stop there though...or at least at the top of UserMain.
I'm used to always being able to debug from the top of Main in embedded systems, so this is a bit different experience for me.
Re: Breakpoints in UserMain
Posted: Tue Sep 13, 2011 12:08 pm
by rnixon
Maybe if you can describe why you need to break at the top of usermain we can recommend something else. There should be nothing there but system calls, which I wouldn't think you have to debug. I usually only need to debug where my application starts. In addition, network startup stuff, like dhcp if you use it, will timeout if you set breakpoints because the outside world keeps moving on.
Re: Breakpoints in UserMain
Posted: Tue Sep 13, 2011 12:16 pm
by sblair
I understand. My main reason for trying to get a break there on startup was that I was having other issues with breakpoints yesterday. It's not that I have a burning need to do it at this point, it's more of what I'm just accustomed to doing. I'll just have to try and adjust to living in a new world here
Re: Breakpoints in UserMain
Posted: Tue Sep 13, 2011 12:41 pm
by rnixon
Its not so bad when you get used to it, and best of all no external h/w is needed for the debugger to work. Are you using InitializeNetworkGDB_and_Wait(); as the startup call, or InitializeNetworkGDB(); ?