apps/system/trace: support binary dump of noteram #3355
+31
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support for dumping binary contents from noteram via the
trace dump -b <file>command. Changes include:binaryparameter totrace_dump()and the public headersystem/trace/trace.hto indicate binary output mode.trace_dump()to set the noteram read mode to binary usingNOTERAM_SETREADMODEwhen requested.trace dumpCLI parsing insystem/trace/trace.cto acceptthe
-bflag and pass it through totrace_dump().-boption.Note: Please adhere to Contributing Guidelines.
Summary
This PR adds support for dumping binary noteram contents from the
traceutility. A new
-boption is provided totrace dumpto emit the rawbinary data instead of the human-readable text format.
What I changed
system/trace/trace.h: updated prototypeint trace_dump(FILE *out, bool binary);system/trace/trace.c: parse-boption fortrace dumpand pass theflag to
trace_dump(); update usage text.system/trace/trace_dump.c: when binary mode is requested, set thenoteram read mode to
NOTERAM_MODE_READ_BINARYvia ioctlNOTERAM_SETREADMODE.Files modified
Impact
-bis not specified.
Testing
nsh> trace dump -b /tmp/trace.binand verify the produced filecontains binary data as expected.
nsh> trace dump /tmp/trace.txtto verify the original text output.