mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-27 04:10:47 +00:00
system/trace: correct arg index if command is alreay set
An error occurs when the same command is executed twice
$ trace switch +
$ trace switch +
Usage: trace <subcommand>...
Subcommand:
start [-c][<duration>] : Start task tracing
stop : Stop task tracing
dump [-a][-c][<filename>] : Output the trace result
[-a] <Android SysTrace>
mode [{+|-}{o|w|s|a|i|d}...] : Set task trace options
switch [+|-] : Configure switch trace filter
syscall [{+|-}<syscallname>...] : Configure syscall trace filter
irq [{+|-}<irqnum>...] : Configure IRQ trace filter
print [+|-] : Configure dump tnsh>
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
8ce86fe572
commit
089c05cbd8
1 changed files with 4 additions and 8 deletions
|
|
@ -501,13 +501,13 @@ static int trace_cmd_switch(int index, int argc, FAR char **argv,
|
|||
{
|
||||
if (argv[index][0] == '-' || argv[index][0] == '+')
|
||||
{
|
||||
enable = (argv[index][0] == '+');
|
||||
enable = (argv[index++][0] == '+');
|
||||
if (enable ==
|
||||
((mode.flag & NOTE_FILTER_MODE_FLAG_SWITCH) != 0))
|
||||
{
|
||||
/* Already set */
|
||||
|
||||
return false;
|
||||
return index;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
|
|
@ -520,8 +520,6 @@ static int trace_cmd_switch(int index, int argc, FAR char **argv,
|
|||
}
|
||||
|
||||
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -754,13 +752,13 @@ static int trace_cmd_print(int index, int argc, FAR char **argv,
|
|||
{
|
||||
if (argv[index][0] == '-' || argv[index][0] == '+')
|
||||
{
|
||||
enable = (argv[index][0] == '+');
|
||||
enable = (argv[index++][0] == '+');
|
||||
if (enable ==
|
||||
((mode.flag & NOTE_FILTER_MODE_FLAG_DUMP) != 0))
|
||||
{
|
||||
/* Already set */
|
||||
|
||||
return false;
|
||||
return index;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
|
|
@ -773,8 +771,6 @@ static int trace_cmd_print(int index, int argc, FAR char **argv,
|
|||
}
|
||||
|
||||
ioctl(notectlfd, NOTECTL_SETMODE, (unsigned long)&mode);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue