summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 22:06:02 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-12 22:06:02 +0000
commitcdd8f23b9b2ba4f78c4cb62b80321c20d4a29754 (patch)
tree845a843e418e1f5d09091a1479c730388491636a /src/helper
parent7b65cb367f41d1095526fdcc3a4521fa3609063d (diff)
downloadopenocd+libswd-cdd8f23b9b2ba4f78c4cb62b80321c20d4a29754.tar.gz
openocd+libswd-cdd8f23b9b2ba4f78c4cb62b80321c20d4a29754.tar.bz2
openocd+libswd-cdd8f23b9b2ba4f78c4cb62b80321c20d4a29754.tar.xz
openocd+libswd-cdd8f23b9b2ba4f78c4cb62b80321c20d4a29754.zip
David Brownell <david-b@pacbell.net>:
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. git-svn-id: svn://svn.berlios.de/openocd/trunk@2224 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/command.c20
-rw-r--r--src/helper/command.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index f2a5f56b..ca8a1c1b 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -61,6 +61,23 @@ static void tcl_output(void *privData, const char *file, int line, const char *f
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 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
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 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
return JIM_ERR;
}
- LOG_DEBUG("script_command - %s, argv[%u]=%s", c->name, i, words[i]);
}
nwords = i;
diff --git a/src/helper/command.h b/src/helper/command.h
index d5b87641..293eb141 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -123,4 +123,6 @@ DEFINE_PARSE_ULONG(u32, uint32_t, UINT32_MAX)
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 */