Added lldb option to JITGDB

This commit is contained in:
ptitSeb 2023-12-15 13:19:03 +01:00
parent 57c1ed7118
commit b7dccd065f
4 changed files with 6 additions and 3 deletions

View File

@ -324,6 +324,7 @@ Will use yyyy as x86_64 interpretor, to launch x64_64 binaries
* 2 : Launch `gdbserver` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process, and go in an endless loop, waiting.
Use `gdb /PATH/TO/box86` and then `target remote 127.0.0.1:1234` to connect to the gdbserver (or use actual IP if not on the machine). After that, the procedure is the same as with ` BOX86_JITGDB=1`.
This mode can be usefullwhen programs redirect all console output to a file (like Unity3D Games)
* 3 : Launch `lldb` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process and go in an endless loop, waiting.
#### BOX86_NORCFILES
If the env var exist, no rc files (like /etc/box86.box86rc and ~/.box86rc) will be loaded

View File

@ -1016,6 +1016,8 @@ exit(-1);
sprintf(myarg, "%d", pid);
if(jit_gdb==2)
execlp("gdbserver", "gdbserver", "127.0.0.1:1234", "--attach", myarg, (char*)NULL);
else if(jit_gdb==3)
execlp("lldb", "lldb", "-p", myarg, (char*)NULL);
else
execlp("gdb", "gdb", "-pid", myarg, (char*)NULL);
exit(-1);

View File

@ -741,11 +741,11 @@ void LoadLogEnv()
p = getenv("BOX86_JITGDB");
if(p) {
if(strlen(p)==1) {
if(p[0]>='0' && p[0]<='0'+2)
if(p[0]>='0' && p[0]<='0'+3)
jit_gdb = p[0]-'0';
}
if(jit_gdb)
printf_log(LOG_INFO, "Launch %s on segfault\n", (jit_gdb==2)?"gdbserver":"gdb");
printf_log(LOG_INFO, "Launch %s on segfault\n", (jit_gdb==2)?"gdbserver":((jit_gdb==3)?"lldb":"gdb"));
}
p = getenv("BOX86_SHOWSEGV");
if(p) {

View File

@ -47,7 +47,7 @@ ENTRYBOOL(BOX86_NOVULKAN, box86_novulkan) \
ENTRYBOOL(BOX86_FUTEX_WAITV, box86_futex_waitv) \
ENTRYBOOL(BOX86_FIX_64BIT_INODES, fix_64bit_inodes) \
ENTRYSTRING_(BOX86_BASH, bash) \
ENTRYINT(BOX86_JITGDB, jit_gdb, 0, 2, 2) \
ENTRYINT(BOX86_JITGDB, jit_gdb, 0, 3, 2) \
ENTRYSTRING_(BOX86_BOX64, box64) \
ENTRYSTRING_(BOX86_LD_PRELOAD, ld_preload) \
ENTRYBOOL(BOX86_NOSANDBOX, box86_nosandbox) \