llvm-project/lldb/unittests
Pavel Labath 7406d236d8 [lldb/python] Fix (some) dangling pointers in our glue code
This starts to fix the other half of the lifetime problems in this code
-- dangling references. SB objects created on the stack will go away
when the function returns, which is a problem if the python code they
were meant for stashes a reference to them somewhere.  Most of the time
this goes by unnoticed, as the code rarely has a reason to store these,
but in case it does, we shouldn't respond by crashing.

This patch fixes the management for a couple of SB objects (Debugger,
Frame, Thread). The SB objects are now created on the heap, and
their ownership is immediately passed on to SWIG, which will ensure they
are destroyed when the last python reference goes away. I will handle
the other objects in separate patches.

I include one test which demonstrates the lifetime issue for SBDebugger.
Strictly speaking, one should create a test case for each of these
objects and each of the contexts they are being used. That would require
figuring out how to persist (and later access) each of these objects.
Some of those may involve a lot of hoop-jumping (we can run python code
from within a frame-format string). I don't think that is
necessary/worth it since the new wrapper functions make it very hard to
get this wrong.

Differential Revision: https://reviews.llvm.org/D115925
2021-12-20 09:42:08 +01:00
..
API [lldb] Handle missing SBStructuredData copy assignment cases 2021-05-05 15:12:03 -07:00
Breakpoint [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Core [lldb] Add support for demangling D symbols 2021-11-11 11:11:21 +01:00
DataFormatter [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
Disassembler [lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC) 2020-02-17 19:14:01 -08:00
Editline [lldb][NFC] Inclusive language: replace master/slave names for ptys 2021-11-12 10:54:18 -06:00
Expression [llvm][lldb] Remove unused SmallVectorMemoryBuffer.h includes 2021-12-09 11:32:13 +01:00
Host [lldb] [Host/Socket] Make DecodeHostAndPort() return a dedicated struct 2021-10-28 09:57:50 +02:00
Instruction Fix UB in EmulateInstructionARM64.cpp 2020-06-01 18:11:50 -07:00
Interpreter Follow-on to fix a test from c5011aed9c. 2021-10-18 16:53:32 -07:00
Language [lldb] Return StringRef from PluginInterface::GetPluginName 2021-10-18 10:14:42 +02:00
ObjectFile [LLDB][Breakpad] Make lldb understand INLINE and INLINE_ORIGIN records in breakpad. 2021-11-10 11:20:32 -08:00
Platform Update unit test API usage (NFC) 2021-11-29 13:14:35 -08:00
Process Fix buildbot after https://reviews.llvm.org/D115073. 2021-12-07 12:03:45 -08:00
ScriptInterpreter [lldb/python] Fix (some) dangling pointers in our glue code 2021-12-20 09:42:08 +01:00
Signals [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
Symbol Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster. 2021-12-16 09:59:55 -08:00
SymbolFile Remove ConstString from Language, LanguageRuntime, SystemRuntime and SymbolFile plugin names 2021-10-27 08:25:44 +02:00
Target [lldb] Move GetSupportedArchitectureAtIndex to PlatformDarwin 2021-11-24 15:48:23 +01:00
TestingSupport [lldb] [llgs] Support owning and detaching extra processes 2021-04-24 11:08:33 +02:00
Thread [lldb] Return StringRef from PluginInterface::GetPluginName 2021-10-18 10:14:42 +02:00
UnwindAssembly Bug where insn-based unwind plans on arm64 could be wrong 2020-04-14 16:57:25 -07:00
Utility [lldb] Remove reproducer replay functionality 2021-12-17 17:14:52 -08:00
debugserver [lldb] [unittests] Fix TcpListen() call in RNBSocketTest 2021-10-26 21:08:03 +02:00
tools Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo 2021-10-07 11:15:00 +02:00
CMakeLists.txt Re-land "[lldb] Make the API, Shell and Unit tests independent lit test suites" 2021-03-22 14:36:43 -07:00
gtest_common.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00