huojianchaoyy opened a new pull request, #4124:
URL: https://github.com/apache/nuttx-apps/pull/4124

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   `trace dump` changes from Xiaomi Vela.
   
   - **system/trace: Change stack variables to dynamic memory allocation**: the 
1024-byte read buffer of `trace_dump()` comes from the heap instead of the 
stack of the `trace` command.
   - **system/trace: trace dump supports specifying devices**: `trace dump` 
reads `/dev/note/<name>`, `<name>` being the note driver given with `-n`, which 
now defaults to "ram". It also passes `TRACE_DUMP_BUFFER_SIZE` to `read()`: in 
the first commit `read()` still got `sizeof tracedata`, the size of the 
pointer, until this one.
   
   One commit first: **system/trace: add the missing blank line in 
trace_dump()**, an existing nxstyle error in `trace_dump.c`, which this PR 
touches.
   
   ## Impact
   
   - Without `-n`, the subcommands now address the "ram" driver: `trace start`, 
`stop`, `cmd`, `mode`, `switch`, `syscall`, `irq` and `print`, and the pause 
around `trace dump`, used to apply to every note driver (an empty name) and now 
apply to noteram only; `trace -n <name> ...` is unchanged.
   - `trace -n <name> dump` opens `/dev/note/<name>` and fails if that device 
does not exist; it always read `/dev/note/ram` before.
   
   ## Testing
   
   Host: Ubuntu 22.04 x86_64, GCC 13.4.0, CMake 3.23 + Ninja 1.10. nuttx master 
c8907860837, apps base 8ff87439bf4.
   
   `./tools/checkpatch.sh -c -u -m -g HEAD~3..HEAD` (nuttx master's) passes.
   
   `sim:note` with hostfs, CMake and Make builds. On the CMake build:
   ```
   nsh> trace start
   nsh> sleep 1
   nsh> trace stop
   nsh> trace dump /host/t.txt               # 190159 bytes, before and after
   nsh> trace dump -b /host/t.bin            # 62077 bytes, 2637 notes, before 
and after
   nsh> trace -n ram dump /host/t2.txt       # works before and after
   nsh> trace -n nosuch dump /host/t3.txt
   trace: cannot open /dev/note/nosuch       # after; before it dumped 
/dev/note/ram
   trace dump: dump failed
   ```
   The binary dumps walk by `nc_length` to the exact end of the file.
   
   Not tested: a second noteram device created with `noteram_initialize()`, 
real hardware.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to