|
From: <zw...@ma...> - 2009-06-13 00:06:07
|
Author: zwelch
Date: 2009-06-13 00:06:02 +0200 (Sat, 13 Jun 2009)
New Revision: 2224
Modified:
trunk/src/helper/command.c
trunk/src/helper/command.h
trunk/src/jtag/tcl.c
Log:
David Brownell <da...@pa...>:
Currently the "debug_level 3" command tracing ignores commands
that could return values to TCL scripts (by plugging in to a
slightly lower level of the interpreter stack).
Fix that by abstracting the tracing command and starting to
make some of those previously-untraced commands use this new
mechanism.
Modified: trunk/src/helper/command.c
===================================================================
--- trunk/src/helper/command.c 2009-06-12 21:53:17 UTC (rev 2223)
+++ trunk/src/helper/command.c 2009-06-12 22:06:02 UTC (rev 2224)
@@ -61,6 +61,23 @@
extern command_context_t *global_cmd_ctx;
+void script_debug(Jim_Interp *interp, const char *name, int argc, Jim_Obj *const *argv)
+{
+ int i;
+
+ LOG_DEBUG("command - %s", name);
+ for (i = 0; i < argc; i++) {
+ int len;
+ const char *w = Jim_GetString(argv[i], &len);
+
+ /* end of line comment? */
+ if (*w == '#')
+ break;
+
+ LOG_DEBUG("%s - argv[%d]=%s", name, i, w);
+ }
+}
+
static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
/* the private data is stashed in the interp structure */
@@ -85,7 +102,7 @@
target_call_timer_callbacks_now();
LOG_USER_N("%s", ""); /* Keep GDB connection alive*/
- LOG_DEBUG("script_command - %s", c->name);
+ script_debug(interp, c->name, argc, argv);
words = malloc(sizeof(char *) * argc);
for (i = 0; i < argc; i++)
@@ -102,7 +119,6 @@
{
return JIM_ERR;
}
- LOG_DEBUG("script_command - %s, argv[%u]=%s", c->name, i, words[i]);
}
nwords = i;
Modified: trunk/src/helper/command.h
===================================================================
--- trunk/src/helper/command.h 2009-06-12 21:53:17 UTC (rev 2223)
+++ trunk/src/helper/command.h 2009-06-12 22:06:02 UTC (rev 2224)
@@ -123,4 +123,6 @@
DEFINE_PARSE_ULONG(u16, uint16_t, UINT16_MAX)
DEFINE_PARSE_ULONG(u8, uint8_t, UINT8_MAX)
+void script_debug(Jim_Interp *interp, const char *cmd, int argc, Jim_Obj *const *argv);
+
#endif /* COMMAND_H */
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-12 21:53:17 UTC (rev 2223)
+++ trunk/src/jtag/tcl.c 2009-06-12 22:06:02 UTC (rev 2224)
@@ -1248,6 +1248,8 @@
endstate = TAP_IDLE;
+ script_debug(interp, "drscan", argc, args);
+
/* validate arguments as numbers */
e = JIM_OK;
for (i = 2; i < argc; i+=2)
@@ -1369,6 +1371,8 @@
return JIM_ERR;
}
+ script_debug(interp, "pathmove", argc, args);
+
int i;
for (i=0; i<argc-1; i++)
{
@@ -1403,6 +1407,8 @@
static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args)
{
+ script_debug(interp, "flush_count", argc, args);
+
Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count()));
return JIM_OK;
|