xscale: cleanup
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 7 Nov 2011 06:20:26 +0000 (07:20 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 7 Nov 2011 16:13:08 +0000 (16:13 +0000)
- fix error propagation
- add some debug output for "unused" variables
- reduce scope of variable to avoid "unread" variables.

Change-Id: I136995f2a043102e64b8fff3017502fae564013b
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/175
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/target/xscale.c

index b469b86449c155bcc328b4b4fcb6ad4ae8db7957..6fed0329d5f27b67f4d9f06da1f810107a33668c 100644 (file)
@@ -1180,7 +1180,6 @@ static int xscale_resume(struct target *target, int current,
 {
        struct xscale_common *xscale = target_to_xscale(target);
        struct arm *armv4_5 = &xscale->armv4_5_common;
-       struct breakpoint *breakpoint = target->breakpoints;
        uint32_t current_pc;
        int retval;
        int i;
@@ -1218,6 +1217,7 @@ static int xscale_resume(struct target *target, int current,
        /* the front-end may request us not to handle breakpoints */
        if (handle_breakpoints)
        {
+               struct breakpoint *breakpoint;
                breakpoint = breakpoint_find(target,
                                buf_get_u32(armv4_5->pc->value, 0, 32));
                if (breakpoint != NULL)
@@ -1242,6 +1242,8 @@ static int xscale_resume(struct target *target, int current,
 
                        /* restore banked registers */
                        retval = xscale_restore_banked(target);
+                       if (retval != ERROR_OK)
+                               return retval;
 
                        /* send resume request */
                        xscale_send_u32(target, 0x30);
@@ -1289,6 +1291,8 @@ static int xscale_resume(struct target *target, int current,
 
        /* restore banked registers */
        retval = xscale_restore_banked(target);
+       if (retval != ERROR_OK)
+               return retval;
 
        /* send resume request (command 0x30 or 0x31)
         * clean the trace buffer if it is to be enabled (0x62) */
@@ -1462,6 +1466,7 @@ static int xscale_step(struct target *target, int current,
                if ((retval = arm_simulate_step(target, NULL)) != ERROR_OK)
                        return retval;
                current_pc = buf_get_u32(armv4_5->pc->value, 0, 32);
+               LOG_DEBUG("current pc %" PRIx32, current_pc);
 
                target->debug_reason = DBG_REASON_SINGLESTEP;
                target_call_event_callbacks(target, TARGET_EVENT_HALTED);
@@ -1480,6 +1485,8 @@ static int xscale_step(struct target *target, int current,
        }
 
        retval = xscale_step_inner(target, current, address, handle_breakpoints);
+       if (retval != ERROR_OK)
+               return retval;
 
        if (breakpoint)
        {

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)