aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtos')
-rw-r--r--src/rtos/Makefile.am10
-rw-r--r--src/rtos/ecos.c (renamed from src/rtos/eCos.c)0
-rw-r--r--src/rtos/embkernel.c (renamed from src/rtos/embKernel.c)0
-rw-r--r--src/rtos/freertos.c (renamed from src/rtos/FreeRTOS.c)0
-rw-r--r--src/rtos/linux.c28
-rw-r--r--src/rtos/rtos.c4
-rw-r--r--src/rtos/threadx.c (renamed from src/rtos/ThreadX.c)0
-rw-r--r--src/rtos/ucos_iii.c (renamed from src/rtos/uCOS-III.c)0
8 files changed, 20 insertions, 22 deletions
diff --git a/src/rtos/Makefile.am b/src/rtos/Makefile.am
index 0796910..5267fea 100644
--- a/src/rtos/Makefile.am
+++ b/src/rtos/Makefile.am
@@ -11,15 +11,15 @@ noinst_LTLIBRARIES += %D%/librtos.la
%D%/rtos_ucos_iii_stackings.c \
%D%/rtos_riot_stackings.c \
%D%/rtos_nuttx_stackings.c \
- %D%/FreeRTOS.c \
- %D%/ThreadX.c \
- %D%/eCos.c \
+ %D%/freertos.c \
+ %D%/threadx.c \
+ %D%/ecos.c \
%D%/linux.c \
%D%/chibios.c \
%D%/chromium-ec.c \
- %D%/embKernel.c \
+ %D%/embkernel.c \
%D%/mqx.c \
- %D%/uCOS-III.c \
+ %D%/ucos_iii.c \
%D%/nuttx.c \
%D%/rtkernel.c \
%D%/hwthread.c \
diff --git a/src/rtos/eCos.c b/src/rtos/ecos.c
index 7048b00..7048b00 100644
--- a/src/rtos/eCos.c
+++ b/src/rtos/ecos.c
diff --git a/src/rtos/embKernel.c b/src/rtos/embkernel.c
index 7e6de79..7e6de79 100644
--- a/src/rtos/embKernel.c
+++ b/src/rtos/embkernel.c
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/freertos.c
index 02409a5..02409a5 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/freertos.c
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index 5467988..5efdc9f 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -1040,6 +1040,10 @@ static int linux_gdb_thread_packet(struct target *target,
return ERROR_TARGET_FAILURE;
char *out_str = calloc(MAX_THREADS * 17 + 10, 1);
+ if (!out_str) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
char *tmp_str = out_str;
tmp_str += sprintf(tmp_str, "m");
struct threads *temp = linux_os->thread_list;
@@ -1116,23 +1120,13 @@ static int linux_thread_extra_info(struct target *target,
while (temp) {
if (temp->threadid == threadid) {
- char *pid = " PID: ";
- char *pid_current = "*PID: ";
- char *name = "Name: ";
- int str_size = strlen(pid) + strlen(name);
- char *tmp_str = calloc(1, str_size + 50);
- char *tmp_str_ptr = tmp_str;
-
- /* discriminate current task */
- if (temp->status == 3)
- tmp_str_ptr += sprintf(tmp_str_ptr, "%s",
- pid_current);
- else
- tmp_str_ptr += sprintf(tmp_str_ptr, "%s", pid);
-
- tmp_str_ptr += sprintf(tmp_str_ptr, "%d, ", (int)temp->pid);
- sprintf(tmp_str_ptr, "%s", name);
- sprintf(tmp_str_ptr, "%s", temp->name);
+ char *tmp_str = alloc_printf("%cPID: %" PRIu32 ", Name: %s",
+ temp->status == 3 ? '*' : ' ',
+ temp->pid, temp->name);
+ if (!tmp_str) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
char *hex_str = calloc(1, strlen(tmp_str) * 2 + 1);
size_t pkt_len = hexify(hex_str, (const uint8_t *)tmp_str,
strlen(tmp_str), strlen(tmp_str) * 2 + 1);
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 2bd7d3b..e87e51c 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -370,6 +370,10 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
str_size += strlen(detail->extra_info_str);
char *tmp_str = calloc(str_size + 9, sizeof(char));
+ if (!tmp_str) {
+ LOG_ERROR("Out of memory");
+ return ERROR_FAIL;
+ }
char *tmp_str_ptr = tmp_str;
if (detail->thread_name_str)
diff --git a/src/rtos/ThreadX.c b/src/rtos/threadx.c
index 61c4926..61c4926 100644
--- a/src/rtos/ThreadX.c
+++ b/src/rtos/threadx.c
diff --git a/src/rtos/uCOS-III.c b/src/rtos/ucos_iii.c
index f19d06e..f19d06e 100644
--- a/src/rtos/uCOS-III.c
+++ b/src/rtos/ucos_iii.c