Add task name recording support for trace command
@@ -91,6 +91,7 @@ struct trace_dump_context_s
{
struct trace_dump_cpu_context_s cpu[NCPUS];
FAR struct trace_dump_task_context_s *task;
+ int notefd;
};
/****************************************************************************
@@ -125,12 +126,15 @@ static void note_ioctl(int cmd, unsigned long arg)
* Name: trace_dump_init_context
****************************************************************************/
-static void trace_dump_init_context(FAR struct trace_dump_context_s *ctx)
+static void trace_dump_init_context(FAR struct trace_dump_context_s *ctx,
+ int fd)
{
int cpu;
/* Initialize the trace dump context */
+ ctx->notefd = fd;
+
for (cpu = 0; cpu < NCPUS; cpu++)
{
ctx->cpu[cpu].intr_nest = 0;
@@ -222,6 +226,20 @@ FAR static struct trace_dump_task_context_s *get_task_context(pid_t pid,
(*tctxp)->pid = pid;
(*tctxp)->syscall_nest = 0;
(*tctxp)->name[0] = '\0';
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+ {
+ struct noteram_get_taskname_s tnm;
+ int res;
+
+ tnm.pid = pid;
+ res = ioctl(ctx->notefd, NOTERAM_GETTASKNAME, (unsigned long)&tnm);
+ if (res == 0)
+ {
+ copy_task_name((*tctxp)->name, tnm.taskname);
+ }
+ }
+#endif
}
return *tctxp;
@@ -638,7 +656,7 @@ int trace_dump(FAR FILE *out)
return ERROR;
}
- trace_dump_init_context(&ctx);
+ trace_dump_init_context(&ctx, fd);
/* Read and output all notes */
