[Lldb-commits] [lldb] 5bf42d3 - [lldb] Fix ubsan violation with plugin loading (#126652)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 11 08:04:57 PST 2025
Author: Keith Smiley
Date: 2025-02-11T08:04:51-08:00
New Revision: 5bf42d3e2e83344db14fc0e33623840c53cebfc4
URL: https://github.com/llvm/llvm-project/commit/5bf42d3e2e83344db14fc0e33623840c53cebfc4
DIFF: https://github.com/llvm/llvm-project/commit/5bf42d3e2e83344db14fc0e33623840c53cebfc4.diff
LOG: [lldb] Fix ubsan violation with plugin loading (#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
```
Added:
Modified:
lldb/source/API/SBDebugger.cpp
Removed:
################################################################################
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