about summary refs log tree commit diff stats
path: root/src/core.c
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-22 17:29:21 +0800
committerGitHub <noreply@github.com>2025-01-22 10:29:21 +0100
commit89dcd2566bfa1ef93e740b568cbc3aa5c5409aa4 (patch)
treeaf3e95e694fb620ccb2d955a74a0aab0ad14c29e /src/core.c
parent314edea645acacf03930af17aa01783ca735306a (diff)
downloadbox64-89dcd2566bfa1ef93e740b568cbc3aa5c5409aa4.tar.gz
box64-89dcd2566bfa1ef93e740b568cbc3aa5c5409aa4.zip
Fixed various issues introduced in the env infra refactor (#2281)
* Open trace file again after apply env files

* dynrec_df=1 by default

* more fixes

* more fixes

* more
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/core.c b/src/core.c
index 08343c66..313cac88 100644
--- a/src/core.c
+++ b/src/core.c
@@ -117,9 +117,9 @@ FILE* ftrace = NULL;
 char* ftrace_name = NULL;
 int ftrace_has_pid = 0;
 
-void openFTrace(const char* newtrace, int reopen)
+void openFTrace(int reopen)
 {
-    const char* p = newtrace?newtrace:BOX64ENV(trace_file);
+    const char* p = BOX64ENV(trace_file);
     #ifndef MAX_PATH
     #define MAX_PATH 4096
     #endif
@@ -217,7 +217,7 @@ void my_prepare_fork()
 void my_parent_fork()
 {
     if (ftrace_has_pid) {
-        openFTrace(NULL, 1);
+        openFTrace(1);
         printf_log(LOG_INFO, "%04d|Reopened trace file of %s at parent\n", GetTID(), GetLastApplyEntryName());
     }
 }
@@ -225,7 +225,7 @@ void my_parent_fork()
 void my_child_fork()
 {
     if (ftrace_has_pid) {
-        openFTrace(NULL, 0);
+        openFTrace(0);
         printf_log(LOG_INFO, "%04d|Created trace file of %s at child\n", GetTID(), GetLastApplyEntryName());
     }
 }
@@ -435,8 +435,7 @@ void computeRDTSC()
 
 static void displayMiscInfo()
 {
-    // grab BOX64ENV(trace_file), and change %pid to actual pid is present in the name
-    openFTrace(NULL, 0);
+    openFTrace(0);
 
     if ((BOX64ENV(nobanner) || BOX64ENV(log)) && ftrace==stdout)
         box64_stdout_no_w = 1;
@@ -538,23 +537,6 @@ void PrintHelp() {
     printf("    '-h'|'--help' to print this and quit\n");
 }
 
-void addNewEnvVar(const char* s)
-{
-    if(!s)
-        return;
-    char* p = box_strdup(s);
-    char* e = strchr(p, '=');
-    if(!e) {
-        printf_log(LOG_INFO, "Invalid specific env. var. '%s'\n", s);
-        box_free(p);
-        return;
-    }
-    *e='\0';
-    ++e;
-    setenv(p, e, 1);
-    box_free(p);
-}
-
 static void addLibPaths(box64context_t* context)
 {
     if(BOX64ENV(emulated_libs)) {
@@ -1155,6 +1137,7 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf
         ApplyEnvFileEntry(wine_prog);
         wine_prog = NULL;
     }
+    openFTrace(0);
     PrintEnvVariables();
 
     for(int i=1; i<my_context->argc; ++i) {