DebugView.st
changeset 789 a9595b71a8fa
parent 788 26d452e40e52
child 790 6a166894d5e1
equal deleted inserted replaced
788:26d452e40e52 789:a9595b71a8fa
   696         self cacheMyself.
   696         self cacheMyself.
   697     ]
   697     ]
   698 
   698 
   699     "Created: 24.11.1995 / 19:52:54 / cg"
   699     "Created: 24.11.1995 / 19:52:54 / cg"
   700     "Modified: 3.5.1996 / 23:58:16 / stefan"
   700     "Modified: 3.5.1996 / 23:58:16 / stefan"
   701     "Modified: 21.10.1996 / 13:45:43 / cg"
   701     "Modified: 22.10.1996 / 15:06:23 / cg"
   702 !
   702 !
   703 
   703 
   704 openOn:aProcess
   704 openOn:aProcess
   705     "enter the debugger on a process - 
   705     "enter the debugger on a process - 
   706      in this case, we are just inspecting the context chain of the process,
   706      in this case, we are just inspecting the context chain of the process,
  1157 stepOrNext
  1157 stepOrNext
  1158     |where here s isWrap method lastWrappedConAddr wrappedMethod 
  1158     |where here s isWrap method lastWrappedConAddr wrappedMethod 
  1159      inBlock left ignore contextBelow lastWrappedContext
  1159      inBlock left ignore contextBelow lastWrappedContext
  1160      leftWrap enteredWrap|
  1160      leftWrap enteredWrap|
  1161 
  1161 
       
  1162     "/ DebuggingDebugger := true
       
  1163 
  1162     skipLineNr == #return ifTrue:[
  1164     skipLineNr == #return ifTrue:[
  1163         name := Processor activeProcess nameOrId.
  1165         name := Processor activeProcess nameOrId.
  1164         self label:('context returned ' , ' (process: ' , name , ')').
  1166         self label:('context returned ' , ' (process: ' , name , ')').
  1165         here := thisContext sender sender.
  1167         here := thisContext sender sender.
  1166         here setLineNumber:nil.
  1168         here setLineNumber:nil.
  1221                             isWrap := true.
  1223                             isWrap := true.
  1222                         ]
  1224                         ]
  1223                     ] ifFalse:[
  1225                     ] ifFalse:[
  1224                         where == steppedContext ifTrue:[
  1226                         where == steppedContext ifTrue:[
  1225 
  1227 
  1226                             DebuggingDebugger ifTrue:[
  1228                             DebuggingDebugger == true ifTrue:[
  1227                                 'change stepCon from: ' print.
  1229                                 'change stepCon from: ' print.
  1228                                 steppedContext print.
  1230                                 steppedContext print.
  1229                                 ' to lastWrapped: ' print.
  1231                                 ' to lastWrapped: ' print.
  1230                                 lastWrappedContext printNL.
  1232                                 lastWrappedContext printNL.
  1231                             ].
  1233                             ].
  1252         "/
  1254         "/
  1253         where := nil. here := nil.
  1255         where := nil. here := nil.
  1254         ObjectMemory flushInlineCaches.
  1256         ObjectMemory flushInlineCaches.
  1255         
  1257         
  1256         skipLineNr == #return ifTrue:[
  1258         skipLineNr == #return ifTrue:[
  1257             DebuggingDebugger ifTrue:[
  1259             DebuggingDebugger == true ifTrue:[
  1258                 'skipRet in wrap' printCR.
  1260                 'skipRet in wrap' printCR.
  1259             ]
  1261             ]
  1260         ].
  1262         ].
  1261 
  1263 
  1262         StepInterruptPending := 1.
  1264         StepInterruptPending := 1.
  1326                              chain. We seem to be still below the interesting one ...
  1328                              chain. We seem to be still below the interesting one ...
  1327                             "
  1329                             "
  1328                             tracing == true ifTrue:[
  1330                             tracing == true ifTrue:[
  1329                                 here printString printCR
  1331                                 here printString printCR
  1330                             ].
  1332                             ].
  1331                             where := nil. here := nil.
       
  1332                             "
  1333                             "
  1333                               yes, a context below
  1334                               yes, a context below
  1334                               - continue and schedule another stepInterrupt.
  1335                               - continue and schedule another stepInterrupt.
  1335                               Must flush caches since optimized methods not always
  1336                               Must flush caches since optimized methods not always
  1336                               look for pending interrupts
  1337                               look for pending interrupts
  1359                                     'in stepCon; continue single stepping' printCR.
  1360                                     'in stepCon; continue single stepping' printCR.
  1360                                 ].
  1361                                 ].
  1361                                 StepInterruptPending := 1.
  1362                                 StepInterruptPending := 1.
  1362                                 InterruptPending := 1.
  1363                                 InterruptPending := 1.
  1363                             ].
  1364                             ].
       
  1365                             where := nil. here := nil.
  1364                             InStepInterrupt := nil.
  1366                             InStepInterrupt := nil.
  1365 
  1367 
  1366                             ^ nil
  1368                             ^ nil
  1367                         ].
  1369                         ].
  1368 
  1370 
  1371                         ].
  1373                         ].
  1372 
  1374 
  1373                         contextBelow := where.
  1375                         contextBelow := where.
  1374                         where := where sender
  1376                         where := where sender
  1375                     ].
  1377                     ].
  1376                     s := 'left stepped method'.
  1378                     s := 'left stepped context'.
  1377                     left := true.
  1379                     left := true.
  1378                 ].
  1380                 ].
  1379             ] ifTrue:[
  1381             ] ifTrue:[
  1380 "/ 'found it right in sender' printNL.
  1382 "/ 'found it right in sender' printNL.
  1381                 s := 'after step'
  1383                 s := 'after step'
  1387     ] ifFalse:[
  1389     ] ifFalse:[
  1388 "/ ' send' printNL.
  1390 "/ ' send' printNL.
  1389         "
  1391         "
  1390          a send
  1392          a send
  1391         "
  1393         "
  1392         DebuggingDebugger ifTrue:[
  1394         DebuggingDebugger == true ifTrue:[
  1393             'clear steppedContext' printCR.
  1395             'clear steppedContext' printCR.
  1394         ].
  1396         ].
  1395         steppedContext := nil.
  1397         steppedContext := nil.
  1396         s := 'after send'
  1398         s := 'after send'
  1397     ].
  1399     ].
  1416                 where notNil ifTrue:[
  1418                 where notNil ifTrue:[
  1417                     where isBlockContext ifFalse:[
  1419                     where isBlockContext ifFalse:[
  1418                         method := where method.
  1420                         method := where method.
  1419                         (method notNil and:[method isWrapped]) ifTrue:[
  1421                         (method notNil and:[method isWrapped]) ifTrue:[
  1420                             where == wrapperContext ifTrue:[
  1422                             where == wrapperContext ifTrue:[
  1421                                 DebuggingDebugger ifTrue:[
  1423                                 DebuggingDebugger == true ifTrue:[
  1422                                     'change stepCon fromWrapped: ' print.
  1424                                     'change stepCon fromWrapped: ' print.
  1423                                     steppedContext print.
  1425                                     steppedContext print.
  1424                                     ' to: ' print.
  1426                                     ' to: ' print.
  1425                                     wrapperContext printNL.
  1427                                     wrapperContext printNL.
  1426                                 ].
  1428                                 ].
  1468             '[' print. where lineNumber print. ']' printNL.
  1470             '[' print. where lineNumber print. ']' printNL.
  1469         ].
  1471         ].
  1470     ].
  1472     ].
  1471 
  1473 
  1472     ignore ifFalse:[
  1474     ignore ifFalse:[
  1473 
       
  1474         (bigStep 
  1475         (bigStep 
  1475         and:[steppedContextLineno notNil 
  1476         and:[steppedContextLineno notNil 
  1476         and:[where notNil 
  1477         and:[where notNil 
  1477         and:[where lineNumber == steppedContextLineno]]]) ifTrue:[
  1478         and:[where lineNumber == steppedContextLineno]]]) ifTrue:[
  1478             DebuggingDebugger == true ifTrue:[
  1479             (here isBlockContext 
  1479                 'same line - ignored' printNL.
  1480             and:[(here methodHome == steppedContext)
  1480             ].
  1481                  or:[here home == steppedContext]]) ifTrue:[
  1481             ignore := true
  1482                 DebuggingDebugger == true ifTrue:[
       
  1483                     'same line but in block' printNL.
       
  1484                 ].
       
  1485 
       
  1486                 steppedContext := actualContext := here.
       
  1487                 steppedContextLineno := here lineNumber.
       
  1488             ] ifFalse:[    
       
  1489                 DebuggingDebugger == true ifTrue:[
       
  1490                     'same line - ignored' printNL.
       
  1491                 ].
       
  1492                 ignore := true
       
  1493             ].
  1482         ].
  1494         ].
  1483 
  1495 
  1484         (left not 
  1496         (left not 
  1485         and:[skipLineNr notNil 
  1497         and:[skipLineNr notNil 
  1486         and:[where notNil
  1498         and:[where notNil
  1530 "/'enter' printCR.
  1542 "/'enter' printCR.
  1531 
  1543 
  1532     self enter:thisContext sender sender
  1544     self enter:thisContext sender sender
  1533 
  1545 
  1534     "Created: 14.10.1996 / 12:53:39 / cg"
  1546     "Created: 14.10.1996 / 12:53:39 / cg"
  1535     "Modified: 22.10.1996 / 12:54:33 / cg"
  1547     "Modified: 22.10.1996 / 15:06:59 / cg"
  1536 ! !
  1548 ! !
  1537 
  1549 
  1538 !DebugView methodsFor:'menu / button actions'!
  1550 !DebugView methodsFor:'menu / button actions'!
  1539 
  1551 
  1540 autoUpdateOff
  1552 autoUpdateOff
  1809 
  1821 
  1810     inspecting ifTrue:[^ self].
  1822     inspecting ifTrue:[^ self].
  1811 
  1823 
  1812     canContinue ifTrue:[
  1824     canContinue ifTrue:[
  1813         selectedContext notNil ifTrue:[
  1825         selectedContext notNil ifTrue:[
  1814             con := selectedContext.
  1826             con := actualContext. "/ selectedContext.
  1815             steppedContextLineno := actualContext lineNumber.
  1827             steppedContextLineno := actualContext lineNumber.
  1816         ] ifFalse:[
  1828         ] ifFalse:[
  1817             con := contextArray at:2.
  1829             con := contextArray at:2.
  1818             steppedContextLineno := con lineNumber.
  1830             steppedContextLineno := con lineNumber.
  1819         ].
  1831         ].
  1825         ].
  1837         ].
  1826 
  1838 
  1827         steppedContext := con.
  1839         steppedContext := con.
  1828         wrapperContext := nil.
  1840         wrapperContext := nil.
  1829 
  1841 
       
  1842 "/ ' step con:' print. (ObjectMemory addressOf:steppedContext) printHex. ' ' print. steppedContext printCR.
       
  1843 
  1830         "
  1844         "
  1831          if we step in a wrapped method,
  1845          if we step in a wrapped method,
  1832          prepare to skip the prolog ...
  1846          prepare to skip the prolog ...
  1833         "
  1847         "
  1834 "/ ' step con:' print. steppedContextAddress printHex. ' ' printNL.
  1848 
  1835         inWrap := false.
  1849         inWrap := false.
  1836         method := con method.
  1850         method := con method.
  1837         (method notNil and:[method isWrapped]) ifTrue:[
  1851         (method notNil and:[method isWrapped]) ifTrue:[
  1838             inWrap := true
  1852             inWrap := true
  1839         ].
  1853         ].
  1855         stepButton turnOff.
  1869         stepButton turnOff.
  1856         nextButton turnOff.
  1870         nextButton turnOff.
  1857         sendButton turnOff.
  1871         sendButton turnOff.
  1858     ]
  1872     ]
  1859 
  1873 
  1860     "Modified: 22.10.1996 / 11:59:42 / cg"
  1874     "Modified: 22.10.1996 / 14:52:04 / cg"
  1861 !
  1875 !
  1862 
  1876 
  1863 doStop
  1877 doStop
  1864     "stop the process (if its running, otherwise this is a no-op)"
  1878     "stop the process (if its running, otherwise this is a no-op)"
  1865 
  1879 
  2948 ! !
  2962 ! !
  2949 
  2963 
  2950 !DebugView class methodsFor:'documentation'!
  2964 !DebugView class methodsFor:'documentation'!
  2951 
  2965 
  2952 version
  2966 version
  2953     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.109 1996-10-22 11:57:13 cg Exp $'
  2967     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.110 1996-10-22 14:07:44 cg Exp $'
  2954 ! !
  2968 ! !