DebugView.st
changeset 13398 8d20abbafdb8
parent 13394 f196d8ddec24
child 13408 a29a1a5b7013
equal deleted inserted replaced
13397:82932ca41e6e 13398:8d20abbafdb8
  1377         idx := idx + 1.
  1377         idx := idx + 1.
  1378     ].
  1378     ].
  1379     "/ search...
  1379     "/ search...
  1380     idx := self interestingContextIndexIn:someContexts.
  1380     idx := self interestingContextIndexIn:someContexts.
  1381     ^ someContexts at:idx.
  1381     ^ someContexts at:idx.
       
  1382 
       
  1383     "Modified: / 28-08-2013 / 20:12:47 / cg"
  1382 !
  1384 !
  1383 
  1385 
  1384 interestingContextIndexIn:aContextArray
  1386 interestingContextIndexIn:aContextArray
  1385     "return an interesting context's index, or nil.
  1387     "return an interesting context's index, or nil.
  1386      This is the context initially shown (selected) in the walkback.
  1388      This is the context initially shown (selected) in the walkback.
  1387      We move up the calling chain, skipping all intermediate Signal
  1389      We move up the calling chain, skipping all intermediate Signal
  1388      and Exception contexts, to present the context in which the error actually occured.
  1390      and Exception contexts, to present the context in which the error actually occured.
  1389      Just for your convenience :-)"
  1391      Just for your (my) convenience :-)"
  1390 
  1392 
  1391     |con found offset sel prev rcvr nMax idx methodHome method|
  1393     |con found offset sel prev rcvr nMax idx methodHome method|
  1392 
  1394 
       
  1395 "/ Transcript showCR:'x'.
  1393 "/ Transcript showCR:aContextArray.
  1396 "/ Transcript showCR:aContextArray.
  1394 
  1397 
  1395     nMax := aContextArray size.
  1398     nMax := aContextArray size.
  1396     nMax <= 1 ifTrue:[^ 1].
  1399     nMax <= 1 ifTrue:[^ 1].
  1397     con := aContextArray at:1.
  1400     con := aContextArray at:1.
  1431         "/ show the place where the error (divisionByZero...) happend,
  1434         "/ show the place where the error (divisionByZero...) happend,
  1432         "/ not where the signal was raised.
  1435         "/ not where the signal was raised.
  1433         con := (aContextArray at:1).
  1436         con := (aContextArray at:1).
  1434         sel := con methodHome selector.
  1437         sel := con methodHome selector.
  1435 
  1438 
       
  1439 "/ Transcript show:'2 '; showCR:con.
  1436         "/ typically a DivisionByZero - show caller of division
  1440         "/ typically a DivisionByZero - show caller of division
  1437         (sel == #//
  1441         (sel == #//
  1438         or:[sel == #/
  1442         or:[sel == #/
  1439         or:[sel == #\\]]) ifTrue:[
  1443         or:[sel == #\\]]) ifTrue:[
  1440             ^ 2
  1444             ^ 2
  1543 
  1547 
  1544     "/ the above is all too hard-coded;
  1548     "/ the above is all too hard-coded;
  1545     "/ ask the method, if it thinks it should be skipped in the walkback.
  1549     "/ ask the method, if it thinks it should be skipped in the walkback.
  1546     "/ as more methods get flagged, remove code from above.
  1550     "/ as more methods get flagged, remove code from above.
  1547     con := aContextArray at:offset ifAbsent:nil.
  1551     con := aContextArray at:offset ifAbsent:nil.
  1548 
  1552 "/ Transcript show:'2 '; showCR:con.
  1549     [
  1553     [
  1550         con notNil
  1554         con notNil
  1551         and:[ (methodHome := con methodHome) notNil
  1555         and:[ (methodHome := con methodHome) notNil
  1552         and:[ (method := methodHome method) notNil
  1556         and:[ (method := methodHome method) notNil
  1553         and:[ method shouldBeSkippedInDebuggersWalkBack ]]]
  1557         and:[ method shouldBeSkippedInDebuggersWalkBack ]]]
  1576     ].
  1580     ].
  1577 
  1581 
  1578     "
  1582     "
  1579      now, we are one above the raising context
  1583      now, we are one above the raising context
  1580     "
  1584     "
       
  1585 "/ Transcript show:'3 '; showCR:con.
       
  1586 
       
  1587     (con selector == #retry:coercing:) ifTrue:[
       
  1588         "/ show the operation which failed to coerce, not the coerce
       
  1589         ^ offset + 1
       
  1590     ].
  1581 
  1591 
  1582     "
  1592     "
  1583      if the sender-method of the raise is one of objects error methods ...
  1593      if the sender-method of the raise is one of object's error methods ...
  1584     "
  1594     "
  1585     ( #( halt halt:
  1595     ( #( halt halt:
  1586          error error:
  1596          error error:
  1587          doesNotUnderstand:
  1597          doesNotUnderstand:
  1588          subclassResponsibility
  1598          subclassResponsibility
  1609     ].
  1619     ].
  1610 
  1620 
  1611     ^ offset
  1621     ^ offset
  1612 
  1622 
  1613     "Created: / 17-11-2001 / 20:37:49 / cg"
  1623     "Created: / 17-11-2001 / 20:37:49 / cg"
  1614     "Modified: / 01-08-2013 / 23:18:36 / cg"
  1624     "Modified: / 28-08-2013 / 20:23:35 / cg"
  1615 ! !
  1625 ! !
  1616 
  1626 
  1617 !DebugView methodsFor:'basic'!
  1627 !DebugView methodsFor:'basic'!
  1618 
  1628 
  1619 enableDisableActions
  1629 enableDisableActions
  8832 ! !
  8842 ! !
  8833 
  8843 
  8834 !DebugView class methodsFor:'documentation'!
  8844 !DebugView class methodsFor:'documentation'!
  8835 
  8845 
  8836 version
  8846 version
  8837     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.620 2013-08-28 14:49:40 cg Exp $'
  8847     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.621 2013-08-28 18:24:33 cg Exp $'
  8838 !
  8848 !
  8839 
  8849 
  8840 version_CVS
  8850 version_CVS
  8841     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.620 2013-08-28 14:49:40 cg Exp $'
  8851     ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.621 2013-08-28 18:24:33 cg Exp $'
  8842 !
  8852 !
  8843 
  8853 
  8844 version_SVN
  8854 version_SVN
  8845     ^ '$Id: DebugView.st,v 1.620 2013-08-28 14:49:40 cg Exp $'
  8855     ^ '$Id: DebugView.st,v 1.621 2013-08-28 18:24:33 cg Exp $'
  8846 ! !
  8856 ! !
  8847 
  8857 
  8848 
  8858 
  8849 DebugView initialize!
  8859 DebugView initialize!