- debug handler file not closed - (thanks to oyvind harboe for the patch)
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Fri, 11 Jan 2008 20:38:43 +0000 (20:38 +0000)
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Fri, 11 Jan 2008 20:38:43 +0000 (20:38 +0000)
- arm_simulate_step called incorrect arm_evaluate_opcode when in thumb mode

git-svn-id: svn://svn.berlios.de/openocd/trunk@254 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/jtag.c
src/target/arm_simulator.c
src/target/xscale.c

index bc5e88fb29d645dcccf45cdf2f3dff1622eeb189..3ef5735eb05276a70f959a54d514c278c8c8c1de 100644 (file)
@@ -416,7 +416,7 @@ int jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state,
        
        cmd_queue_cur_state = cmd_queue_end_state;
                
        
        cmd_queue_cur_state = cmd_queue_end_state;
                
-       for (i=0; i < jtag_num_devices; i++)
+       for (i = 0; i < jtag_num_devices; i++)
        {
                int found = 0;
                device = jtag_get_device(i);
        {
                int found = 0;
                device = jtag_get_device(i);
@@ -432,7 +432,7 @@ int jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state,
                }
 
                /* search the list */
                }
 
                /* search the list */
-               for (j=0; j < num_fields; j++)
+               for (j = 0; j < num_fields; j++)
                {
                        if (i == fields[j].device)
                        {
                {
                        if (i == fields[j].device)
                        {
@@ -562,12 +562,12 @@ int jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state state,
                        
        cmd_queue_cur_state = cmd_queue_end_state;
        
                        
        cmd_queue_cur_state = cmd_queue_end_state;
        
-       for (i=0; i < jtag_num_devices; i++)
+       for (i = 0; i < jtag_num_devices; i++)
        {
                int found = 0;
                (*last_cmd)->cmd.scan->fields[field_count].device = i;
        
        {
                int found = 0;
                (*last_cmd)->cmd.scan->fields[field_count].device = i;
        
-               for (j=0; j < num_fields; j++)
+               for (j = 0; j < num_fields; j++)
                {
                        if (i == fields[j].device)
                        {
                {
                        if (i == fields[j].device)
                        {
@@ -952,7 +952,7 @@ int jtag_scan_size(scan_command_t *cmd)
        int i;
 
        /* count bits in scan command */
        int i;
 
        /* count bits in scan command */
-       for (i=0; i<cmd->num_fields; i++)
+       for (i = 0; i < cmd->num_fields; i++)
        {
                bit_count += cmd->fields[i].num_bits;
        }
        {
                bit_count += cmd->fields[i].num_bits;
        }
@@ -1002,7 +1002,7 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
        /* we return ERROR_OK, unless a check fails, or a handler reports a problem */
        retval = ERROR_OK;
        
        /* we return ERROR_OK, unless a check fails, or a handler reports a problem */
        retval = ERROR_OK;
        
-       for (i=0; i < cmd->num_fields; i++)
+       for (i = 0; i < cmd->num_fields; i++)
        {
                /* if neither in_value nor in_handler
                 * are specified we don't have to examine this field
        {
                /* if neither in_value nor in_handler
                 * are specified we don't have to examine this field
@@ -1012,16 +1012,16 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                        int num_bits = cmd->fields[i].num_bits;
                        u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits);
                        
                        int num_bits = cmd->fields[i].num_bits;
                        u8 *captured = buf_set_buf(buffer, bit_count, malloc(CEIL(num_bits, 8)), 0, num_bits);
                        
-                       #ifdef _DEBUG_JTAG_IO_
-                               char *char_buf;
+#ifdef _DEBUG_JTAG_IO_
+                       char *char_buf;
 
 
-                               char_buf = buf_to_str(captured, (num_bits > 64) ? 64 : num_bits, 16);
-                               DEBUG("fields[%i].in_value: 0x%s", i, char_buf);
-                               free(char_buf);
-                       #endif
+                       char_buf = buf_to_str(captured, (num_bits > 64) ? 64 : num_bits, 16);
+                       DEBUG("fields[%i].in_value: 0x%s", i, char_buf);
+                       free(char_buf);
+#endif
                        
                        
-                       void *priv=cmd->fields[i].in_handler_priv;
-                       if (cmd->fields[i].in_handler==&jtag_check_value)
+                       void *priv = cmd->fields[i].in_handler_priv;
+                       if (cmd->fields[i].in_handler == &jtag_check_value)
                        {
                                /* Yuk! we want to pass in the pointer to cmd->fields[i] which is not known
                                 * when jtag_check_value is invoked
                        {
                                /* Yuk! we want to pass in the pointer to cmd->fields[i] which is not known
                                 * when jtag_check_value is invoked
@@ -1035,7 +1035,7 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
                                 * Change in_handler to be varargs and have fields+i as the first vararg?
                                 * 
                                 */
                                 * Change in_handler to be varargs and have fields+i as the first vararg?
                                 * 
                                 */
-                               priv=cmd->fields+i;
+                               priv = cmd->fields + i;
                        }
                        if (cmd->fields[i].in_value)
                        {
                        }
                        if (cmd->fields[i].in_value)
                        {
@@ -1074,7 +1074,7 @@ int jtag_read_buffer(u8 *buffer, scan_command_t *cmd)
 
 int jtag_check_value(u8 *captured, void *priv)
 {
 
 int jtag_check_value(u8 *captured, void *priv)
 {
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
        scan_field_t *field=(scan_field_t *)priv;
        int num_bits = field->num_bits;
        
        scan_field_t *field=(scan_field_t *)priv;
        int num_bits = field->num_bits;
        
@@ -1137,16 +1137,16 @@ int jtag_check_value(u8 *captured, void *priv)
 void jtag_set_check_value(scan_field_t *field, u8 *value, u8 *mask, error_handler_t *in_error_handler)
 {
        if (value)
 void jtag_set_check_value(scan_field_t *field, u8 *value, u8 *mask, error_handler_t *in_error_handler)
 {
        if (value)
-               field->in_handler=jtag_check_value;
+               field->in_handler = jtag_check_value;
        else
        else
-               field->in_handler=NULL; /* No check, e.g. embeddedice uses value==NULL to indicate no check */
-       field->in_handler_priv=NULL; /* this will be filled in at the invocation site to point to the field duplicate */ 
-       field->in_check_value=value;
-       field->in_check_mask=mask;
+               field->in_handler = NULL;       /* No check, e.g. embeddedice uses value==NULL to indicate no check */
+       field->in_handler_priv = NULL;  /* this will be filled in at the invocation site to point to the field duplicate */ 
+       field->in_check_value = value;
+       field->in_check_mask = mask;
        if (in_error_handler)
        if (in_error_handler)
-               field->in_handler_error_handler=*in_error_handler;
+               field->in_handler_error_handler = *in_error_handler;
        else
        else
-               field->in_handler_error_handler.error_handler=NULL;
+               field->in_handler_error_handler.error_handler = NULL;
 }
 
 enum scan_type jtag_scan_type(scan_command_t *cmd)
 }
 
 enum scan_type jtag_scan_type(scan_command_t *cmd)
@@ -1154,7 +1154,7 @@ enum scan_type jtag_scan_type(scan_command_t *cmd)
        int i;
        int type = 0;
        
        int i;
        int type = 0;
        
-       for (i=0; i < cmd->num_fields; i++)
+       for (i = 0; i < cmd->num_fields; i++)
        {
                if (cmd->fields[i].in_value || cmd->fields[i].in_handler)
                        type |= SCAN_IN;
        {
                if (cmd->fields[i].in_value || cmd->fields[i].in_handler)
                        type |= SCAN_IN;
index 561b14f8f2c71bbbadf7738a0dcbae2cb0fdff95..4ed0558605e17bd5cc030dc608413012848a1711 100644 (file)
@@ -269,13 +269,14 @@ int thumb_pass_branch_condition(u32 cpsr, u16 opcode)
 int arm_simulate_step(target_t *target, u32 *dry_run_pc)
 {
        armv4_5_common_t *armv4_5 = target->arch_info;
 int arm_simulate_step(target_t *target, u32 *dry_run_pc)
 {
        armv4_5_common_t *armv4_5 = target->arch_info;
-       u32 opcode;
        u32 current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
        arm_instruction_t instruction;
        int instruction_size;
        
        if (armv4_5->core_state == ARMV4_5_STATE_ARM)
        {
        u32 current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
        arm_instruction_t instruction;
        int instruction_size;
        
        if (armv4_5->core_state == ARMV4_5_STATE_ARM)
        {
+               u32 opcode;
+               
                /* get current instruction, and identify it */
                target_read_u32(target, current_pc, &opcode);
                arm_evaluate_opcode(opcode, current_pc, &instruction);
                /* get current instruction, and identify it */
                target_read_u32(target, current_pc, &opcode);
                arm_evaluate_opcode(opcode, current_pc, &instruction);
@@ -298,8 +299,10 @@ int arm_simulate_step(target_t *target, u32 *dry_run_pc)
        }
        else
        {
        }
        else
        {
-               target_read_u32(target, current_pc, &opcode);
-               arm_evaluate_opcode(opcode, current_pc, &instruction);
+               u16 opcode;
+               
+               target_read_u16(target, current_pc, &opcode);
+               thumb_evaluate_opcode(opcode, current_pc, &instruction);
                instruction_size = 2;
                
                /* check condition code (only for branch instructions) */
                instruction_size = 2;
                
                /* check condition code (only for branch instructions) */
index cb673df686594793b920ba4b3fda22f55f499ef9..92cc1422c34ce74a8e6569f9ad60ee4c3894e8de 100644 (file)
@@ -1680,6 +1680,8 @@ int xscale_deassert_reset(target_t *target)
                        /* resume the target */
                        xscale_resume(target, 1, 0x0, 1, 0);
                }
                        /* resume the target */
                        xscale_resume(target, 1, 0x0, 1, 0);
                }
+               
+               fileio_close(&debug_handler);
        }
        else
        {
        }
        else
        {

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)