target/xscale: change prototype of xscale_display_instruction() 65/5065/2
authorPaul Fertser <fercerpav@gmail.com>
Mon, 1 Apr 2019 02:06:58 +0000 (04:06 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 14 May 2019 18:35:19 +0000 (19:35 +0100)
To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should be ready to switch
to CMD as first parameter.

Change prototype of xscale_display_instruction() and of
xscale_analyze_trace() to pass CMD instead of CMD_CTX.

This change was part of http://openocd.zylin.com/1815 from Paul
Fertser and has been extracted and rebased to simplify the review.

Change-Id: I8420f19c1b2ff0d2a2f2a8d3627767f7acda437c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5065
Tested-by: jenkins
src/target/xscale.c

index fa4aa4e96615884e5243c62fdda2b0edf2f2fbdc..bc79c7f74d4f258e1b4cbb8a5ede0073d4af7e1d 100644 (file)
@@ -2654,16 +2654,16 @@ static inline void xscale_branch_address(struct xscale_trace_data *trace_data,
 
 static inline void xscale_display_instruction(struct target *target, uint32_t pc,
        struct arm_instruction *instruction,
-       struct command_context *cmd_ctx)
+       struct command_invocation *cmd)
 {
        int retval = xscale_read_instruction(target, pc, instruction);
        if (retval == ERROR_OK)
-               command_print(cmd_ctx, "%s", instruction->text);
+               command_print(cmd->ctx, "%s", instruction->text);
        else
-               command_print(cmd_ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc);
+               command_print(cmd->ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc);
 }
 
-static int xscale_analyze_trace(struct target *target, struct command_context *cmd_ctx)
+static int xscale_analyze_trace(struct target *target, struct command_invocation *cmd)
 {
        struct xscale_common *xscale = target_to_xscale(target);
        struct xscale_trace_data *trace_data = xscale->trace.data;
@@ -2771,7 +2771,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
                        count = trace_data->entries[i].data & 0x0f;
                        for (j = 0; j < count; j++) {
                                xscale_display_instruction(target, current_pc, &instruction,
-                                       cmd_ctx);
+                                       cmd);
                                current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
                        }
 
@@ -2779,7 +2779,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
                         * rollover and some exceptions: undef, swi, prefetch abort. */
                        if ((trace_msg_type == 15) || (exception > 0 && exception < 4)) {
                                xscale_display_instruction(target, current_pc, &instruction,
-                                       cmd_ctx);
+                                       cmd);
                                current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
                        }
 
@@ -2787,13 +2787,13 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
                                continue;
 
                        if (exception) {
-                               command_print(cmd_ctx, "--- exception %i ---", exception);
+                               command_print(cmd->ctx, "--- exception %i ---", exception);
                                continue;
                        }
 
                        /* not exception or rollover; next instruction is a branch and is
                         * not included in the count */
-                       xscale_display_instruction(target, current_pc, &instruction, cmd_ctx);
+                       xscale_display_instruction(target, current_pc, &instruction, cmd);
 
                        /* for direct branches, extract branch destination from instruction */
                        if ((trace_msg_type == 8) || (trace_msg_type == 12)) {
@@ -2813,7 +2813,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
                                }
 
                                if (current_pc == 0)
-                                       command_print(cmd_ctx, "address unknown");
+                                       command_print(cmd->ctx, "address unknown");
 
                                continue;
                        }
@@ -2855,7 +2855,7 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
 
        /* display remaining instructions */
        for (i = 0; i < gap_count; i++) {
-               xscale_display_instruction(target, current_pc, &instruction, cmd_ctx);
+               xscale_display_instruction(target, current_pc, &instruction, cmd);
                current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2;
        }
 
@@ -3486,7 +3486,7 @@ COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command)
        if (retval != ERROR_OK)
                return retval;
 
-       xscale_analyze_trace(target, CMD_CTX);
+       xscale_analyze_trace(target, CMD);
 
        return ERROR_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)