[lldb-dev] lldb-mi doesn't propagate host environment variables

k.baladurin via lldb-dev lldb-dev at lists.llvm.org
Fri Jun 29 05:03:11 PDT 2018


Hello!

lldb-mi doesn't propagate host environment variables while lldb does it:

$ cat env.c
#include <stdio.h>
#include <stdlib.h>

int main()
{
     printf("VAR = %s\n", getenv("VAR"));
     return 0;
}
$ gcc env.c -o env
$ /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb -v
lldb version 7.0.0
$ VAR=1 /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb env
(lldb) target create "env"
Current executable set to 'env' (x86_64).
(lldb) r
Process 13139 launched: '/home/kbaladurin/Desktop/tests/env' (x86_64)
VAR = 1
Process 13139 exited with status = 0 (0x00000000)
(lldb) ^D
$ VAR=1 /home/kbaladurin/Downloads/llvm-x64-7.0/bin/lldb-mi
(gdb)
-file-exec-and-symbols env
^done
(gdb)
=library-loaded,id="/home/kbaladurin/Desktop/tests/env",target-name="/home/kbaladurin/Desktop/tests/env",host-name="/home/kbaladurin/Desktop/tests/env",symbols-loaded="0",loaded_addr="-",size="0"
-exec-run
^running
=thread-group-started,id="i1",pid="13176"
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
=library-loaded,id="/lib/x86_64-linux-gnu/ld-2.23.so",target-name="/lib/x86_64-linux-gnu/ld-2.23.so",host-name="/lib/x86_64-linux-gnu/ld-2.23.so",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/ld-2.23.so",loaded_addr="-",size="0"
(gdb)
=library-loaded,id="[vdso]",target-name="[vdso]",host-name="[vdso]",symbols-loaded="1",symbols-path="",loaded_addr="0x00007ffff7ffa000",size="0"
(gdb)
=library-loaded,id="/home/kbaladurin/Desktop/tests/env",target-name="/home/kbaladurin/Desktop/tests/env",host-name="/home/kbaladurin/Desktop/tests/env",symbols-loaded="0",loaded_addr="-",size="0"
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so",loaded_addr="-",size="0"
(gdb)
=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="1",symbols-path="/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so",loaded_addr="-",size="0"
@"VAR = (null)\r\n"
(gdb)
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
(gdb)

Is it expected behavior?

Thank you!

BR,
Konstantin Baladurin



More information about the lldb-dev mailing list