Skip to contentSkip to conversation

xen/debug: make debugtrace more clever regarding repeating entries

PATCH Juergen Gross 1 participant 1 message Mar 14, 2019

lore
Share & tools
lore
#0 lore raw
Quoted 47 lines · Jan Beulich
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 14.03.19 at 15:28, <[email protected]> wrote:
Quoted 45 lines · Jan Beulich
Quoted 45 lines
Quoted 1 line
Quoted 1 line · On 14.03.19 at 14:40, <[email protected]> wrote:
Quoted 42 lines · Juergen Gross
Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 14.03.19 at 10:37, <[email protected]> wrote:
xen/drivers/char/console.c +13 -0
@@ -1225,13 +1225,28 @@ void debugtrace_dump(void)
     watchdog_enable();
 }
 
+static void debugtrace_add_to_buf(char *buf)
+{
+    char *p;
+
+    for ( p = buf; *p != '\0'; p++ )
+    {
+        debugtrace_buf[debugtrace_prd++] = *p;
+        /* Always leave a nul byte at the end of the buffer. */
+        if ( debugtrace_prd == (debugtrace_bytes - 1) )
+            debugtrace_prd = 0;
+    }
+}
+
Quoted 8 lines

xen/drivers/char/console.c void debugtrace_dump(void) · line 1245

Quoted 7 lines
xen/drivers/char/console.c +3 -2
 void debugtrace_printk(const char *fmt, ...)
 {
-    static char    buf[1024];
-    static u32 count;
+    static char buf[1024];
+    static char last_buf[1024];
+    static u32 count, last_count;

Please change to uint32_t or even better simply to unsigned int.

Okay.

Quoted 10 lines

xen/drivers/char/console.c void debugtrace_printk(const char *fmt, ...) · line 1262

Quoted 9 lines
xen/drivers/char/console.c +1 -3
@@ -1243,25 +1258,32 @@ void debugtrace_printk(const char *fmt, ...)
 
     ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
 
-    snprintf(buf, sizeof(buf), "%u ", ++count);
-
     va_start(args, fmt);
-    (void)vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, args);
+    (void)vsnprintf(buf, sizeof(buf), fmt, args);

Please take the opportunity and drop the stray cast.

Will do.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Both can be done on commit, surely?

Perhaps, albeit iirc the first would amount to more than just s/u32/.../ on the line in question.

What else would you want to do?

Fold it with the adjacent unsigned int declaration (iirc there was one).

I can post a V3 if you want including the folding.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel