Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions system/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ static int trace_cmd_dump(FAR const char *name, int index, int argc,
{
FAR FILE *out = stdout;
bool changed = false;
bool binary = false;
bool cont = false;
int ret;

/* Usage: trace dump [-c][<filename>] */
/* Usage: trace dump [-b][-c][<filename>] */

if (index < argc)
{
if (strcmp(argv[index], "-b") == 0)
{
binary = true;
index++;
}
}

if (index < argc)
{
Expand Down Expand Up @@ -192,11 +202,14 @@ static int trace_cmd_dump(FAR const char *name, int index, int argc,

/* Dump the trace header */

fputs("# tracer: nop\n#\n", out);
if (!binary)
{
fputs("# tracer: nop\n#\n", out);
}

/* Dump the trace data */

ret = trace_dump(out);
ret = trace_dump(out, binary);

if (changed)
{
Expand Down Expand Up @@ -803,9 +816,8 @@ static void show_usage(void)
" Get the trace while running <command>\n"
#endif
#ifdef CONFIG_DRIVERS_NOTERAM
" dump [-a][-c][<filename>] :"
" dump [-b][-c][<filename>] :"
" Output the trace result\n"
" [-a] <Android SysTrace>\n"
#endif
" mode [{+|-}{o|w|s|a|i|d}...] :"
" Set task trace options\n"
Expand Down
2 changes: 1 addition & 1 deletion system/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C"
*
****************************************************************************/

int trace_dump(FAR FILE *out);
int trace_dump(FAR FILE *out, bool binary);

/****************************************************************************
* Name: trace_dump_clear
Expand Down
14 changes: 13 additions & 1 deletion system/trace/trace_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void note_ioctl(int cmd, unsigned long arg)
*
****************************************************************************/

int trace_dump(FAR FILE *out)
int trace_dump(FAR FILE *out, bool binary)
{
uint8_t tracedata[1024];
int ret;
Expand All @@ -82,6 +82,18 @@ int trace_dump(FAR FILE *out)
return ERROR;
}

if (binary)
{
unsigned int mode = NOTERAM_MODE_READ_BINARY;
ret = ioctl(fd, NOTERAM_SETREADMODE, &mode);
if (ret < 0)
{
fprintf(stderr, "trace: cannot set read mode\n");
close(fd);
return ERROR;
}
}

/* Read and output all notes */

while (1)
Expand Down
Loading