sched/trace: correct the note print format

note print should with Instruction pointer.

e.g:

        trace_printk("hello NuttX");

trace dump:

        hello-6  [000] .... 23080.367994: 0xc044a005: hello NuttX

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-03-31 23:16:07 +08:00 committed by Xiang Xiao
parent 0dc716d426
commit 90484a33e9
3 changed files with 29 additions and 30 deletions

View File

@ -77,27 +77,27 @@ int main(int argc, FAR char *argv[])
while (1)
{
sched_note_printf("shced note test count = %d.", count++);
sched_note_string(str);
sched_note_dump(MAIN_MODULE, 1, &binary, sizeof(struct binary));
sched_note_bprintf(MAIN_MODULE, 2, "%hhd", c);
sched_note_bprintf(MAIN_MODULE, 3, "%hd", s);
sched_note_bprintf(MAIN_MODULE, 4, "%d", i);
sched_note_bprintf(MAIN_MODULE, 5, "%ld", l);
sched_note_bprintf(MAIN_MODULE, 6, "%lld", ll);
sched_note_bprintf(MAIN_MODULE, 7, "%jd", im);
sched_note_bprintf(MAIN_MODULE, 8, "%zd", sz);
sched_note_bprintf(MAIN_MODULE, 9, "%td", ptr);
SCHED_NOTE_PRINTF("shced note test count = %d.", count++);
SCHED_NOTE_STRING(str);
SCHED_NOTE_DUMP(1, &binary, sizeof(struct binary));
SCHED_NOTE_BPRINTF(2, "%hhd", c);
SCHED_NOTE_BPRINTF(3, "%hd", s);
SCHED_NOTE_BPRINTF(4, "%d", i);
SCHED_NOTE_BPRINTF(5, "%ld", l);
SCHED_NOTE_BPRINTF(6, "%lld", ll);
SCHED_NOTE_BPRINTF(7, "%jd", im);
SCHED_NOTE_BPRINTF(8, "%zd", sz);
SCHED_NOTE_BPRINTF(9, "%td", ptr);
#ifdef CONFIG_HAVE_FLOAT
sched_note_bprintf(MAIN_MODULE, 10, "%e", f);
SCHED_NOTE_BPRINTF(10, "%e", f);
#endif
#ifdef CONFIG_HAVE_DOUBLE
sched_note_bprintf(MAIN_MODULE, 11, "%le", d);
SCHED_NOTE_BPRINTF(11, "%le", d);
#endif
#ifdef CONFIG_HAVE_LONG_DOUBLE
sched_note_bprintf(MAIN_MODULE, 12, "%Le", ld);
SCHED_NOTE_BPRINTF(12, "%Le", ld);
#endif
sched_note_bprintf(MAIN_MODULE, 13,
SCHED_NOTE_BPRINTF(13,
"%hhd %hd %d %ld %lld %jd %zd %td",
c, s, i, l, ll, im, sz, ptr);
usleep(10);

View File

@ -737,7 +737,7 @@ static void dump_notes(size_t nread)
{
FAR struct note_binary_s *note_binary =
(FAR struct note_binary_s *)note;
uint32_t module;
uintptr_t ip;
char out[1280];
int count;
int ret = 0;
@ -758,15 +758,15 @@ static void dump_notes(size_t nread)
ret += sprintf(&out[ret], " 0x%x", note_binary->nbi_data[i]);
}
trace_dump_unflatten(&module,
note_binary->nbi_module,
sizeof(module));
trace_dump_unflatten(&ip, note_binary->nbi_ip,
sizeof(ip));
syslog_time(LOG_INFO,
"Task %u priority %u, binary:module=%lx "
"event=%u count=%u%s\n",
"Task %u priority %u, ip=0x%" PRIdPTR
" event=%u count=%u%s\n",
(unsigned int)pid,
(unsigned int)note->nc_priority, module,
(unsigned int)note->nc_priority,
note_binary->nbi_ip,
note_binary->nbi_event,
count,
out);

View File

@ -615,31 +615,30 @@ static int trace_dump_one(FAR FILE *out,
case NOTE_DUMP_STRING:
{
FAR struct note_string_s *nst;
uintptr_t ip;
nst = (FAR struct note_string_s *)p;
trace_dump_header(out, note, ctx);
fprintf(out, "dump_string: %s\n",
nst->nst_data);
trace_dump_unflatten(&ip, nst->nst_ip, sizeof(ip));
fprintf(out, "0x%" PRIdPTR ": %s\n", ip, nst->nst_data);
}
break;
case NOTE_DUMP_BINARY:
{
FAR struct note_binary_s *nbi;
uint32_t module;
uint8_t count;
uintptr_t ip;
int i;
nbi = (FAR struct note_binary_s *)p;
trace_dump_header(out, note, ctx);
count = note->nc_length - sizeof(struct note_binary_s) + 1;
trace_dump_unflatten(&module,
note_binary->nbi_module,
sizeof(module));
trace_dump_unflatten(&ip, nbi->nbi_ip, sizeof(ip));
fprintf(out, "dump_binary: module=%lx event=%u count=%u",
module, nbi->nbi_event, count);
fprintf(out, "0x%" PRIdPTR ": event=%u count=%u",
ip, nbi->nbi_event, count);
for (i = 0; i < count; i++)
{
fprintf(out, " 0x%x", nbi->nbi_data[i]);