Breakpoints in UserMain

Topics for the Eclipse Environment
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Breakpoints in UserMain

Post 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
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Breakpoints in UserMain

Post 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.
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Breakpoints in UserMain

Post 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.
mhoyt
Posts: 9
Joined: Fri Feb 19, 2010 12:17 pm
Location: Blue Bell, Pennsylvania, USA
Contact:

Re: Breakpoints in UserMain

Post by mhoyt »

Try adding a short delay after the call to wait for gdb. I use OSTimeDly(1).

--Mike
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Breakpoints in UserMain

Post 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?
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Breakpoints in UserMain

Post 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).
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Breakpoints in UserMain

Post 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.
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Breakpoints in UserMain

Post 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.
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Breakpoints in UserMain

Post 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 :)
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Breakpoints in UserMain

Post 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(); ?
Post Reply