target: change prototype of handle_bp_command_set() 76/5076/2
authorPaul Fertser <fercerpav@gmail.com>
Mon, 1 Apr 2019 03:19:21 +0000 (05:19 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 14 May 2019 18:36:34 +0000 (19:36 +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 handle_bp_command_set() 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: If00f9cfb784b53bb3df92d4469178e2f930a146a
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/5076
Tested-by: jenkins
src/target/target.c

index e12ed7fd11cae9fdece7362c0b51eb02bb5cd0f9..bffb55410f1955e9c26a846ea3cbe23d67084b73 100644 (file)
@@ -3729,17 +3729,17 @@ static int handle_bp_command_list(struct command_invocation *cmd)
        return ERROR_OK;
 }
 
-static int handle_bp_command_set(struct command_context *cmd_ctx,
+static int handle_bp_command_set(struct command_invocation *cmd,
                target_addr_t addr, uint32_t asid, uint32_t length, int hw)
 {
-       struct target *target = get_current_target(cmd_ctx);
+       struct target *target = get_current_target(cmd->ctx);
        int retval;
 
        if (asid == 0) {
                retval = breakpoint_add(target, addr, length, hw);
                /* error is always logged in breakpoint_add(), do not print it again */
                if (ERROR_OK == retval)
-                       command_print(cmd_ctx, "breakpoint set at " TARGET_ADDR_FMT "", addr);
+                       command_print(cmd->ctx, "breakpoint set at " TARGET_ADDR_FMT "", addr);
 
        } else if (addr == 0) {
                if (target->type->add_context_breakpoint == NULL) {
@@ -3749,7 +3749,7 @@ static int handle_bp_command_set(struct command_context *cmd_ctx,
                retval = context_breakpoint_add(target, asid, length, hw);
                /* error is always logged in context_breakpoint_add(), do not print it again */
                if (ERROR_OK == retval)
-                       command_print(cmd_ctx, "Context breakpoint set at 0x%8.8" PRIx32 "", asid);
+                       command_print(cmd->ctx, "Context breakpoint set at 0x%8.8" PRIx32 "", asid);
 
        } else {
                if (target->type->add_hybrid_breakpoint == NULL) {
@@ -3759,7 +3759,7 @@ static int handle_bp_command_set(struct command_context *cmd_ctx,
                retval = hybrid_breakpoint_add(target, addr, asid, length, hw);
                /* error is always logged in hybrid_breakpoint_add(), do not print it again */
                if (ERROR_OK == retval)
-                       command_print(cmd_ctx, "Hybrid breakpoint set at 0x%8.8" PRIx32 "", asid);
+                       command_print(cmd->ctx, "Hybrid breakpoint set at 0x%8.8" PRIx32 "", asid);
        }
        return retval;
 }
@@ -3779,7 +3779,7 @@ COMMAND_HANDLER(handle_bp_command)
                        asid = 0;
                        COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr);
                        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
-                       return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
+                       return handle_bp_command_set(CMD, addr, asid, length, hw);
 
                case 3:
                        if (strcmp(CMD_ARGV[2], "hw") == 0) {
@@ -3787,13 +3787,13 @@ COMMAND_HANDLER(handle_bp_command)
                                COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr);
                                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
                                asid = 0;
-                               return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
+                               return handle_bp_command_set(CMD, addr, asid, length, hw);
                        } else if (strcmp(CMD_ARGV[2], "hw_ctx") == 0) {
                                hw = BKPT_HARD;
                                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], asid);
                                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
                                addr = 0;
-                               return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
+                               return handle_bp_command_set(CMD, addr, asid, length, hw);
                        }
                        /* fallthrough */
                case 4:
@@ -3801,7 +3801,7 @@ COMMAND_HANDLER(handle_bp_command)
                        COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr);
                        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], asid);
                        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], length);
-                       return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
+                       return handle_bp_command_set(CMD, addr, asid, length, hw);
 
                default:
                        return ERROR_COMMAND_SYNTAX_ERROR;

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)