rtos : current_threadid move to rtos context
Change-Id: I49d9d6d64c418be601d8723cb3eea9c3716ecb6b Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/343 Tested-by: jenkins Reviewed-by: Evan Hunter <evan@ozhiker.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
This commit is contained in:
parent
1db60b9c43
commit
ff3028ce1b
|
@ -29,7 +29,6 @@
|
||||||
#include "server/gdb_server.h"
|
#include "server/gdb_server.h"
|
||||||
|
|
||||||
|
|
||||||
static int64_t current_threadid = -1;
|
|
||||||
|
|
||||||
static void hex_to_str( char* dst, char * hex_src );
|
static void hex_to_str( char* dst, char * hex_src );
|
||||||
static int str_to_hex( char* hex_dst, char* src );
|
static int str_to_hex( char* hex_dst, char* src );
|
||||||
|
@ -55,7 +54,6 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if (! goi->isconfigure) {
|
if (! goi->isconfigure) {
|
||||||
if (goi->argc != 0) {
|
if (goi->argc != 0) {
|
||||||
if (goi->argc != 0) {
|
if (goi->argc != 0) {
|
||||||
|
@ -115,6 +113,7 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
|
||||||
/* Create it */
|
/* Create it */
|
||||||
target->rtos = calloc(1,sizeof(struct rtos));
|
target->rtos = calloc(1,sizeof(struct rtos));
|
||||||
target->rtos->type = rtos_types[x];
|
target->rtos->type = rtos_types[x];
|
||||||
|
target->rtos->current_threadid = -1;
|
||||||
target->rtos->current_thread = 0;
|
target->rtos->current_thread = 0;
|
||||||
target->rtos->symbols = NULL;
|
target->rtos->symbols = NULL;
|
||||||
target->rtos->target = target;
|
target->rtos->target = target;
|
||||||
|
@ -426,7 +425,7 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s
|
||||||
else if ( packet[0] == 'H') // Set current thread ( 'c' for step and continue, 'g' for all other operations )
|
else if ( packet[0] == 'H') // Set current thread ( 'c' for step and continue, 'g' for all other operations )
|
||||||
{
|
{
|
||||||
if ((packet[1] == 'g') && (target->rtos != NULL))
|
if ((packet[1] == 'g') && (target->rtos != NULL))
|
||||||
sscanf(packet, "Hg%16" SCNx64, ¤t_threadid);
|
sscanf(packet, "Hg%16" SCNx64, &target->rtos->current_threadid);
|
||||||
gdb_put_packet(connection, "OK", 2);
|
gdb_put_packet(connection, "OK", 2);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +436,7 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s
|
||||||
int rtos_get_gdb_reg_list(struct connection *connection)
|
int rtos_get_gdb_reg_list(struct connection *connection)
|
||||||
{
|
{
|
||||||
struct target *target = get_target_from_connection(connection);
|
struct target *target = get_target_from_connection(connection);
|
||||||
|
int64_t current_threadid = target->rtos->current_threadid;
|
||||||
if ( ( target->rtos != NULL ) &&
|
if ( ( target->rtos != NULL ) &&
|
||||||
( current_threadid != -1 ) &&
|
( current_threadid != -1 ) &&
|
||||||
( current_threadid != 0 ) &&
|
( current_threadid != 0 ) &&
|
||||||
|
|
|
@ -57,7 +57,8 @@ struct rtos
|
||||||
|
|
||||||
symbol_table_elem_t * symbols;
|
symbol_table_elem_t * symbols;
|
||||||
struct target *target;
|
struct target *target;
|
||||||
|
/* add a context variable instead of global variable */
|
||||||
|
int64_t current_threadid;
|
||||||
threadid_t current_thread;
|
threadid_t current_thread;
|
||||||
struct thread_detail* thread_details;
|
struct thread_detail* thread_details;
|
||||||
int thread_count;
|
int thread_count;
|
||||||
|
|
Loading…
Reference in New Issue