diff --git a/system/sched_note/note_main.c b/system/sched_note/note_main.c index ad656e14d..7f16350f6 100644 --- a/system/sched_note/note_main.c +++ b/system/sched_note/note_main.c @@ -595,7 +595,7 @@ static void dump_notes(size_t nread) FAR struct note_syscall_enter_s *note_sysenter = (FAR struct note_syscall_enter_s *)note; - if (note->nc_length != sizeof(struct note_syscall_enter_s)) + if (note->nc_length < SIZEOF_NOTE_SYSCALL_ENTER(0)) { syslog(LOG_INFO, "ERROR: Size incorrect for SYSCALL enter note: %d\n", diff --git a/system/trace/trace.c b/system/trace/trace.c index 571a44c79..ed9db326e 100644 --- a/system/trace/trace.c +++ b/system/trace/trace.c @@ -295,7 +295,7 @@ static int trace_cmd_mode(int index, int argc, FAR char **argv, int i; int count; - /* Usage: trace mode [{+|-}{o|s|i}...] */ + /* Usage: trace mode [{+|-}{o|s|a|i}...] */ /* Get current trace mode */ @@ -332,6 +332,17 @@ static int trace_cmd_mode(int index, int argc, FAR char **argv, mode.flag &= ~NOTE_FILTER_MODE_FLAG_SYSCALL; } break; + + case 'a': /* Record syscall arguments */ + if (enable) + { + mode.flag |= NOTE_FILTER_MODE_FLAG_SYSCALL_ARGS; + } + else + { + mode.flag &= ~NOTE_FILTER_MODE_FLAG_SYSCALL_ARGS; + } + break; #endif #ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER @@ -397,6 +408,10 @@ static int trace_cmd_mode(int index, int argc, FAR char **argv, { printf(" Filtered Syscalls : %d\n", count); } + + printf(" Syscall trace with args : %s\n", + mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL_ARGS ? + "on (+a)" : "off (-a)"); #endif #ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER @@ -644,7 +659,7 @@ static void show_usage(void) " dump [-c][] :" " Output the trace result\n" #endif - " mode [{+|-}{o|s|i}...] :" + " mode [{+|-}{o|s|a|i}...] :" " Set task trace options\n" #ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL " syscall [{+|-}...] :" diff --git a/system/trace/trace_dump.c b/system/trace/trace_dump.c index bc936dd49..edaf77aea 100644 --- a/system/trace/trace_dump.c +++ b/system/trace/trace_dump.c @@ -421,6 +421,9 @@ static int trace_dump_one(FAR FILE *out, { FAR struct note_syscall_enter_s *nsc; FAR struct trace_dump_task_context_s *tctx; + int i; + int j; + uintptr_t arg; /* Exclude the case of syscall issued by an interrupt handler and * nested syscalls to correct tracecompass display. @@ -451,8 +454,34 @@ static int trace_dump_one(FAR FILE *out, } trace_dump_header(out, note, ctx); - fprintf(out, "sys_%s()\n", + fprintf(out, "sys_%s(", g_funcnames[nsc->nsc_nr - CONFIG_SYS_RESERVED]); + + for (i = j = 0; i < nsc->nsc_argc; i++) + { + arg = (uintptr_t)nsc->nsc_args[j++]; + arg |= (uintptr_t)nsc->nsc_args[j++] << 8; +#if UINTPTR_MAX > UINT16_MAX + arg |= (uintptr_t)nsc->nsc_args[j++] << 16; + arg |= (uintptr_t)nsc->nsc_args[j++] << 24; +#if UINTPTR_MAX > UINT32_MAX + arg |= (uintptr_t)nsc->nsc_args[j++] << 32; + arg |= (uintptr_t)nsc->nsc_args[j++] << 40; + arg |= (uintptr_t)nsc->nsc_args[j++] << 48; + arg |= (uintptr_t)nsc->nsc_args[j++] << 56; +#endif +#endif + if (i == 0) + { + fprintf(out, "arg%d: 0x%x", i, arg); + } + else + { + fprintf(out, ", arg%d: 0x%x", i, arg); + } + } + + fprintf(out, ")\n"); } break;