DebugView.st
changeset 935 7c75379de9ec
parent 934 1931a6f4b1cf
child 936 34f8d67c4932
equal deleted inserted replaced
934:1931a6f4b1cf 935:7c75379de9ec
   125             ].
   125             ].
   126             c := c sender
   126             c := c sender
   127         ].
   127         ].
   128 
   128 
   129         found ifFalse:[
   129         found ifFalse:[
   130             ('DEBUGGER: reentered with: ', aString) errorPrintNL.
   130             ('DebugView [warning]: reentered with: ', aString) errorPrintCR.
   131             ^ MiniDebugger enterWithMessage:'DEBUGGER: recursive error'.
   131             ^ MiniDebugger enterWithMessage:'DEBUGGER: recursive error'.
   132         ]
   132         ]
   133     ].
   133     ].
   134 
   134 
   135     "
   135     "
   152         ]
   152         ]
   153     ].
   153     ].
   154 
   154 
   155     ^ self enterUnconditional:aContext withMessage:aString
   155     ^ self enterUnconditional:aContext withMessage:aString
   156 
   156 
   157     "Modified: 4.10.1996 / 10:21:20 / cg"
   157     "Modified: 10.1.1997 / 17:35:34 / cg"
   158 !
   158 !
   159 
   159 
   160 enterUnconditional:aContext withMessage:aString
   160 enterUnconditional:aContext withMessage:aString
   161     "enter a debugger - do not check for recursive invocation"
   161     "enter a debugger - do not check for recursive invocation"
   162 
   162 
   662             self cacheMyself.
   662             self cacheMyself.
   663             "
   663             "
   664              have to catch errors occuring in unwind-blocks
   664              have to catch errors occuring in unwind-blocks
   665             "
   665             "
   666             ErrorSignal handle:[:ex |
   666             ErrorSignal handle:[:ex |
   667                 'ignored error while unwinding: ' errorPrint.
   667                 'DebugView [info]: ignored error while unwinding: ' infoPrint.
   668                 ex errorString errorPrintNL.
   668                 ex errorString infoPrintCR.
       
   669 
   669                 ex proceed
   670                 ex proceed
   670             ] do:[
   671             ] do:[
   671                 Object abortSignal raise.
   672                 Object abortSignal raise.
   672             ].
   673             ].
   673             'abort failed' errorPrintNL
   674             'DebugView [warning]: abort failed' errorPrintCR
   674         ].
   675         ].
   675 
   676 
   676         (exitAction == #return) ifTrue:[
   677         (exitAction == #return) ifTrue:[
   677             selectedContext notNil ifTrue:[
   678             selectedContext notNil ifTrue:[
   678                 "
   679                 "
   683 "/ and that is syntactically incorrect ...
   684 "/ and that is syntactically incorrect ...
   684 "/ ... leading to a popup warning from the codeView
   685 "/ ... leading to a popup warning from the codeView
   685 "/
   686 "/
   686 "/                codeView hasSelection ifTrue:[
   687 "/                codeView hasSelection ifTrue:[
   687 "/                    Object errorSignal handle:[:ex |
   688 "/                    Object errorSignal handle:[:ex |
   688 "/                        'DEBUGGER: error - returning nil' printNL.
   689 "/                        'DebugView [warning]: error - returning nil' errorPrintCR.
   689 "/                        retval := nil.
   690 "/                        retval := nil.
   690 "/                        ex return
   691 "/                        ex return
   691 "/                    ] do:[
   692 "/                    ] do:[
   692 "/                        |s|
   693 "/                        |s|
   693 "/
   694 "/
   700                 self cacheMyself.
   701                 self cacheMyself.
   701                 "
   702                 "
   702                  have to catch errors occuring in unwind-blocks
   703                  have to catch errors occuring in unwind-blocks
   703                 "
   704                 "
   704                 Object errorSignal handle:[:ex |
   705                 Object errorSignal handle:[:ex |
   705                     'ignored error while unwinding: ' errorPrint.
   706                     'DebugView [info]: ignored error while unwinding: ' errorPrint.
   706                     ex errorString errorPrintNL.
   707                     ex errorString errorPrintCR.
   707                     ex proceed
   708                     ex proceed
   708                 ] do:[
   709                 ] do:[
   709                     con unwind:retval.
   710                     con unwind:retval.
   710                 ].
   711                 ].
   711                 'cannot return from selected context' errorPrintNL
   712                 'DebugView [warning]: cannot return from selected context' errorPrintCR
   712             ]
   713             ]
   713         ].
   714         ].
   714 
   715 
   715         (exitAction == #restart) ifTrue:[
   716         (exitAction == #restart) ifTrue:[
   716             selectedContext notNil ifTrue:[
   717             selectedContext notNil ifTrue:[
   718                 self cacheMyself.
   719                 self cacheMyself.
   719                 "
   720                 "
   720                  have to catch errors occuring in unwind-blocks
   721                  have to catch errors occuring in unwind-blocks
   721                 "
   722                 "
   722                 Object errorSignal handle:[:ex |
   723                 Object errorSignal handle:[:ex |
   723                     'ignored error while unwinding: ' errorPrint.
   724                     'DebugView [info]: ignored error while unwinding: ' infoPrint.
   724                     ex errorString errorPrintNL.
   725                     ex errorString infoPrintCR.
   725                     ex proceed
   726                     ex proceed
   726                 ] do:[
   727                 ] do:[
   727                     con unwindAndRestart.
   728                     con unwindAndRestart.
   728                 ].
   729                 ].
   729                 'cannot restart selected context' errorPrintNL
   730                 'DebugView [warning]: cannot restart selected context' errorPrintCR
   730             ]
   731             ]
   731         ].
   732         ].
   732 
   733 
   733         (exitAction == #quickTerminate) ifTrue:[
   734         (exitAction == #quickTerminate) ifTrue:[
   734             self cacheMyself.
   735             self cacheMyself.
   739             self cacheMyself.
   740             self cacheMyself.
   740             "
   741             "
   741              have to catch errors occuring in unwind-blocks
   742              have to catch errors occuring in unwind-blocks
   742             "
   743             "
   743             Object errorSignal handle:[:ex |
   744             Object errorSignal handle:[:ex |
   744                 'ignored error while unwinding: ' errorPrint.
   745                 'DebugView [info]: ignored error while unwinding: ' infoPrint.
   745                 ex errorString errorPrintNL.
   746                 ex errorString infoPrintCR.
   746                 ex proceed
   747                 ex proceed
   747             ] do:[
   748             ] do:[
   748                 Processor activeProcess terminate.
   749                 Processor activeProcess terminate.
   749             ].
   750             ].
   750             'cannot terminate process' errorPrintNL
   751             'DebugView [warning]: cannot terminate process' errorPrintCR
   751         ]
   752         ]
   752     ].
   753     ].
   753 
   754 
   754     selectedContext := actualContext := nil.
   755     selectedContext := actualContext := nil.
   755 
   756 
   844         self cacheMyself.
   845         self cacheMyself.
   845     ]
   846     ]
   846 
   847 
   847     "Created: 24.11.1995 / 19:52:54 / cg"
   848     "Created: 24.11.1995 / 19:52:54 / cg"
   848     "Modified: 3.5.1996 / 23:58:16 / stefan"
   849     "Modified: 3.5.1996 / 23:58:16 / stefan"
   849     "Modified: 7.1.1997 / 21:27:28 / cg"
   850     "Modified: 10.1.1997 / 17:41:58 / cg"
   850 !
   851 !
   851 
   852 
   852 openOn:aProcess
   853 openOn:aProcess
   853     "enter the debugger on a process - 
   854     "enter the debugger on a process - 
   854      in this case, we are just inspecting the context chain of the process,
   855      in this case, we are just inspecting the context chain of the process,
  1327 "/        self enter:thisContext sender.
  1328 "/        self enter:thisContext sender.
  1328 "/        ^ self
  1329 "/        ^ self
  1329 "/    ].
  1330 "/    ].
  1330 
  1331 
  1331     Processor activeProcess ~~ inspectedProcess ifTrue:[
  1332     Processor activeProcess ~~ inspectedProcess ifTrue:[
  1332         'stray step interrupt' errorPrintNL.
  1333         'DebugView [info]: stray step interrupt' infoPrintCR.
  1333         ^ self
  1334         ^ self
  1334     ].
  1335     ].
  1335 
  1336 
  1336     here := thisContext.        "stepInterrupt"
  1337     here := thisContext.        "stepInterrupt"
  1337     here := here sender.        "the caller; step- or contextIRQ"  
  1338     here := here sender.        "the caller; step- or contextIRQ"  
  1728 "/'enter' printCR.
  1729 "/'enter' printCR.
  1729 
  1730 
  1730     self enter:thisContext sender sender
  1731     self enter:thisContext sender sender
  1731 
  1732 
  1732     "Created: 14.10.1996 / 12:53:39 / cg"
  1733     "Created: 14.10.1996 / 12:53:39 / cg"
  1733     "Modified: 23.10.1996 / 19:11:27 / cg"
  1734     "Modified: 10.1.1997 / 17:43:29 / cg"
  1734 ! !
  1735 ! !
  1735 
  1736 
  1736 !DebugView methodsFor:'menu / button actions'!
  1737 !DebugView methodsFor:'menu / button actions'!
  1737 
  1738 
  1738 autoUpdateOff
  1739 autoUpdateOff
  1856     catchBlock notNil ifTrue:[
  1857     catchBlock notNil ifTrue:[
  1857         abortButton turnOff.
  1858         abortButton turnOff.
  1858         catchBlock value.
  1859         catchBlock value.
  1859 
  1860 
  1860         "/ not reached
  1861         "/ not reached
  1861         'DEBUGGER: oops, abort failed' errorPrintNL.
  1862         'DebugView [warning]: abort failed' errorPrintCR.
  1862     ].
  1863     ].
  1863 
  1864 
  1864     ^ self.
  1865     ^ self.
  1865 
  1866 
  1866     "Modified: 22.10.1996 / 11:59:21 / cg"
  1867     "Modified: 10.1.1997 / 17:38:28 / cg"
  1867 !
  1868 !
  1868 
  1869 
  1869 doContinue
  1870 doContinue
  1870     "continue from menu"
  1871     "continue from menu"
  1871 
  1872 
  1888 
  1889 
  1889         "exit private event-loop"
  1890         "exit private event-loop"
  1890         catchBlock notNil ifTrue:[catchBlock value].
  1891         catchBlock notNil ifTrue:[catchBlock value].
  1891 
  1892 
  1892         "/ not reached.
  1893         "/ not reached.
  1893         'DEBUGGER: oops, continue failed' errorPrintNL.
  1894         'DebugView [warning]: continue failed' errorPrintCR.
  1894         continueButton turnOff.
  1895         continueButton turnOff.
  1895 
  1896 
  1896     ] ifFalse:[
  1897     ] ifFalse:[
  1897         inspecting ifFalse:[
  1898         inspecting ifFalse:[
  1898             'resuming top context' errorPrintNL.
  1899             'DebugView [info]: resuming top context' infoPrintCR.
  1899             self showSelection:1.
  1900             self showSelection:1.
  1900             self doReturn
  1901             self doReturn
  1901         ]
  1902         ]
  1902     ]
  1903     ]
  1903 
  1904 
  1904     "Modified: 22.10.1996 / 11:59:24 / cg"
  1905     "Modified: 10.1.1997 / 17:38:34 / cg"
  1905 !
  1906 !
  1906 
  1907 
  1907 doNext
  1908 doNext
  1908     "skip for next source-code line"
  1909     "skip for next source-code line"
  1909 
  1910 
  1937 
  1938 
  1938     "exit private event-loop"
  1939     "exit private event-loop"
  1939     catchBlock notNil ifTrue:[catchBlock value].
  1940     catchBlock notNil ifTrue:[catchBlock value].
  1940 
  1941 
  1941     "/ not reached
  1942     "/ not reached
  1942     'DEBUGGER: oops, restart failed' errorPrintNL.
  1943     'DebugView [warning]: restart failed' errorPrintCR.
  1943     restartButton turnOff.
  1944     restartButton turnOff.
  1944 
  1945 
  1945     "Modified: 22.10.1996 / 11:59:28 / cg"
  1946     "Modified: 10.1.1997 / 17:38:36 / cg"
  1946 !
  1947 !
  1947 
  1948 
  1948 doReturn
  1949 doReturn
  1949     "return - the selected context will do a ^nil"
  1950     "return - the selected context will do a ^nil"
  1950 
  1951 
  1962 
  1963 
  1963     "exit private event-loop"
  1964     "exit private event-loop"
  1964     catchBlock notNil ifTrue:[catchBlock value].
  1965     catchBlock notNil ifTrue:[catchBlock value].
  1965 
  1966 
  1966     "/ not reached
  1967     "/ not reached
  1967     'DEBUGGER: oops, return failed' errorPrintNL.
  1968     'DebugView [warning]: return failed' errorPrintCR.
  1968     returnButton turnOff.
  1969     returnButton turnOff.
  1969 
  1970 
  1970     "Modified: 22.10.1996 / 11:59:31 / cg"
  1971     "Modified: 10.1.1997 / 17:38:39 / cg"
  1971 !
  1972 !
  1972 
  1973 
  1973 doSend
  1974 doSend
  1974     "single send; reenter with next message send"
  1975     "single send; reenter with next message send"
  1975 
  1976 
  1982 
  1983 
  1983         "exit private event-loop"
  1984         "exit private event-loop"
  1984         catchBlock notNil ifTrue:[catchBlock value].
  1985         catchBlock notNil ifTrue:[catchBlock value].
  1985 
  1986 
  1986         "/ not reached
  1987         "/ not reached
  1987         'DEBUGGER: oops, send failed' errorPrintNL.
  1988         'DebugView [warning]: send failed' errorPrintCR.
  1988         sendButton turnOff.
  1989         sendButton turnOff.
  1989     ]
  1990     ]
  1990 
  1991 
  1991     "Modified: 22.10.1996 / 11:59:33 / cg"
  1992     "Modified: 10.1.1997 / 17:38:41 / cg"
  1992 !
  1993 !
  1993 
  1994 
  1994 doStep
  1995 doStep
  1995     "skip for next send in selected method"
  1996     "skip for next send in selected method"
  1996 
  1997 
  2050 
  2051 
  2051         "exit private event-loop"
  2052         "exit private event-loop"
  2052         catchBlock notNil ifTrue:[catchBlock value].
  2053         catchBlock notNil ifTrue:[catchBlock value].
  2053 
  2054 
  2054         "/ not reached
  2055         "/ not reached
  2055         'DEBUGGER: oops, step failed' errorPrintNL.
  2056         'DebugView [warning]: step failed' errorPrintCR.
  2056         stepButton turnOff.
  2057         stepButton turnOff. nextButton turnOff. sendButton turnOff.
  2057         nextButton turnOff.
       
  2058         sendButton turnOff.
       
  2059     ]
  2058     ]
  2060 
  2059 
  2061     "Modified: 22.10.1996 / 15:49:40 / cg"
  2060     "Modified: 10.1.1997 / 17:38:48 / cg"
  2062 !
  2061 !
  2063 
  2062 
  2064 doStop
  2063 doStop
  2065     "stop the process (if its running, otherwise this is a no-op)"
  2064     "stop the process (if its running, otherwise this is a no-op)"
  2066 
  2065 
  2094     "exit private event-loop"
  2093     "exit private event-loop"
  2095     catchBlock notNil ifTrue:[catchBlock value].
  2094     catchBlock notNil ifTrue:[catchBlock value].
  2096 
  2095 
  2097     "/ not reached (normally)
  2096     "/ not reached (normally)
  2098     inspecting ifFalse:[
  2097     inspecting ifFalse:[
  2099         'DEBUGGER: oops, terminate failed' errorPrintNL.
  2098         'DebugView [warning]: terminate failed' errorPrintCR.
  2100         self warn:'terminate failed'.
  2099         self warn:'terminate failed'.
  2101     ].
  2100     ].
  2102     terminateButton turnOff.
  2101     terminateButton turnOff.
  2103 
  2102 
  2104     "Modified: 22.10.1996 / 11:59:45 / cg"
  2103     "Modified: 10.1.1997 / 17:38:22 / cg"
  2105 !
  2104 !
  2106 
  2105 
  2107 doTrace
  2106 doTrace
  2108     "tracing - not really implemented ..."
  2107     "tracing - not really implemented ..."
  2109 
  2108 
  2182     "exit private event-loop"
  2181     "exit private event-loop"
  2183     catchBlock notNil ifTrue:[catchBlock value].
  2182     catchBlock notNil ifTrue:[catchBlock value].
  2184 
  2183 
  2185     "/ not reached (normally)
  2184     "/ not reached (normally)
  2186     inspecting ifFalse:[
  2185     inspecting ifFalse:[
  2187         'DEBUGGER: oops, terminate failed' errorPrintNL.
  2186         'DebugView [warning]: terminate failed' errorPrintCR.
  2188         self warn:'terminate failed'.
  2187         self warn:'terminate failed'.
  2189     ].
  2188     ].
  2190     terminateButton turnOff.
  2189     terminateButton turnOff.
  2191 
  2190 
  2192     "Modified: 22.10.1996 / 11:59:49 / cg"
  2191     "Modified: 10.1.1997 / 17:42:10 / cg"
  2193 !
  2192 !
  2194 
  2193 
  2195 removeAllBreakpoints
  2194 removeAllBreakpoints
  2196     "remove all trace & breakpoints - if any"
  2195     "remove all trace & breakpoints - if any"
  2197 
  2196 
  2590             DebuggingDebugger ~~ true ifTrue:[
  2589             DebuggingDebugger ~~ true ifTrue:[
  2591                 "/
  2590                 "/
  2592                 "/ ignore recursive breakpoints
  2591                 "/ ignore recursive breakpoints
  2593                 "/
  2592                 "/
  2594                 signal == MessageTracer breakpointSignal ifTrue:[
  2593                 signal == MessageTracer breakpointSignal ifTrue:[
  2595                     'breakpoint in debugger ignored' errorPrintNL.
  2594                     'DebugView [info]: breakpoint in debugger ignored' infoPrintCR.
  2596                     ex proceed
  2595                     ex proceed
  2597                 ].
  2596                 ].
  2598                 (signal == ActivityNotificationSignal) ifTrue:[
  2597                 (signal == ActivityNotificationSignal) ifTrue:[
  2599                     ex proceed
  2598                     ex proceed
  2600                 ].
  2599                 ].
  2601                 signal == Exception recursiveExceptionSignal ifTrue:[
  2600                 signal == Exception recursiveExceptionSignal ifTrue:[
  2602                     ex parameter signal == MessageTracer breakpointSignal ifTrue:[
  2601                     ex parameter signal == MessageTracer breakpointSignal ifTrue:[
  2603                         'recursive breakpoint in debugger ignored' errorPrintNL.
  2602                         'DebugView [info]: recursive breakpoint in debugger ignored' infoPrintCR.
  2604                         ex proceed.
  2603                         ex proceed.
  2605                     ].
  2604                     ].
  2606 
  2605 
  2607                     self showError:'*** Recursive error in debugger:
  2606                     self showError:'*** Recursive error in debugger:
  2608 
  2607 
  2637         ].
  2636         ].
  2638     ].
  2637     ].
  2639     catchBlock := nil.
  2638     catchBlock := nil.
  2640 
  2639 
  2641     "Created: 24.11.1995 / 20:33:45 / cg"
  2640     "Created: 24.11.1995 / 20:33:45 / cg"
  2642     "Modified: 23.10.1996 / 16:34:59 / cg"
  2641     "Modified: 10.1.1997 / 17:36:17 / cg"
  2643 ! !
  2642 ! !
  2644 
  2643 
  2645 !DebugView methodsFor:'user interaction'!
  2644 !DebugView methodsFor:'user interaction'!
  2646 
  2645 
  2647 codeAccept:someCode
  2646 codeAccept:someCode
  3041 ! !
  3040 ! !
  3042 
  3041 
  3043 !DebugView class methodsFor:'documentation'!
  3042 !DebugView class methodsFor:'documentation'!
  3044 
  3043 
  3045 version
  3044 version
  3046     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.121 1997-01-10 15:15:50 cg Exp $'
  3045     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.122 1997-01-10 18:05:11 cg Exp $'
  3047 ! !
  3046 ! !