Merge pull request #1006 from en-sc/en-sc/break-ll-revert

Revert "break from long loops on shutdown request"
This commit is contained in:
Jan Matyas 2024-01-29 17:51:51 +01:00 committed by GitHub
commit 87331a82a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1 additions and 41 deletions

View File

@ -118,6 +118,5 @@ COMMAND_HELPER(server_port_command, unsigned short *out);
#define ERROR_SERVER_REMOTE_CLOSED (-400) #define ERROR_SERVER_REMOTE_CLOSED (-400)
#define ERROR_CONNECTION_REJECTED (-401) #define ERROR_CONNECTION_REJECTED (-401)
#define ERROR_SERVER_INTERRUPTED (-402)
#endif /* OPENOCD_SERVER_SERVER_H */ #endif /* OPENOCD_SERVER_SERVER_H */

View File

@ -24,7 +24,6 @@
#include "image.h" #include "image.h"
#include "target.h" #include "target.h"
#include <helper/log.h> #include <helper/log.h>
#include <server/server.h>
/* convert ELF header field to host endianness */ /* convert ELF header field to host endianness */
#define field16(elf, field) \ #define field16(elf, field) \
@ -1296,8 +1295,6 @@ int image_calculate_checksum(const uint8_t *buffer, uint32_t nbytes, uint32_t *c
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buffer++) & 255]; crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buffer++) & 255];
} }
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
} }
LOG_DEBUG("Calculating checksum done; checksum=0x%" PRIx32, crc); LOG_DEBUG("Calculating checksum done; checksum=0x%" PRIx32, crc);

View File

@ -111,9 +111,6 @@ int riscv_batch_run(struct riscv_batch *batch)
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
if (bscan_tunnel_ir_width != 0) { if (bscan_tunnel_ir_width != 0) {
/* need to right-shift "in" by one bit, because of clock skew between BSCAN TAP and DM TAP */ /* need to right-shift "in" by one bit, because of clock skew between BSCAN TAP and DM TAP */
for (size_t i = 0; i < batch->used_scans; ++i) { for (size_t i = 0; i < batch->used_scans; ++i) {

View File

@ -47,9 +47,6 @@ int riscv_program_exec(struct riscv_program *p, struct target *t)
{ {
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
p->execution_result = RISCV_PROGBUF_EXEC_RESULT_UNKNOWN; p->execution_result = RISCV_PROGBUF_EXEC_RESULT_UNKNOWN;
riscv_reg_t saved_registers[GDB_REGNO_XPR31 + 1]; riscv_reg_t saved_registers[GDB_REGNO_XPR31 + 1];
for (size_t i = GDB_REGNO_ZERO + 1; i <= GDB_REGNO_XPR31; ++i) { for (size_t i = GDB_REGNO_ZERO + 1; i <= GDB_REGNO_XPR31; ++i) {

View File

@ -599,9 +599,6 @@ static int dmi_op_timeout(struct target *target, uint32_t *data_in,
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
time_t start = time(NULL); time_t start = time(NULL);
/* This first loop performs the request. Note that if for some reason this /* This first loop performs the request. Note that if for some reason this
* stays busy, it is actually due to the previous access. */ * stays busy, it is actually due to the previous access. */
@ -3248,9 +3245,6 @@ static int read_memory_bus_v1(struct target *target, target_addr_t address,
return ERROR_FAIL; return ERROR_FAIL;
} }
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
dmi_status_t status = dmi_scan(target, NULL, &sbvalue[next_read_j], dmi_status_t status = dmi_scan(target, NULL, &sbvalue[next_read_j],
DMI_OP_READ, sbdata[j], 0, false); DMI_OP_READ, sbdata[j], 0, false);
/* By reading from sbdata0, we have just initiated another system bus read. /* By reading from sbdata0, we have just initiated another system bus read.

View File

@ -5137,9 +5137,6 @@ static int riscv_set_or_write_register(struct target *target,
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
if (regid == GDB_REGNO_PC) { if (regid == GDB_REGNO_PC) {
return riscv_set_or_write_register(target, GDB_REGNO_DPC, value, write_through); return riscv_set_or_write_register(target, GDB_REGNO_DPC, value, write_through);
} else if (regid == GDB_REGNO_PRIV) { } else if (regid == GDB_REGNO_PRIV) {
@ -5237,9 +5234,6 @@ int riscv_get_register(struct target *target, riscv_reg_t *value,
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
if (regid == GDB_REGNO_PC) if (regid == GDB_REGNO_PC)
return riscv_get_register(target, value, GDB_REGNO_DPC); return riscv_get_register(target, value, GDB_REGNO_DPC);

View File

@ -1210,10 +1210,6 @@ int target_run_read_async_algorithm(struct target *target,
/* Avoid GDB timeouts */ /* Avoid GDB timeouts */
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending()) {
retval = ERROR_SERVER_INTERRUPTED;
break;
}
} }
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
@ -3225,11 +3221,8 @@ int target_wait_state(struct target *target, enum target_state state, unsigned i
nvp_value2name(nvp_target_state, state)->name); nvp_value2name(nvp_target_state, state)->name);
} }
if (cur - then > 500) { if (cur - then > 500)
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending())
return ERROR_SERVER_INTERRUPTED;
}
if ((cur-then) > ms) { if ((cur-then) > ms) {
LOG_ERROR("timed out while waiting for target %s", LOG_ERROR("timed out while waiting for target %s",
@ -3512,11 +3505,6 @@ static int target_fill_mem(struct target *target,
break; break;
/* avoid GDB timeouts */ /* avoid GDB timeouts */
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending()) {
retval = ERROR_SERVER_INTERRUPTED;
break;
}
} }
free(target_buf); free(target_buf);
@ -3859,12 +3847,6 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
} }
} }
keep_alive(); keep_alive();
if (openocd_is_shutdown_pending()) {
retval = ERROR_SERVER_INTERRUPTED;
free(data);
free(buffer);
goto done;
}
} }
} }
free(data); free(data);