When LLDB Python bindings are used and stack backtraces are enabled
for logging, getMainExecutable() is called with argv0 being null.
This caused the fallback function getprogpath() (used on FreeBSD, NetBSD
and Linux) to segfault. Make it handle null executable name gracefully.
Differential Revision: https://reviews.llvm.org/D91012
# Enable all log options and check that nothing crashes.
@skipIfWindows
- # TODO: figure out why it segfaults
- @skipIfFreeBSD
def test_all_log_options(self):
if (os.path.exists(self.log_file)):
os.remove(self.log_file)
static char *
getprogpath(char ret[PATH_MAX], const char *bin)
{
+ if (bin == nullptr)
+ return nullptr;
+
/* First approach: absolute path. */
if (bin[0] == '/') {
if (test_dir(ret, "/", bin) == 0)