Issue |
159498
|
Summary |
[lldb-dap] Running in server mode does not propagate environment variables
|
Labels |
new issue
|
Assignees |
|
Reporter |
mateusz-plociennik
|
### 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`
```json
{
"lldb-dap.serverMode": true,
"lldb-dap.executable-path": "/opt/homebrew/opt/llvm/bin/lldb-dap"
}
```
---
### Minimal Reproducible Example
main.cpp
```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
1. Enable `lldb-dap.serverMode` in `settings.json`.
2. Debug the provided `main.cpp` with `lldb-dap`.
3. 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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs