HomePhabricator

[llvm] [Support] Fix segv if argv0 is null in getMainExecutable()

Authored by mgorny on Nov 7 2020, 1:03 PM.

Description

[llvm] [Support] Fix segv if argv0 is null in getMainExecutable()

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