about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-12-04 16:22:30 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-12-04 16:22:30 +0100
commit7f22b33f5ad208d3852bc05c43bb806fcf34b63e (patch)
tree4d4f0c93dbafbfc49c3504e3c7c647a1ff8e64ec /src/main.c
parentceaacba1c243892114c685697f28dc746337a071 (diff)
downloadbox64-7f22b33f5ad208d3852bc05c43bb806fcf34b63e.tar.gz
box64-7f22b33f5ad208d3852bc05c43bb806fcf34b63e.zip
[TRACE] Fixed BOX64_TRACE_INIT
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 83348dac..78f46daa 100755
--- a/src/main.c
+++ b/src/main.c
@@ -975,7 +975,10 @@ void setupTraceInit()
             if(s_trace_start || s_trace_end)
                 SetTraceEmu(s_trace_start, s_trace_end);
         } else {
-            if (GetGlobalSymbolStartEnd(my_context->maplib, p, &trace_start, &trace_end, NULL, -1, NULL)) {
+            if (GetGlobalSymbolStartEnd(my_context->maplib, p, &s_trace_start, &s_trace_end, NULL, -1, NULL)) {
+                SetTraceEmu(s_trace_start, s_trace_end);
+                printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)s_trace_start, (void*)s_trace_end);
+            } else if(GetLocalSymbolStartEnd(my_context->maplib, p, &s_trace_start, &s_trace_end, NULL, -1, NULL)) {
                 SetTraceEmu(s_trace_start, s_trace_end);
                 printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)s_trace_start, (void*)s_trace_end);
             } else {
@@ -1555,7 +1558,6 @@ int main(int argc, const char **argv, char **env) {
 
     thread_set_emu(emu);
 
-    setupTraceInit();
     // export symbols
     AddSymbols(my_context->maplib, GetMapSymbols(elf_header), GetWeakSymbols(elf_header), GetLocalSymbols(elf_header), elf_header);
     box64_isglibc234 = GetVersionIndice(elf_header, "GLIBC_2.34")?1:0;
@@ -1599,6 +1601,7 @@ int main(int argc, const char **argv, char **env) {
     // and handle PLT
     RelocateElfPlt(my_context->maplib, NULL, 0, elf_header);
     // defered init
+    setupTraceInit();
     RunDeferedElfInit(emu);
     // update TLS of main elf
     RefreshElfTLS(elf_header);