aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectBreakpoint.cpp
diff options
context:
space:
mode:
authorWalter Erquinigo <a20012251@gmail.com>2024-07-04 10:05:01 -0400
committerGitHub <noreply@github.com>2024-07-04 10:05:01 -0400
commit94a067a306fecceac913cc6d9bfdcd49464358ec (patch)
treeedf2ae92c9f76692ea80eca713563c0601a96c3a /lldb/source/Commands/CommandObjectBreakpoint.cpp
parentb12449fb289708f3d31c107d6e7977044a01da62 (diff)
downloadllvm-94a067a306fecceac913cc6d9bfdcd49464358ec.zip
llvm-94a067a306fecceac913cc6d9bfdcd49464358ec.tar.gz
llvm-94a067a306fecceac913cc6d9bfdcd49464358ec.tar.bz2
[LLDB] Support exception breakpoints for plugin-provided languages (#97675)
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. 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.
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index cd4c779..a5fe927 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -308,9 +308,6 @@ public:
case eLanguageTypeC_plus_plus_14:
m_exception_language = eLanguageTypeC_plus_plus;
break;
- case eLanguageTypeObjC:
- m_exception_language = eLanguageTypeObjC;
- break;
case eLanguageTypeObjC_plus_plus:
error_context =
"Set exception breakpoints separately for c++ and objective-c";
@@ -319,6 +316,12 @@ public:
error_context = "Unknown language type for exception breakpoint";
break;
default:
+ if (Language *languagePlugin = Language::FindPlugin(language)) {
+ if (languagePlugin->SupportsExceptionBreakpoints()) {
+ m_exception_language = language;
+ break;
+ }
+ }
error_context = "Unsupported language type for exception breakpoint";
}
if (!error_context.empty())