Merge pull request #925 from riscv/unavailable_reg
gdb_server,rtos: Differentiate rtos_get_gdb_reg failing and not imple…
This commit is contained in:
commit
6f4b90afb7
|
@ -529,18 +529,20 @@ int rtos_get_gdb_reg(struct connection *connection, int reg_num)
|
|||
{
|
||||
struct target *target = get_target_from_connection(connection);
|
||||
threadid_t current_threadid = target->rtos->current_threadid;
|
||||
if ((target->rtos) && (current_threadid != -1) &&
|
||||
(current_threadid != 0) &&
|
||||
((current_threadid != target->rtos->current_thread) ||
|
||||
(target->smp))) { /* in smp several current thread are possible */
|
||||
if (!target->rtos ||
|
||||
current_threadid == -1 ||
|
||||
current_threadid == 0 ||
|
||||
(current_threadid == target->rtos->current_thread &&
|
||||
!target->smp)) { /* in smp several current thread are possible */
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
struct rtos_reg *reg_list;
|
||||
int num_regs;
|
||||
|
||||
LOG_DEBUG("getting register %d for thread 0x%" PRIx64
|
||||
LOG_TARGET_DEBUG(target, "getting register %d for thread 0x%" PRIx64
|
||||
", target->rtos->current_thread=0x%" PRIx64,
|
||||
reg_num,
|
||||
current_threadid,
|
||||
target->rtos->current_thread);
|
||||
reg_num, current_threadid, target->rtos->current_thread);
|
||||
|
||||
int retval;
|
||||
if (target->rtos->type->get_thread_reg_value) {
|
||||
|
@ -590,7 +592,7 @@ int rtos_get_gdb_reg(struct connection *connection, int reg_num)
|
|||
}
|
||||
|
||||
free(reg_list);
|
||||
}
|
||||
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1397,8 +1397,13 @@ static int gdb_get_register_packet(struct connection *connection,
|
|||
LOG_DEBUG("-");
|
||||
#endif
|
||||
|
||||
if ((target->rtos) && (rtos_get_gdb_reg(connection, reg_num) == ERROR_OK))
|
||||
if (target->rtos) {
|
||||
retval = rtos_get_gdb_reg(connection, reg_num);
|
||||
if (retval == ERROR_OK)
|
||||
return ERROR_OK;
|
||||
if (retval != ERROR_NOT_IMPLEMENTED)
|
||||
return gdb_error(connection, retval);
|
||||
}
|
||||
|
||||
retval = target_get_gdb_reg_list_noread(target, ®_list, ®_list_size,
|
||||
REG_CLASS_ALL);
|
||||
|
|
Loading…
Reference in New Issue