-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
Description
Description
When debugging a program that uses std::getenv()
with lldb-dap
running in server mode,
the call to std::getenv("HOME")
unexpectedly returns nullptr
.
Environment
- VS Code version: 1.103.2
- Extension version: 0.2.16
- lldb-dap version: 21.1.1
- OS version: macOS 15.6.1 (24G90)
settings.json
{
"lldb-dap.serverMode": true,
"lldb-dap.executable-path": "/opt/homebrew/opt/llvm/bin/lldb-dap"
}
Minimal Reproducible Example
main.cpp
#include <cstdlib>
#include <filesystem>
#include <iostream>
#include <stdexcept>
std::filesystem::path getUserHomeFolder()
{
if (const char* home = std::getenv("HOME"))
return home;
throw std::runtime_error("Could not determine user home directory");
}
int main()
{
std::cout << getUserHomeFolder() << "\n";
return 0;
}
Steps to Reproduce
- Enable
lldb-dap.serverMode
insettings.json
. - Debug the provided
main.cpp
withlldb-dap
. - Observe the result of
std::getenv("HOME")
.
Expected Behavior
std::getenv("HOME")
should return the user’s home directory path.
Actual Behavior
std::getenv("HOME")
returns nullptr
instead.