about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-27 18:42:07 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-10-27 18:42:07 +0200
commitcfeb0626ccc6f335d95089bf6c4f7baecdce9c8a (patch)
tree27bb96cf9e28c9fb26749f7ae132925338565d66 /src/main.c
parent3f2c4ed7943ac0985608e332948b40d873cc741c (diff)
downloadbox64-cfeb0626ccc6f335d95089bf6c4f7baecdce9c8a.tar.gz
box64-cfeb0626ccc6f335d95089bf6c4f7baecdce9c8a.zip
Added BOX64_SHOWBT env. var. to have a backtrace on segfault
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 2dfc0caf..dcd5d92c 100755
--- a/src/main.c
+++ b/src/main.c
@@ -90,6 +90,7 @@ int box64_nopulse = 0;
 int box64_nogtk = 0;
 int box64_novulkan = 0;
 int box64_showsegv = 0;
+int box64_showbt = 0;
 char* libGL = NULL;
 uintptr_t fmod_smc_start = 0;
 uintptr_t fmod_smc_end = 0;
@@ -632,6 +633,15 @@ void LoadLogEnv()
         if(box64_showsegv)
             printf_log(LOG_INFO, "Show Segfault signal even if a signal handler is present\n");
     }
+    p = getenv("BOX64_SHOWBT");
+        if(p) {
+        if(strlen(p)==1) {
+            if(p[0]>='0' && p[0]<='0'+1)
+                box64_showbt = p[0]-'0';
+        }
+        if(box64_showbt)
+            printf_log(LOG_INFO, "Show a Backtrace when a Segfault signal is caught\n");
+    }
     box64_pagesize = sysconf(_SC_PAGESIZE);
     if(!box64_pagesize)
         box64_pagesize = 4096;
@@ -1053,9 +1063,6 @@ int main(int argc, const char **argv, char **env) {
         exit(0);
     }
 
-    // init random seed
-    srandom(time(NULL));
-
     // check BOX64_LOG debug level
     LoadLogEnv();
     char* bashpath = NULL;