This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5c8614978817c59e395bb1133f48f2516804c3f0 Author: chenzihan1 <[email protected]> AuthorDate: Wed Dec 10 16:41:41 2025 +0800 include/nuttx/syslog/syslog_rpmsg.h: add syslog_rpmsg_dump() Add an inline helper that prints the unsent part of a syslog rpmsg buffer with _alert(), given the address of its header. A core that shares the buffer with a remote core can use it to show the remote log, for example after the remote crashed. Signed-off-by: chenzihan1 <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- include/nuttx/syslog/syslog_rpmsg.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/nuttx/syslog/syslog_rpmsg.h b/include/nuttx/syslog/syslog_rpmsg.h index 87affc51276..8763cb50745 100644 --- a/include/nuttx/syslog/syslog_rpmsg.h +++ b/include/nuttx/syslog/syslog_rpmsg.h @@ -29,6 +29,8 @@ #include <nuttx/config.h> +#include <debug.h> + #include <nuttx/rpmsg/rpmsg.h> #include <nuttx/syslog/syslog.h> #include <nuttx/spinlock.h> @@ -92,6 +94,25 @@ ssize_t syslog_rpmsg_write(FAR syslog_channel_t *channel, int syslog_rpmsg_server_init(void); #endif +static inline_function void syslog_rpmsg_dump(FAR const void *buffer) +{ + FAR const struct syslog_rpmsg_buffer_header_s *header = + (FAR const struct syslog_rpmsg_buffer_header_s *)buffer; + uint32_t head = header->head; + uint32_t tail = header->tail; + uint32_t size = header->size; + + if (head > tail) + { + _alert("%.*s\n", (int)(head - tail), &header->buffer[tail]); + } + else if (head < tail) + { + _alert("%.*s%.*s\n", (int)(size - tail), &header->buffer[tail], + (int)head, &header->buffer[0]); + } +} + #ifdef __cplusplus } #endif
