Breakpoints in UserMain

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

Re: Breakpoints in UserMain

Post by sblair »

I'm on Day 2 here so still got a lot to learn ;)

I'm using InitializeNetworkGDB_and_Wait();

Is that what is recommended?
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Breakpoints in UserMain

Post by rnixon »

Yes, most of the time. The "no wait" version will just let your code run freely until you stop it.
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Breakpoints in UserMain

Post by tod »

You might also find it beneficial during development to put in long delays after the call to AutoUpdate. That way if you decide to run code you haven't unit tested (subtle hint) and it crashes the system you have a better chance of being able to do an update over Ethernet instead of having to drop back to MTTY and the serial loader.
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: Breakpoints in UserMain

Post by rnixon »

Great idea. I've also used a getchar() so it blocks until I hit a key, that way I can update if I need to if my code is crashing right away.
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Breakpoints in UserMain

Post by pbreed »

>I've also used a getchar() so it blocks until I hit a key, that way I can update if I need to if my code is crashing right away.

I use that all the time. Whenever I'm developing something crashy this is the first thing that goes in the code.
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Breakpoints in UserMain

Post by sblair »

NOW I have that case where I need it to break at the top of UserMain()! I'm implementing Auto-IP and want to set some breakpoints to debug, but obviously can't as my code is at the very top of UserMain at the GetDHCPAddress() call.

Oh well, I can get around it...just being able to break at the top when it loads would be nice tho!

Scott
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Breakpoints in UserMain

Post by pbreed »

You can work around that.
The network debugger has the ability to set it to a different static IP address than the configed address.

See the definitions in

#include <networkDebug.h>

You want to define/use two macros.. above user main.

DebugIP(AsciiToIp("10.1.1.123")); //Change to the desired IP
DebugNormalArp();

This will give the debuger a fixed, but differnt IP address.
It will also have the normal ARP code process ARP requests rahter than having them shortcircuited in the debuger.
Post Reply