X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Frtos%2Frtos.c;h=11cb79263790058853833429ae51213f50a3a8de;hp=f90c4f643283ed2c4c4a3c3877c95809b41fa0ac;hb=28525663214ea87dbb515c6010a843e472a40637;hpb=0fd0b8ee7c31d455324ed500a270a67f2512ce66 diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index f90c4f6432..11cb792637 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -34,6 +34,7 @@ extern struct rtos_type ThreadX_rtos; extern struct rtos_type eCos_rtos; extern struct rtos_type Linux_os; extern struct rtos_type ChibiOS_rtos; +extern struct rtos_type embKernel_rtos; static struct rtos_type *rtos_types[] = { &ThreadX_rtos, @@ -41,6 +42,7 @@ static struct rtos_type *rtos_types[] = { &eCos_rtos, &Linux_os, &ChibiOS_rtos, + &embKernel_rtos, NULL }; @@ -210,8 +212,10 @@ int rtos_qsymbol(struct connection *connection, char *packet, int packet_size) goto done; } else { /* Autodetecting RTOS - try next RTOS */ - if (!rtos_try_next(target)) + if (!rtos_try_next(target)) { + LOG_WARNING("No RTOS could be auto-detected!"); goto done; + } /* Next RTOS selected - invalidate current symbol */ cur_sym[0] = '\x00'; @@ -325,19 +329,20 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s return ERROR_OK; } else if (strncmp(packet, "qfThreadInfo", 12) == 0) { int i; - if ((target->rtos != NULL) && (target->rtos->thread_count != 0)) { - - char *out_str = (char *) malloc(17 * target->rtos->thread_count + 5); - char *tmp_str = out_str; - tmp_str += sprintf(tmp_str, "m"); - for (i = 0; i < target->rtos->thread_count; i++) { - if (i != 0) - tmp_str += sprintf(tmp_str, ","); - tmp_str += sprintf(tmp_str, "%016" PRIx64, - target->rtos->thread_details[i].threadid); + if (target->rtos != NULL) { + if (target->rtos->thread_count == 0) { + gdb_put_packet(connection, "l", 1); + } else { + /*thread id are 16 char +1 for ',' */ + char *out_str = (char *) malloc(17 * target->rtos->thread_count + 1); + char *tmp_str = out_str; + for (i = 0; i < target->rtos->thread_count; i++) { + tmp_str += sprintf(tmp_str, "%c%016" PRIx64, i == 0 ? 'm' : ',', + target->rtos->thread_details[i].threadid); + } + gdb_put_packet(connection, out_str, strlen(out_str)); + free(out_str); } - tmp_str[0] = 0; - gdb_put_packet(connection, out_str, strlen(out_str)); } else gdb_put_packet(connection, "", 0); @@ -439,6 +444,7 @@ int rtos_generic_stack_read(struct target *target, address -= stacking->stack_registers_size; retval = target_read_buffer(target, address, stacking->stack_registers_size, stack_data); if (retval != ERROR_OK) { + free(stack_data); LOG_ERROR("Error reading stack frame from thread"); return retval; } @@ -473,6 +479,7 @@ int rtos_generic_stack_read(struct target *target, stack_data[stacking->register_offsets[i].offset + j]); } } + free(stack_data); /* LOG_OUTPUT("Output register string: %s\r\n", *hex_reg_list); */ return ERROR_OK; }