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?

4
  • What do you mean by trace into the code-piece? Note, it should be self halt, not self: halt
    – alienhard
    Commented Mar 16, 2011 at 8: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
    Commented Mar 17, 2011 at 11:02
  • Hi @parsifal. Sorry, I still didn't get you... Is the question answered by my above comment?
    – alienhard
    Commented Mar 17, 2011 at 14:31
  • I have answered the questions, thanks:)
    – parsifal
    Commented Mar 18, 2011 at 6:30

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.