Index: lldb/lit/Host/Inputs/simple.c =================================================================== --- /dev/null +++ lldb/lit/Host/Inputs/simple.c @@ -0,0 +1 @@ +int main(int argc, char const *argv[]) { return 0; } Index: lldb/lit/Host/TestCustomShell.test =================================================================== --- /dev/null +++ lldb/lit/Host/TestCustomShell.test @@ -0,0 +1,5 @@ +# UNSUPPORTED: system-windows + +# RUN: %clang %S/Inputs/simple.c -g -o %t.out +# RUN: SHELL=bogus %lldb %t.out -b -o 'run' 2>&1 | FileCheck %s +# CHECK: error: shell expansion failed Index: lldb/source/Host/posix/HostInfoPosix.cpp =================================================================== --- lldb/source/Host/posix/HostInfoPosix.cpp +++ lldb/source/Host/posix/HostInfoPosix.cpp @@ -113,7 +113,13 @@ uint32_t HostInfoPosix::GetEffectiveGroupID() { return getegid(); } -FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh"); } +FileSpec HostInfoPosix::GetDefaultShell() { + if (const char *v = ::getenv("SHELL")) + return FileSpec(v); + if (const char *v = ::getpwuid(::geteuid())->pw_shell) + return FileSpec(v); + return FileSpec("/bin/sh"); +} bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) { return ComputePathRelativeToLibrary(file_spec, "/bin");