mirror-llvm-project/lldb/source/Plugins
Med Ismail Bennani 1ac9b999f8
[lldb] Reimplement PythonCallable::GetArgInfo without executing Python code (#213378)
`b05a5d0a` added an arity-trimming step to the shared
`ScriptedPythonInterface::Dispatch`: extensions are now allowed to
define methods with trailing parameters as optional
(`num_children(self)` vs. `num_children(self, max_count)`), so before
calling into a method, `Dispatch` needs to know how many positional
arguments it actually accepts and drop any trailing ones we'd otherwise
pass.

That check calls `PythonCallable::GetArgInfo`, which ran a whole
embedded Python script through `inspect.signature` on every call, since
every scripted-extension dispatch goes through it.

For the common case `GetArgInfo()` actually needs to handle fast (plain
Python functions/methods, classes used as constructors, and callable
instances defining `__call__`, i.e. everything `Dispatch<T>()` and
`CreatePluginObject()` ever pass it), the answer is available as plain
data attributes, with no Python bytecode execution required:
`__func__`/`__self__` to unwrap bound methods, and `__code__`'s
`co_argcount`/`co_flags` for the actual positional-argument count and
varargs bit. For a class, that means `__init__` -- except a class may
customize `__new__` instead and leave `__init__` untouched, in which
case `object.__init__` becomes lenient about extra arguments.

Anything else still lacking `__code__` can fall back to the original
`inspect.signature()`-based implementation, now exposed as
`PythonCallable::GetArgInfoFromInspectSignature()` so it can be used
separately.

rdar://183776556

---------

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-08-01 16:23:21 -07:00
..
ABI [lldb][RISCV] Fix x8 register aliasing for gdb-remote targets (#209070) 2026-07-21 10:16:59 +08:00
Architecture [lldb] Skip the WebAssembly function header when setting a breakpoint (#211289) 2026-07-23 13:04:34 -05:00
BugReporter [lldb] Ask the reporter what happened in a bug report (#213173) 2026-07-30 17:59:44 -07:00
Disassembler [lldb] Don't build an opcode from a failed disassembly (#208279) 2026-07-13 12:53:40 +01:00
DynamicLoader Fix ProcessELFCore::GetProcessInfo() to return expected results. (#210807) 2026-07-23 14:24:08 -04:00
ExpressionParser Reapply "Make result variables obey their dynamic values in subsequent expressions" (#211321) (#213308) 2026-07-31 11:13:06 -07:00
Highlighter [lldb] Use C linkage for plugin initialization & termination (#182406) 2026-02-19 18:48:31 -08:00
Instruction [lldb] Use Expected in BreakpointLocationPredictor (#197730) 2026-05-15 07:19:51 +00:00
InstrumentationRuntime [lldb] Remove ConstString getters from FileSpec (#206802) 2026-06-30 14:44:20 -07:00
JITLoader [LLDB][Docs] List available settings (#168245) 2026-04-14 20:25:04 +02:00
Language [lldb] Stop creating ConstStrings for ObjC framework type names (#211679) 2026-07-28 13:49:42 -07:00
LanguageRuntime If the address of the isa_pointer is returned as an error don't ask if it is a tagged pointer (#213163) 2026-07-30 16:28:53 -07:00
MemoryHistory [lldb] Fix source line annotations for libsanitizers traces (#154247) 2025-08-20 14:33:27 -07:00
ObjectContainer Revert "[lldb] Remove ConstString from FileSpec" (#211927) 2026-07-24 21:24:12 +00:00
ObjectFile [lldb][minidump] Fix Memory64List DataSize over-counting on a failed read (#212861) 2026-07-30 13:23:02 -06:00
OperatingSystem [lldb/Interpreter] Surface Python exceptions from scripted extensions (#198153) 2026-07-31 17:51:12 -07:00
Platform [lldb][Windows] Improve error messages in PlatformWindows.cpp (#213011) 2026-08-01 18:03:40 +02:00
Process [lldb] Bound a WebAssembly backtrace by the target's maximum depth (#213397) 2026-07-31 21:44:20 -07:00
Protocol [lldb-mcp] Run managed debug sessions synchronously (#212681) 2026-07-29 11:13:00 -07:00
RegisterTypeBuilder [lldb] Move RegisterFlags from Target to Utility (#206861) 2026-07-01 18:30:32 +00:00
REPL [LLDB] Move Itanium language runtime to C++ language runtime (#169225) 2026-03-07 20:35:25 +01:00
ScriptInterpreter [lldb] Reimplement PythonCallable::GetArgInfo without executing Python code (#213378) 2026-08-01 16:23:21 -07:00
StructuredData [lldb] Make CommandObject::GetTarget filter out the dummy target (#198429) 2026-05-19 09:37:13 -07:00
SymbolFile [lldb] Make missing DWO diagnostics customizable (#212338) 2026-07-30 10:51:49 -07:00
SymbolLocator [lldb] Fix tsan error in SymbolLocatorDebugSymbols (#209698) 2026-07-17 08:14:43 +01:00
SymbolVendor [lldb] Remove ConstString getters from FileSpec (#206802) 2026-06-30 14:44:20 -07:00
SyntheticFrameProvider [lldb/Interpreter] Plumb ScriptedMetadata through scripted plugin CreatePluginObject (NFC) (#198425) 2026-05-20 13:07:31 -07:00
SystemRuntime [lldb] Scope symbol lookups to specific modules in ObjC/SystemRuntime plugins (#193379) 2026-04-22 11:19:38 -07:00
Trace [lldb] Fix build after FileSpec::GetDirectory() ConstString removal (#207073) 2026-07-02 11:58:47 +02:00
TraceExporter [lldb][docs] Remove image links from trace doc (#210664) 2026-07-20 09:42:24 +01:00
TypeSystem [BoundsSafety] Introduce LateParsedAttrType AST placeholder type (#204125) 2026-07-23 11:44:49 -07:00
UnwindAssembly [lldb] Don't read live memory for assembly inst emulation (#197601) 2026-05-13 20:17:00 -07:00
CMakeLists.txt [lldb] Add a BugReporter plugin type and "diagnostics report" (#206578) 2026-06-29 14:44:17 -07:00
Plugins.def.in