Provide trace_dump()

This commit is contained in:
stefanrueger
2026-07-22 08:04:40 +02:00
parent 21211e945d
commit 4b15f82f7d
2 changed files with 16 additions and 0 deletions

View File

@@ -1866,3 +1866,18 @@ void trace_buffer(const char *funstr, const unsigned char *buf, size_t buflen) {
}
msg_trace("\n");
}
// Output comms buffer like memory dump
void trace_dump(const char *funstr, const unsigned char *buf, size_t buflen) {
pmsg_trace("%s: ", funstr);
while(buflen) {
char out[69];
size_t len = buflen > 16? 16: buflen;
str_hexdump16(out, buf, len);
msg_trace("%s\n", out);
buf += len;
if(buflen -= len)
pmsg_trace("%*s", (int) strlen(funstr)+2, "");
}
}

View File

@@ -1233,6 +1233,7 @@ extern "C" {
int avr_unlock(const PROGRAMMER *pgm, const AVRPART *p);
void report_progress(int completed, int total, const char *hdr);
void trace_buffer(const char *funstr, const unsigned char *buf, size_t buflen);
void trace_dump(const char *funstr, const unsigned char *buf, size_t buflen);
int avr_has_paged_access(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);
int avr_has_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);
int avr_has_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m);