[Lldb-commits] [lldb] [LLDB] Support exception breakpoints for plugin-provided languages (PR #97675)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 09:49:43 PDT 2024


jimingham wrote:

> CommandObjectBreakpoint has a harcoded list of languages for which exception breakpoints can be enabled. I'm making this a bit more generic so that my Mojo plugin can get this feature. Basically, I'm adding a new overridable method `Language::SupportsExceptionBreakpoints` that can be used by language plugins to determine whether they support this feature or not. This method is used in addition to the hardcoded list and, as an example, I'm using it for the ObjC language support.
> 
> Another route is simply to avoid doing the check that it's being done right now and simply try to the create the exception breakpoint for whatever language that is not in the hardcoded list. I'm happy to do that if the reviewers think it's a good idea.
> 
> As a note, the other possible place for adding this `SupportsExceptionBreakpoints` method is in `LanguageRuntime`. However, accessing it requires having a process, which is not always the case when invoking the `breakpoint set -E` command. The process might not be alive yet, so `Language` is a good second place for this.
> 

Exception Breakpoints are created by the static method LanguageRuntime::CreateExceptionBreakpoint.  So they don't require a process.  Exception breakpoint resolvers can be "resolver discovering resolvers".  This used to be necessary when there were two ObjC runtimes possible on MacOS X, and you couldn't necessarily tell which one was going to be used till the program till it ran.  So they are able to adjust themselves when their Target launches a process.

It's a little awkward to have a static method in LanguageRuntime that makes the Exception breakpoint conditioned by a Language method 'SupportsExceptionBreakpoint".

> And as a final note, I don't want to make this `SupportsExceptionBreakpoints` complicated. I'm keeping it as simple as possible because it can easily evolve as it's not part of the public API.



https://github.com/llvm/llvm-project/pull/97675


More information about the lldb-commits mailing list