delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/10/04:15:12

Date: Wed, 10 Dec 1997 11:13:50 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Calvin French <frenchc AT cadvision DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: RHIDE Debugging Idea...
In-Reply-To: <348d87d3.0@news.cadvision.com>
Message-ID: <Pine.SUN.3.91.971210111331.10111D-100000@is>
MIME-Version: 1.0

On 9 Dec 1997, Calvin French wrote:

> if( key[ KEY_SPACE ] )
> {
>    int a = 0;
> };
> 
> And that's all. Then what I do, is set a breakpoint on the line, int a = 0. 
> Then, I can run my program until a peculiar behavior occurs, at which point
> I can just press space, and then debug effectively.

It is not entirely clear to me how does this work for you, perhaps
because I don't know enough about Allegro.  As far as I understand,
when you press SPACE, the program is stopped at the above line.  What
I don't understand is how does this let you ``debug effectively''.
There's nothing in that code that ensures you can look at any place
that is not directly related to that line.  The trouble that you want
to debug might happen elsewhere, and there's no simple means of
getting to the trouble spot, or even knowing where it is.  (Yes, I
know about frame-related commands in the debugger, but I still don't
see how that will help you know where the problem occured.)

Can you please clarify?  Without understanding that it is hard to give
you good advice.

Also, if you compile with optimizations, the optimizer has every right
to optimize that snippet out of existence.

> So what I really want to know is if there is an interrupt or something
> else I can pull to cause RHIDE to behave as if it just hit a breakpoint.

Isn't signals what you are after?  For example, you could put a signal
handler for SIGINT into your code, and then whenever you hit Ctrl-BREAK, 
you should land in your handler.  I even think the debugger should do
that already (i.e., if you press Ctrl-BREAK, the debugger gets
control), doesn't it?

But I still don't get how will this make debugging easier.
Interrupting a runaway program is one thing, but understanding where
and why did it go awry is quite another.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019