[Lldb-commits] [PATCH] D92249: [LLDB/Python] Fix segfault on Python scripted breakpoints

Pedro Tammela via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 27 15:12:56 PST 2020


tammela created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
tammela requested review of this revision.
Herald added a subscriber: JDevlieghere.

The code that calls into the ScriptInterpreter was not considering the
case that it receives a Lua interpreter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92249

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test


Index: lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test
@@ -0,0 +1,8 @@
+# REQUIRES: python
+# UNSUPPORTED: lldb-repro
+#
+# RUN: cat %s | %lldb --script-language lua 2>&1 | FileCheck %s
+b main
+breakpoint command add -s python -o 'print(frame); return False'
+run
+# CHECK: frame #0
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Host/Config.h"
+#include "lldb/lldb-enumerations.h"
 
 #if LLDB_ENABLE_PYTHON
 
@@ -2274,7 +2275,8 @@
     return true;
 
   Debugger &debugger = target->GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
+  ScriptInterpreter *script_interpreter =
+      debugger.GetScriptInterpreter(true, eScriptLanguagePython);
   ScriptInterpreterPythonImpl *python_interpreter =
       (ScriptInterpreterPythonImpl *)script_interpreter;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92249.308120.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201127/0939001a/attachment.bin>


More information about the lldb-commits mailing list