Michael137 wrote:

> > An alternative discussed was to create a common CLanguageRuntime whose 
> > currentl sole responsibility was to register the VerboseTrapFrameRecognizer 
> > and AssertStackFrameRecognizer. However, making this plugin a fully-fledged 
> > runtime felt wrong because all the LanguageRuntime functionality would live 
> > in the derived C++/ObjC runtime plugins.
> 
> I don't quite follow this. Presumably you'd have
> 
> ```
> class CLanguageRuntime : public LanguageRuntime {
>    // ...
> ```
> What about that design implies you'd have to put the recognizer inside 
> `CPPLanguageRuntime`? Surely it would go in `CLanguageRuntime`? Or do you 
> mean you'd have to add the recognizer to other runtimes too because 
> `__builtin_verbose_trap` is actually supported by 
> C/C++/objective-C/objective-c++ ?

Yea I didn't describe that very well. I meant that it felt off because the 
`CLanguagRuntime` would really just be responsible for calling the frame 
recogniser registration functions. That in itself isn't a big deal, because we 
might be able to extend it to do more work in the future. The main issue really 
was just ensuring that we only register the recognisers once across all runtime 
plugins that share it. We can't just `call_once` on it because we do want the 
recognisers to be re-registered for new targets in the same debugger session. 
If the recognisers were stored in something like a `UniqueVector` in the 
Target, then we wouldn't have that issue. But currently that's not the case, 
and it would take a bit of refactoring to de-dupe the recognisers.

There may very well be solutions I haven't considered, but all the things I've 
tried so far I wasn't very happy with. So in the end I just moved this to the 
C++ runtime for now.

AFAICT the C++ language runtime is always available (even for C targets) if the 
C++ language plugin gets available. Which it should also be unless someone is 
using an LLDB with the C++ plugin compiled out? But at that point numerous 
things wouldn't work when even debugging just C.

https://github.com/llvm/llvm-project/pull/166157
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to