469,576 Members | 1,663 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

Debugging a server-client app

Greetings,

I am debugging client-server single threaded code and would like to
hear some suggestions regarding being able to make debugger to detect a
certain condition and from that point to allow step by step debugging.
The reason for that is because I need to see what is arriving at a
certain packet, not necessary the first one.
In fact, I was thinking to start server in debugging mode to wait for a
trap, where I'll put a bookmark (location to stop a debugger at), and
run the client, which will send packets. I am not sure how to do that.
Is it possible? Are there any other suggestions?

Currently, I am using Eclipse for C on Linux.

Thank you

Apr 23 '06 #1
3 1967
bobrics a écrit :
Greetings,

I am debugging client-server single threaded code and would like to
hear some suggestions regarding being able to make debugger to detect a
certain condition and from that point to allow step by step debugging.
The reason for that is because I need to see what is arriving at a
certain packet, not necessary the first one.
In fact, I was thinking to start server in debugging mode to wait for a
trap, where I'll put a bookmark (location to stop a debugger at), and
run the client, which will send packets. I am not sure how to do that.
Is it possible? Are there any other suggestions?

Currently, I am using Eclipse for C on Linux.

Thank you


If your debugger is not sophisticated to handle conditional breakpoints
just add a line to your application (in the critical problem section)
void CallDebugger(void);

if (condition) {
CallDebugger();
}
Now, CallDebugger() could be some system specific code to attach the
debugger to your application or, if you run in an x86 system just

void CallDebugger(void)
{
_asm("int $3");
}

This will call the debugger in all linux x86 systems.
Apr 23 '06 #2
bobrics wrote:

I am debugging client-server single threaded code and would like
to hear some suggestions regarding being able to make debugger to
detect a certain condition and from that point to allow step by
step debugging. The reason for that is because I need to see what
is arriving at a certain packet, not necessary the first one. In
fact, I was thinking to start server in debugging mode to wait for
a trap, where I'll put a bookmark (location to stop a debugger
at), and run the client, which will send packets. I am not sure
how to do that. Is it possible? Are there any other suggestions?

Currently, I am using Eclipse for C on Linux.


This is off-topic for c.l.c. Which means, among other things, that
any answers you get are very likely to be meaningless blather from
people who cannot stay on topic, and who will certainly not get
corrected as to facts. Look for a newsgroup with 'thread' in its
name, or one that deals with your particular system.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 23 '06 #3
On 2006-04-23, bobrics <bo*****@gmail.com> wrote:
Greetings,

I am debugging client-server single threaded code and would like to
hear some suggestions regarding being able to make debugger to detect a
certain condition and from that point to allow step by step debugging.
The reason for that is because I need to see what is arriving at a
certain packet, not necessary the first one.
In fact, I was thinking to start server in debugging mode to wait for a
trap, where I'll put a bookmark (location to stop a debugger at), and
run the client, which will send packets. I am not sure how to do that.
Is it possible? Are there any other suggestions?

Currently, I am using Eclipse for C on Linux.

Thank you


Most debuggers have conditional breakpoints : since you dont mention
your platform I can't really confirm this : but most debuggers
understand (in C environment) C conditions to force the break
point. Failing that you can add a line to your code (assuming you have
ability to check it out and compile locally which I assume you do)
where you can set the breakpoint : although be very careful that the
"if" statement is bugfree : adding "debug" code can and frequently
does affect the application being debugged - see

http://heather.cs.ucdavis.edu/~matlo...tml#tth_sEc3.1

It discusses why using debug specific code is not a good idea, but
often it is convenient and certainly has its place in small systems
where its easy to add/remove/compile small code bases:

eg.

if (myBreakCondition(a,b,c,d)){
logBreakCondition("Here!"); /* set breakpoint here */
}

Using printfs on their own without a breakpoint has its place but is
limited and requires recompilations and code removal as well as
possibly causing heisenbugs : in addition, they tell you nothing at
all about the call stack which might have contributed to the break condition.

Good luck!
Apr 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Steve Wark | last post: by
5 posts views Thread by Don Hans | last post: by
5 posts views Thread by Bruce Schechter | last post: by
2 posts views Thread by Andy Fish | last post: by
5 posts views Thread by Velvet | last post: by
3 posts views Thread by =?Utf-8?B?SmVmZnJleQ==?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.