include some of the log too with crash file vg3
authorhgn <hgodden00@gmail.com>
Thu, 3 Jul 2025 16:18:19 +0000 (17:18 +0100)
committerhgn <hgodden00@gmail.com>
Thu, 3 Jul 2025 16:18:19 +0000 (17:18 +0100)
vg_log.c

index 9b674d44bf3377d0d8e4a0b88a11be3bbc716506..e90d73da7c88af265b03f70a016ab80bf464f237 100644 (file)
--- a/vg_log.c
+++ b/vg_log.c
@@ -257,7 +257,7 @@ void vg_fatal_exit( const char *comment )
    vg_strcat( &line, "OS: GNU/Linux\n"
                      "Comment: " );
    vg_strcat( &line, comment );
-   vg_strcat( &line, "\nStack trace\n"
+   vg_strcat( &line, "\n\nStack trace\n"
                      "-----------------------------------\n" );
    vg_str_flushfd( &line, fd );
    void *functions[20];
@@ -265,6 +265,40 @@ void vg_fatal_exit( const char *comment )
    backtrace_symbols_fd( functions, count, fd );
 #endif
 
+   vg_strcat( &line, "\n\nVG Console log\n"
+                     "-----------------------------------\n" );
+
+       int ptr = vg_log.log_line_current;
+   for( int i=0; i<vg_log.log_line_count; i ++ )
+   {
+      if( ptr >= vg_log.log_line_count )
+         ptr = 0;
+
+      bool vt=0;
+      for( u32 j=0; j<sizeof(vg_log.log[0]); j ++ )
+      {
+         char c = vg_log.log[ptr][j];
+         if( c == 0 )
+            break;
+
+         if( vt )
+         {
+            if( c == 'm' )
+               vt = 0;
+         }
+         else
+         {
+            if( c == '\x1B' )
+               vt = 1;
+            else
+               vg_strcatch( &line, c );
+         }
+      }
+      vg_str_flushfd( &line, fd );
+
+      ptr ++;
+   }
+
    close( fd );
    exit(-1);
 }