1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
|
/*
* tclTrace.c --
*
* This file contains code to handle most trace management.
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 Scriptics Corporation.
* Copyright (c) 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclTrace.c,v 1.2.2.21 2007/05/29 14:21:17 dgp Exp $
* RCS: @(#) $Id: tclTrace.c,v 1.2.2.22 2007/06/12 19:38:51 dgp Exp $
*/
#include "tclInt.h"
/*
* Structures used to hold information about variable traces:
*/
|
| ︙ | | |
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
|
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
|
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
*----------------------------------------------------------------------
*/
int
TclCheckExecutionTraces(
Tcl_Interp *interp, /* The current interpreter. */
CONST char *command, /* Pointer to beginning of the current command
* string. */
* string. If NULL, the string will be
* generated from (objc,objv) */
int numChars, /* The number of characters in 'command' which
* are part of the command string. */
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
int traceFlags, /* Current tracing situation. */
int objc, /* Number of arguments for the command. */
Tcl_Obj *CONST objv[]) /* Pointers to Tcl_Obj of each argument. */
{
Interp *iPtr = (Interp *) interp;
CommandTrace *tracePtr, *lastTracePtr;
ActiveCommandTrace active;
int curLevel;
int traceCode = TCL_OK;
TraceCommandInfo* tcmdPtr;
Tcl_InterpState state = NULL;
Tcl_Obj *commandPtr = NULL;
if (command == NULL || cmdPtr->tracePtr == NULL) {
if (cmdPtr->tracePtr == NULL) {
return traceCode;
}
/*
* Insure that we have a nul-terminated command string
*/
if (!command) {
commandPtr = Tcl_NewListObj(objc, objv);
command = Tcl_GetStringFromObj(commandPtr, &numChars);
} else if ((numChars != -1) && (command[numChars] != '\0')) {
commandPtr = Tcl_NewStringObj(command, numChars);
command = TclGetString(commandPtr);
}
curLevel = iPtr->varFramePtr->level;
active.nextPtr = iPtr->activeCmdTracePtr;
iPtr->activeCmdTracePtr = &active;
active.cmdPtr = cmdPtr;
lastTracePtr = NULL;
|
| ︙ | | |
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
|
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
|
+
+
+
+
|
lastTracePtr = active.nextTracePtr->nextPtr;
}
}
iPtr->activeCmdTracePtr = active.nextPtr;
if (state) {
(void) Tcl_RestoreInterpState(interp, state);
}
if (commandPtr) {
Tcl_DecrRefCount(commandPtr);
}
return(traceCode);
}
/*
*----------------------------------------------------------------------
*
* TclCheckInterpTraces --
|
| ︙ | | |
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
|
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
|
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
*----------------------------------------------------------------------
*/
int
TclCheckInterpTraces(
Tcl_Interp *interp, /* The current interpreter. */
CONST char *command, /* Pointer to beginning of the current command
* string. */
* string. If NULL, the string will be
* generated from (objc,objv) */
int numChars, /* The number of characters in 'command' which
* are part of the command string. */
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
int traceFlags, /* Current tracing situation. */
int objc, /* Number of arguments for the command. */
Tcl_Obj *CONST objv[]) /* Pointers to Tcl_Obj of each argument. */
{
Interp *iPtr = (Interp *) interp;
Trace *tracePtr, *lastTracePtr;
ActiveInterpTrace active;
int curLevel;
int traceCode = TCL_OK;
Tcl_InterpState state = NULL;
Tcl_Obj *commandPtr = NULL;
if (command == NULL || iPtr->tracePtr == NULL
if ((iPtr->tracePtr == NULL)
|| (iPtr->flags & INTERP_TRACE_IN_PROGRESS)) {
return(traceCode);
}
/*
* Insure that we have a nul-terminated command string
*/
if (!command) {
commandPtr = Tcl_NewListObj(objc, objv);
command = Tcl_GetStringFromObj(commandPtr, &numChars);
} else if ((numChars != -1) && (command[numChars] != '\0')) {
commandPtr = Tcl_NewStringObj(command, numChars);
command = TclGetString(commandPtr);
}
curLevel = iPtr->numLevels;
active.nextPtr = iPtr->activeInterpTracePtr;
iPtr->activeInterpTracePtr = &active;
lastTracePtr = NULL;
for (tracePtr = iPtr->tracePtr;
|
| ︙ | | |
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
|
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
|
+
+
+
+
|
if (state) {
if (traceCode == TCL_OK) {
(void) Tcl_RestoreInterpState(interp, state);
} else {
Tcl_DiscardInterpState(state);
}
}
if (commandPtr) {
Tcl_DecrRefCount(commandPtr);
}
return(traceCode);
}
/*
*----------------------------------------------------------------------
*
* CallTraceFunction --
|
| ︙ | | |