On 30.11.2009 22:06, Schwab,Wilhelm K wrote:
(2) Debugging drawing code is probably best done using a single-shot
breakpoint. I _think_ I have seen something about halt once in
Pharo. FWIW, somebody posted a class called Once that creates such a
feature that looks like
Once do:[
"do anything here, but this is common:"
self halt.
].
Somewhere you need to do Once reset or something (it's obvious from
the code) to enable the breakpoint. Once evaluates the block one
time, and then won't evaluate the block again until told to do so. If
there is a need for this in Pharo, I should be able to "port" it -
IIRC, it was licensed for public consumption.
It exists already, is called haltOnce, and is used in the same manner as
halt. To arm it, evaluate Object setHaltOnce. Make sure to remove them
when you finish debugging though, since the overhead is non-negligible.
------------------------------------------------------------------------
*From:* [email protected]
[mailto:[email protected]] *On Behalf Of
*Simon Denier
*Sent:* Monday, November 30, 2009 2:18 PM
*To:* Pharo Development
*Cc:* Simon Denier
*Subject:* [Pharo-project] Is there something wrong in debugging in
the Morphic thread?
Now can somebody with some Morphic knowledge explain how this is
supposed to work and how to deal with such issues?
--
Simon
This is rather primitive approach, but here's one way I've handled it in
the past:
1. Read the debug.log
2.Handle the error by returning false (in that they may not be correct
for the state), but valid values.
3.Insert a haltOnce which fires if the error condition arrises.
4.Trigger the error condition.
5. optional: Copy all instvars used in the method into temps if you're
able to proceed with no error, then redo 3 and 4. (when the debugger
opens, the object may no longer be in a state trigger the error condition).
You should now have a responsibe debugger (due to step 2&3), and access
to the parameter values that make it fail (step4). It's not much, and
there are probably much better ways to go about it, but at least it's a
start for debugging the problem.
Good luck,
Henry
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project