aboutsummaryrefslogtreecommitdiff
path: root/src/rtos/rtos.c
diff options
context:
space:
mode:
authorMichel JAOUEN <michel.jaouen@stericsson.com>2012-01-03 15:41:53 +0100
committerØyvind Harboe <oyvindharboe@gmail.com>2012-01-15 22:08:42 +0000
commit1db60b9c434fc281bd25730e7398e92023cfe65d (patch)
treef9d39730c28c7c033d558a030e5bdaccb8f2f4ac /src/rtos/rtos.c
parentca173ff4d4b92ab5a3df89c3a0cd4d47edd4042c (diff)
downloadriscv-openocd-1db60b9c434fc281bd25730e7398e92023cfe65d.zip
riscv-openocd-1db60b9c434fc281bd25730e7398e92023cfe65d.tar.gz
riscv-openocd-1db60b9c434fc281bd25730e7398e92023cfe65d.tar.bz2
rtos :introduce possible overload by rtos of gdb_thread_packet
Change-Id: I17381b581556fa75098a84699dbbf69423fe20eb Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/342 Tested-by: jenkins Reviewed-by: Evan Hunter <evan@ozhiker.com> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'src/rtos/rtos.c')
-rw-r--r--src/rtos/rtos.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 8a5db11..f7d9486 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -48,6 +48,8 @@ static struct rtos_type *rtos_types[] =
NULL
};
+int rtos_thread_packet(struct connection *connection, char *packet, int packet_size);
+
int rtos_create(Jim_GetOptInfo *goi, struct target * target)
{
@@ -116,6 +118,8 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
target->rtos->current_thread = 0;
target->rtos->symbols = NULL;
target->rtos->target = target;
+ /* put default thread handler in linux usecase it is overloaded*/
+ target->rtos->gdb_thread_packet = rtos_thread_packet;
if ( 0 != strcmp( cp, "auto") )
{
@@ -125,10 +129,18 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target)
return JIM_OK;
}
+int gdb_thread_packet(struct connection *connection, char *packet, int packet_size)
+{
+ struct target *target = get_target_from_connection(connection);
+ if (target->rtos == NULL)
+ return rtos_thread_packet(connection, packet, packet_size); /* thread not found*/
+ return target->rtos->gdb_thread_packet(connection, packet, packet_size);
+}
-int gdb_thread_packet(struct connection *connection, char *packet, int packet_size)
+
+int rtos_thread_packet(struct connection *connection, char *packet, int packet_size)
{
struct target *target = get_target_from_connection(connection);
@@ -413,10 +425,8 @@ int gdb_thread_packet(struct connection *connection, char *packet, int packet_si
}
else if ( packet[0] == 'H') // Set current thread ( 'c' for step and continue, 'g' for all other operations )
{
- if (packet[1] == 'g')
- {
+ if ((packet[1] == 'g') && (target->rtos != NULL))
sscanf(packet, "Hg%16" SCNx64, &current_threadid);
- }
gdb_put_packet(connection, "OK", 2);
return ERROR_OK;
}