diff options
author | Roy Shi <royitaqi@users.noreply.github.com> | 2025-09-19 14:43:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-19 14:43:37 -0700 |
commit | 1250095b1a21f219b22e2c50b9789e001813627a (patch) | |
tree | f5e0523f82e8c598c13e2661ba88b6f4b022f1af /llvm/lib/Object/ELFObjectFile.cpp | |
parent | fadea8cd1da608fb3c378ab7edc53b7fb2e02c3e (diff) | |
download | llvm-1250095b1a21f219b22e2c50b9789e001813627a.zip llvm-1250095b1a21f219b22e2c50b9789e001813627a.tar.gz llvm-1250095b1a21f219b22e2c50b9789e001813627a.tar.bz2 |
[vscode-lldb] Improve logging in Server Mode (#159672)
A few improvements to logging when lldb-dap is started in **Server
Mode** AND when the **`lldb-dap.logFolder`** setting is used (not
`lldb-dap.log-path`).
### Improvement #1
**Avoid the prompt of restarting the server when starting each debug
session.**
That prompt is caused by the combination of the following facts:
1. The log filename changes every time a new debug session is starting
(see
[here](https://github.com/llvm/llvm-project/blob/9d6062c490548a5e6fea103e010ab3c9bc73a86d/lldb/tools/lldb-dap/src-ts/logging.ts#L47))
2. The log filename is passed to the server via an environment variable
called "LLDBDAP_LOG" (see
[here](https://github.com/llvm/llvm-project/blob/9d6062c490548a5e6fea103e010ab3c9bc73a86d/lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts#L263-L269))
3. All environment variables are put into the "spawn info" variable (see
[here](https://github.com/llvm/llvm-project/blob/9d6062c490548a5e6fea103e010ab3c9bc73a86d/lldb/tools/lldb-dap/src-ts/lldb-dap-server.ts#L170-L172)).
4. The old and new "spawn info" are compared to decide if a prompt
should show (see
[here](https://github.com/llvm/llvm-project/blob/9d6062c490548a5e6fea103e010ab3c9bc73a86d/lldb/tools/lldb-dap/src-ts/lldb-dap-server.ts#L107-L110)).
The fix is to remove the "LLDBDAP_LOG" from the "spawn info" variable,
so that the same server can be reused if the log path is the only thing
that has changed.
### Improvement #2
**Avoid log file conflict when multiple users share a machine and start
server in the same second.**
The problem: If two users start lldb-dap server in the same second, they
will share the same log path. The first user will create the log file.
The second user will find that they cannot access the same file, so
their server will fail to start.
The fix is to add a part of the VS Code session ID to the log filename.
### Improvement #3
**Avoid restarting the server when the order of environment variables
changed.**
This is done by sorting the environment variables before putting them
into the "spawn info".
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions