67 |active con sender| |
67 |active con sender| |
68 |
68 |
69 StepInterruptPending := nil. |
69 StepInterruptPending := nil. |
70 |
70 |
71 Error handle:[:ex | |
71 Error handle:[:ex | |
72 ex return |
72 ex return |
73 ] do:[ |
73 ] do:[ |
74 thisContext isRecursive ifTrue:[ |
74 thisContext isRecursive ifTrue:[ |
75 "/ 'recursive error in debugger ignored' errorPrintCR. |
75 "/ 'recursive error in debugger ignored' errorPrintCR. |
76 ^ self |
76 ^ self |
77 ]. |
77 ]. |
78 aString printCR. |
78 |
79 Processor notNil ifTrue:[ |
79 aString printCR. |
80 active := Processor activeProcess. |
80 Processor notNil ifTrue:[ |
81 'process: id=' print. active id print. |
81 active := Processor activeProcess. |
82 ' name=' print. active name printCR. |
82 'process: id=' print. active id print. |
83 |
83 ' name=' print. active name printCR. |
84 'context: ' print. aContext printString printCR. |
84 |
85 (con := aContext) notNil ifTrue:[ |
85 'context: ' print. aContext printString printCR. |
86 con := con sender. |
86 (con := aContext) notNil ifTrue:[ |
87 ' ......: ' print. con printString printCR. |
87 con := con sender. |
88 [con notNil] whileTrue:[ |
88 ' ......: ' print. con printString printCR. |
89 sender := con sender. |
89 [con notNil] whileTrue:[ |
90 (sender notNil and:[sender selector == con selector]) ifTrue:[ |
90 sender := con sender. |
91 ' ......: ' print. sender printString printCR. |
91 (sender notNil and:[sender selector == con selector]) ifTrue:[ |
92 ' ......: [** intermediate recursive contexts skipped **]' printCR. |
92 ' ......: ' print. sender printString printCR. |
93 [sender notNil |
93 ' ......: [** intermediate recursive contexts skipped **]' printCR. |
94 and:[sender selector == con selector |
94 [sender notNil |
95 and:[sender method == con method]]] whileTrue:[ |
95 and:[sender selector == con selector |
96 con := sender. |
96 and:[sender method == con method]]] whileTrue:[ |
97 sender := con sender. |
97 con := sender. |
98 ]. |
98 sender := con sender. |
99 ]. |
99 ]. |
100 con := sender. |
100 ]. |
101 ' ......: ' print. con printString printCR. |
101 con := sender. |
102 ] |
102 ' ......: ' print. con printString printCR. |
103 ] |
103 ] |
104 ]. |
104 ] |
|
105 ]. |
|
106 NotFirstTimeEntered ~~ true ifTrue:[ |
|
107 NotFirstTimeEntered := true. |
|
108 'Type "c" to proceed, "?" for help' printCR. |
|
109 ]. |
105 ]. |
110 ]. |
106 |
111 |
107 OperatingSystem hasConsole ifFalse:[ |
112 OperatingSystem hasConsole ifFalse:[ |
108 Error handle:[:ex | |
113 Error handle:[:ex | |
109 ex return |
114 ex return |
110 ] do:[ |
115 ] do:[ |
111 self warn:('Unexpected error:\' , aString , '\\No MiniDebugger functionality available') withCRs . |
116 self warn:('Unexpected error:\' , aString , '\\No MiniDebugger functionality available') withCRs . |
112 ]. |
117 ]. |
113 |
118 |
114 Error handle:[:ex | |
119 Error handle:[:ex | |
115 'cannot raise Abort - exiting ...' errorPrintCR. |
120 'cannot raise Abort - exiting ...' errorPrintCR. |
116 Smalltalk exit. |
121 Smalltalk exit. |
117 ] do:[ |
122 ] do:[ |
118 AbortOperationRequest raise. |
123 AbortOperationRequest raise. |
119 ] |
124 ] |
120 ] ifTrue:[ |
125 ] ifTrue:[ |
121 self new enter:aContext mayProceed:mayProceed. |
126 self new enter:aContext mayProceed:mayProceed. |
122 ]. |
127 ]. |
123 mayProceed ifFalse:[ |
128 mayProceed ifFalse:[ |
124 AbortOperationRequest raise |
129 AbortOperationRequest raise |
125 ]. |
130 ]. |
126 ^ nil |
131 ^ nil |
127 |
132 |
128 "Modified: / 19.5.1999 / 18:14:33 / cg" |
133 "Modified: / 19.5.1999 / 18:14:33 / cg" |
129 ! |
134 ! |
849 ] |
874 ] |
850 ] |
875 ] |
851 ! |
876 ! |
852 |
877 |
853 showProcesses |
878 showProcesses |
|
879 self showProcesses:#all |
|
880 ! |
|
881 |
|
882 showProcesses:how |
854 |active| |
883 |active| |
855 |
884 |
856 active := Processor activeProcess. |
885 active := Processor activeProcess. |
857 'current id=' print. active id print. ' name=''' print. active name print. '''' printCR. |
886 'current id=' print. active id print. ' name=''' print. active name print. '''' printCR. |
858 |
887 |
859 Process allSubInstancesDo:[:p | |
888 Process allSubInstancesDo:[:p | |
860 'proc id=' print. (p id printStringPaddedTo:5) print. |
889 |doShow| |
861 (p state printStringPaddedTo:10) print. |
890 |
862 ' pri=' print. (p priority printStringPaddedTo:2) print. |
891 doShow := (how == #all). |
863 ' creator:' print. (p creatorId printStringPaddedTo:5) print. |
892 doShow := doShow or:[ (how == #dead) and:[ p isDead ]]. |
864 ' name=''' print. p name print. |
893 doShow := doShow or:[ (how ~~ #dead) and:[ p isDead not ]]. |
865 '''' printCR. |
894 doShow ifTrue:[ |
|
895 'proc id=' print. (p id printStringPaddedTo:5) print. |
|
896 (p state printStringPaddedTo:10) print. |
|
897 ' pri=' print. (p priority printStringPaddedTo:2) print. |
|
898 ' creator:' print. (p creatorId printStringPaddedTo:5) print. |
|
899 ' name=''' print. p name print. |
|
900 '''' printCR. |
|
901 ] |
866 ] |
902 ] |
867 |
903 |
868 "Modified: / 31.7.1998 / 16:30:19 / cg" |
904 "Modified: / 31.7.1998 / 16:30:19 / cg" |
869 ! |
905 ! |
870 |
906 |
871 showValidCommandHelp |
907 showValidCommandHelp |
872 'valid commands: |
908 'valid commands: |
873 c ..... continue |
909 c ...... continue |
874 s ..... step |
910 s ...... step |
875 t ..... trace (continue with trace) |
911 t ...... trace (continue with trace) |
876 a [id]. abort (i.e. raise abort signal) in (current) process |
912 a [id] abort (i.e. raise abort signal) in (current) process |
877 T [id]. terminate (current) process |
913 T [id] terminate (current) process |
878 W [id]. stop (current) process |
914 W [id] stop (current) process |
879 R [id]. resume (current) process |
915 R [id] resume (current) process |
880 Q [id]. quick terminate (current) process - no unwinds or cleanup |
916 Q [id] quick terminate (current) process - no unwinds or cleanup |
881 |
917 |
882 P ..... list processes |
918 p ...... list processes ("P" for full list) |
883 w [id]. walkback (of process with id) |
919 w [id] walkback (of process with id) |
884 b [id]. full (VM) backtrace (more detail) |
920 b [id] full (VM) backtrace (more detail) |
885 B ..... backtrace of all other processes |
921 B ...... backtrace of all other processes |
886 |
922 |
887 U ..... unwrap all traced/breakpointed methods |
923 U ...... unwrap all traced/breakpointed methods |
888 g ..... collect all garbage |
924 h [-/+] disable/enable halts |
889 g 2.... collect all garbage & reclaim symbols |
925 g ...... collect all garbage |
890 g 3.... collect all garbage, reclaim symbols and compress |
926 g 2 .... collect all garbage & reclaim symbols |
891 |
927 g 3 .... collect all garbage, reclaim symbols and compress |
892 S ..... save snapshot into crash.img |
928 |
893 x ..... exit Smalltalk |
929 S ...... save snapshot into crash.img |
894 X ..... exit Smalltalk (+core dump) |
930 x ...... exit Smalltalk ("X" to exit with core dump) |
895 |
931 |
896 . ..... print dot (the current context) |
932 . ...... print dot (the current context) |
897 - ..... move dot up (sender) |
933 - ...... move dot up (sender) |
898 + ..... move dot down (called context) |
934 + ...... move dot down (called context) |
899 l ..... list method source around dot''s |
935 l ...... list dot''s method source around PC ("L" for full list) |
900 L ..... list dot''s method source code |
936 |
901 |
937 r ...... receiver (in dot) printString |
902 r ..... receiver (in dot) printString |
938 i ...... inspect receiver (in dot) |
903 i ..... inspect receiver (in dot) |
939 I ...... interpreter (expression evaluator) |
904 I ..... interpreter (expression evaluator) |
940 e expr evaluate expression |
905 e expr evaluate expression |
941 ' errorPrintCR. |
906 |
942 |
907 To repair a broken X-Connection, enter an interpreter and evaluate: |
943 (XWorkstation notNil and:[ Screen default isKindOf:XWorkstation ]) ifTrue:[ |
|
944 ' To repair a broken X-Connection, enter an interpreter (enter "I") and evaluate: |
908 Display := XWorkstation new. |
945 Display := XWorkstation new. |
909 Display initializeFor:''hostName:0''. |
946 Display initializeFor:''localhost:0''. |
910 Display startDispatch. |
947 Display startDispatch. |
911 NewLauncher openOnDevice:Display. |
948 NewLauncher openOnDevice:Display. |
912 <empty line> |
949 <empty line> |
913 then enter ''c'' to continue; a NewLauncher should pop up soon. |
950 then enter "c" to continue; a NewLauncher should pop up soon. |
914 |
|
915 ' errorPrintCR |
951 ' errorPrintCR |
|
952 ] |
916 ! ! |
953 ! ! |
917 |
954 |
918 !MiniDebugger class methodsFor:'documentation'! |
955 !MiniDebugger class methodsFor:'documentation'! |
919 |
956 |
920 version |
957 version |
921 ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.80 2013-02-01 14:47:44 cg Exp $' |
958 ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.82 2013-02-23 11:14:32 cg Exp $' |
922 ! |
959 ! |
923 |
960 |
924 version_CVS |
961 version_CVS |
925 ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.80 2013-02-01 14:47:44 cg Exp $' |
962 ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.82 2013-02-23 11:14:32 cg Exp $' |
926 ! ! |
963 ! ! |
927 |
964 |