0

Hey, friends, Squeak is powerful, I knows that the Debugger in squeak played a central role, now I wanner to set a breakpoint in squeak code, should be self: halt, My problem is that how can I quickly trace into the code-piece where I set an breakpoint?

parsifal
  • 879
  • 4
  • 12
  • 21
  • What do you mean by *trace into the code-piece*? Note, it should be `self halt`, not `self: halt` – alienhard Mar 16 '11 at 08:10
  • Exactly self halt. I means if I doubt some piece of code have bugs, and have not designed by contract( no keyword assert in code),then I set some breakpoint in the specific code pieces where may raise error. – parsifal Mar 17 '11 at 11:02
  • Hi @parsifal. Sorry, I still didn't get you... Is the question answered by my above comment? – alienhard Mar 17 '11 at 14:31
  • I have answered the questions, thanks:) – parsifal Mar 18 '11 at 06:30

1 Answers1

0

Answered by myself :)

Assume we have a suffix method add to String, and it is not a buggy method!

1  suffix
2  "assumes that I'm a file name, and answers my suffix, the part after the last dot"
3    | dot dotPosition |
4   dot := FileDirectory dot asCharacter.
5   dotPosition := (self size to: 1 by: -1) detect: [ :i | (self at: i) = dot ].
6   self halt.
7   ^ self copyFrom: dotPosition to: self size

notice the line 7 self halt added . we can also just edit the suspect code by inserting self halt.

When we run this method, the execution of the self halt will bring up the pre-debugger, from where we can proceed, or go into the debugger and look at variables, step the computation, and edit the code.

parsifal
  • 879
  • 4
  • 12
  • 21