202 (self canCreateOrToggleBreakpointAtLine:nil) ifFalse:[ |
202 (self canCreateOrToggleBreakpointAtLine:nil) ifFalse:[ |
203 ((topView := codeView topView) class == DebugView) ifTrue:[ |
203 ((topView := codeView topView) class == DebugView) ifTrue:[ |
204 self hasBreakpoints ifFalse:[ |
204 self hasBreakpoints ifFalse:[ |
205 ^ 'Sorry - cannot add breakpoint in the debugger (would need recompilation)\(can only add breakpoints if stopped at a method breakpoint)' withCRs |
205 ^ 'Sorry - cannot add breakpoint in the debugger (would need recompilation)\(can only add breakpoints if stopped at a method breakpoint)' withCRs |
206 ]. |
206 ]. |
207 ^ 'Click to toggle existing breakpoint. Shift-Click to toggle tracepoint.\Sorry - cannot add new breakpoint if method is already entered\(i.e. if not stopped at a method breakpoint).' withCRs |
207 ^ 'Sorry - cannot add new breakpoint if method is already entered\(i.e. if not stopped at a breakpoint).' withCRs |
208 ]. |
208 ]. |
209 ^ 'Cannot add breakpoint when modified. Please accept first.' |
209 ^ 'Cannot add breakpoint when modified. Please accept first.' |
210 ]. |
210 ]. |
211 |
211 |
212 ^ 'Click to toggle breakpoint. Shift-Click to toggle tracepoint.' |
212 ^ 'Click to toggle breakpoint. Shift-Click to toggle tracepoint.' |
445 ]. |
447 ]. |
446 (mClass := currentMethod mclass) isNil ifTrue:[ |
448 (mClass := currentMethod mclass) isNil ifTrue:[ |
447 "/ hack: ouch - was wrapped in the meantime; |
449 "/ hack: ouch - was wrapped in the meantime; |
448 "/ hurry up and update. Should be done elsewhere (in codeView) |
450 "/ hurry up and update. Should be done elsewhere (in codeView) |
449 self updateCurrentMethod. |
451 self updateCurrentMethod. |
450 mClass := currentMethod mclass. |
452 currentMethod notNil ifTrue:[ mClass := currentMethod mclass ]. |
451 ]. |
453 ]. |
452 mClass notNil ifTrue:[ |
454 mClass notNil ifTrue:[ |
453 Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:mClass changeSelector:currentMethod selector). |
455 Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:mClass changeSelector:currentMethod selector). |
454 ]. |
456 ]. |
455 ]. |
457 ]. |
462 ! ! |
464 ! ! |
463 |
465 |
464 !BreakpointService methodsFor:'queries'! |
466 !BreakpointService methodsFor:'queries'! |
465 |
467 |
466 canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere |
468 canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere |
|
469 "is it possible to place a breakpoint here and now?" |
|
470 |
467 |bpnt topView| |
471 |bpnt topView| |
468 |
472 |
469 textView reallyModified ifTrue:[ |
473 textView reallyModified ifTrue:[ |
|
474 "/ this is not really true - we could keep track of where the breakpoints |
|
475 "/ are while editing and shift them as required. |
|
476 "/ (another idea worth a try would be |
|
477 "/ to match the original parsetree (enumerating nodes with the breakpoints) |
|
478 "/ against the new parsetree (walking in sync?) when finally compiling, |
|
479 "/ and placing new breakpoints on matching tree nodes. |
|
480 "/ (too much work, for a quick solution, I guess) |
470 ^ false |
481 ^ false |
471 ]. |
482 ]. |
|
483 |
472 "/ can always toggle existing breakpoints... |
484 "/ can always toggle existing breakpoints... |
473 lineOrNilForAnywhere notNil ifTrue:[ |
485 lineOrNilForAnywhere notNil ifTrue:[ |
474 bpnt := self breakpointAtLine:lineOrNilForAnywhere. |
486 bpnt := self breakpointAtLine:lineOrNilForAnywhere. |
475 bpnt notNil ifTrue:[ |
487 bpnt notNil ifTrue:[ |
476 ^ true. |
488 ^ true. |
477 ] |
489 ] |
478 ]. |
490 ] ifFalse:[ |
479 |
491 (currentMethod notNil and:[currentMethod isMethodWithBreakpoints]) ifTrue:[ |
|
492 ^ true. |
|
493 ] |
|
494 ]. |
|
495 |
|
496 "/ ok, the method has no breakpoints yet. |
|
497 |
|
498 "/ this is a bad hack - looking into the debugger's state here. |
|
499 "/ I guess, we have to move code around a bit... |
480 ((topView := codeView topView) class == DebugView) ifTrue:[ |
500 ((topView := codeView topView) class == DebugView) ifTrue:[ |
481 "/ can only create new breakpoints in the debugger, |
501 "/ can only create new breakpoints in the debugger, |
482 "/ iff we are in a wrapped method's prolog |
502 "/ iff we are in a wrapped method's prolog |
483 topView selectedContextIsWrapped ifTrue:[ |
503 topView selectedContextIsWrapped ifTrue:[ |
484 topView selectedContext lineNumber == 1 ifTrue:[ |
504 topView selectedContext lineNumber == 1 ifTrue:[ |
485 ^ true |
505 ^ true |
486 ]. |
506 ]. |
487 ]. |
507 ]. |
|
508 |
|
509 "/ well, if the debugger's code has already been modified, |
|
510 "/ we will accept the new code anyway. So there's no problem in adding |
|
511 "/ a breakpoint on the fly... |
|
512 topView showingAlreadyModifiedCode ifTrue:[^ true]. |
488 ^ false. |
513 ^ false. |
489 ]. |
514 ]. |
|
515 |
|
516 "/ in a non-debugger, we can do it. |
490 ^ true. |
517 ^ true. |
491 ! |
518 ! |
492 |
519 |
493 hasBreakpoints |
520 hasBreakpoints |
494 ^ breakpoints notEmptyOrNil |
521 ^ breakpoints notEmptyOrNil |
546 ! ! |
573 ! ! |
547 |
574 |
548 !BreakpointService class methodsFor:'documentation'! |
575 !BreakpointService class methodsFor:'documentation'! |
549 |
576 |
550 version |
577 version |
551 ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' |
578 ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' |
552 ! |
579 ! |
553 |
580 |
554 version_CVS |
581 version_CVS |
555 ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' |
582 ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' |
556 ! |
583 ! |
557 |
584 |
558 version_SVN |
585 version_SVN |
559 ^ '$Id: Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' |
586 ^ '$Id: Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' |
560 ! ! |
587 ! ! |
561 |
588 |