JDevlieghere wrote:

The more I think about it, the less I like the idea of using `LLDBLog` in 
`lldb-dap`. Initially, I liked the idea of reusing our existing logging 
implementation, although I have expressed my concern about relying on `liblldb` 
in other PRs. But the issues and workarounds we're talking about here sound to 
me like signs that we're taking it too far.

I think if we want to do this right, we have two options, and they're both 
pretty drastic:

1. We expose `LLDBLog` from the SB API. This is something that has come up in 
the past in the context of people writing LLDB scripts. Similar to exposing the 
ability to generate progress events from the SB API, I think we need to be 
careful about this and clearly distinguish between unvetted logs, coming from 
scripts and vetted logs, coming from LLDB itself. 
2. We give up on trying to build lldb-dap on top the SB API and move the DAP 
functionality into liblldb, allowing us to use `lldb_private` and exposing a 
simple interface that gets set up in the `lldb-dap` binary, similar to the 
command line driver. On the one hand I think it'd be sad to give up on building 
on top of the SB API. I always liked the idea that in theory, you could use 
`lldb-dap` with a different version of `liblldb`. In practice, I don't know if 
anyone does. We've already been cheating in that regard but we've gotten away 
with it because of static linking and I have a feeling this is the direction 
we'll likely keep on going. It's just too hard to pass up on reusing existing 
functionality. 

There is of course the third option which is designing a dedicated logging 
framework for `lldb-dap`. Although `LLDBLog` has is upsides, it also has its 
drawbacks, most notably that everything is global. If you change something in 
one `(SB)Debugger` instance, it is reflected in all the other ones. We'd have a 
similar problem for `lldb-dap` where someone changing the logging settings in 
one instance will affect all instances in the same process, which will be 
especially problematic in server mode.  

https://github.com/llvm/llvm-project/pull/129294
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to