David Brownell <david-b@pacbell.net>:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Fri, 12 Jun 2009 22:06:02 +0000 (22:06 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Fri, 12 Jun 2009 22:06:02 +0000 (22:06 +0000)
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

src/helper/command.c
src/helper/command.h
src/jtag/tcl.c

index f2a5f56ba6c5851a1c6818db33cea52a748ecb42..ca8a1c1b67c7f83088a894afc7c6c4ee1be95f63 100644 (file)
@@ -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;
 
index d5b87641c24a5d82ab28de099fe43cbbfe7c3729..293eb1414b941dda96c642f8d2bc181d81ad3d94 100644 (file)
@@ -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 */
index abc100622586b3fa3cfba425ace8396947ef9bdf..3586a2f6c949d5d9c19d3e9e3f2ecc7adbb4d7c8 100644 (file)
@@ -1248,6 +1248,8 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
 
        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 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
                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_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
 
 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;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)