[Lldb-commits] [lldb] [lldb] Fix ubsan violation with plugin loading (PR #126652)
Keith Smiley via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 10 18:08:29 PST 2025
https://github.com/keith created https://github.com/llvm/llvm-project/pull/126652
This typedef doesn't match the signature below, specifically the signature takes a `lldb:SBDebugger` vs this was defined as `lldb:SBDebugger&`.
```
lldb/source/API/SBDebugger.cpp:199:13: runtime error: call to function lldb::PluginInitialize(lldb::SBDebugger) through pointer to incorrect function type 'bool (*)(lldb::SBDebugger &)'
.../CustomPlugin.cpp:134: note: lldb::PluginInitialize(lldb::SBDebugger) defined here
```
>From 52cdc7332d58157e4bc10ebb66ea93c17f052c5f Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Tue, 11 Feb 2025 02:06:36 +0000
Subject: [PATCH] [lldb] Fix ubsan violation with plugin loading
This typedef doesn't match the signature below, specifically the
signature takes a `lldb:SBDebugger` vs this was defined as
`lldb:SBDebugger&`.
```
lldb/source/API/SBDebugger.cpp:199:13: runtime error: call to function lldb::PluginInitialize(lldb::SBDebugger) through pointer to incorrect function type 'bool (*)(lldb::SBDebugger &)'
.../CustomPlugin.cpp:134: note: lldb::PluginInitialize(lldb::SBDebugger) defined here
```
---
lldb/source/API/SBDebugger.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 4e6b22492a0d1c2..bdb8e538b99f861 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -185,7 +185,7 @@ lldb::SBError SBDebugger::InitializeWithErrorHandling() {
llvm::sys::DynamicLibrary dynlib =
llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
if (dynlib.isValid()) {
- typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger & debugger);
+ typedef bool (*LLDBCommandPluginInit)(lldb::SBDebugger debugger);
lldb::SBDebugger debugger_sb(debugger_sp);
// This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger)
More information about the lldb-commits
mailing list