[newbie question] critical sections

Bob Arning arning at charm.net
Wed Jul 14 15:22:12 UTC 1999


On Wed, 14 Jul 1999 12:00:44 +0100 "Peter Novak" <pno at whitestein.com> wrote: 
>sometimes I need to have a breakpoint in some critical section of code. For
>example in method at: ifAbsent: in SystemDictionary (Dictionary), or in some
>method in class Class (like is scopehas: ifTrue:). I think that it's clear
>that it's a madness to do something like this, because every time I tried to
>evaluate something (anything), the system crashed, or went into the
>unuseable state.

One of the keys to debugging critical sections of code is to make the change as non-intrusive as possible. Halting or writing to the Transcript can create recursive error conditions that are hard to get out of. Some ideas: 1) have the debugging code be very selective about when it happens (just once, e.g. or only when certain peculiar conditions exist), 2) have it do something simple like add an element to an OrderedCollection instead of halting and 3) be prepared for things to crash - file out the pertinent code just before you make the last connection so you don't have to reinvent everything the next time.

>I need it, because sometimes I need to know what *exactly* is the system
>doing (it's necessary to know why something functions somehow).
>
>And I have another question. How is possible to recompile class
>SystemDictionary (exactly if I want to add method at: ifAbsent: to class
>SystemDictionary) ??? It is little bit dangerous to make such things, but I
>need it.

Adding a method does not cause the class to be recompiled. Adding an instance _variable_ does.

>So I think that you, old smalltalkers, have maybe some methods to go around
>these problems. Can someone give me an advice??? Or in another form: How can
>I safely rewrite some of kernel classes of Smalltalk???
>

A more specific example would help here (privately, perhaps, given the current level of discussion on the list).

Cheers,
Bob





More information about the Squeak-dev mailing list