This is an archive of the discontinued LLVM Phabricator instance.

Increase preallocated buffer for scanning the process objc classes
ClosedPublic

Authored by jasonmolenda on Feb 3 2022, 11:29 PM.

Details

Summary

lldb allocates a buffer in the inferior, and runs an expression to fill it with information about all of the classes defined in the objective-c runtime. We don't want to run two expressions for perf reasons, one to find the number of classes, then a second expression to fill in the buffer. (I think we had that code in the past tbh, and went with "this is big enough")

Our class list in some processes is approaching this limit. This patch doubles it. It increases the memory buffer from ~150kb to ~300kb, and it is freed shortly after the expression completes. I also changed the name of the variable to make it easier to understand the nature of the failure if the assert is hit.

Diff Detail

Event Timeline

jasonmolenda requested review of this revision.Feb 3 2022, 11:29 PM
jasonmolenda created this revision.
JDevlieghere accepted this revision.Feb 4 2022, 4:08 PM

LGTM with the nits about the comments.

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
2011

Nit: LLVM coding style says comments need to be proper sentences starting with a capital letter and end with a period.

2100–2101

Same nit

This revision is now accepted and ready to land.Feb 4 2022, 4:08 PM

Update to address Jonas' feedback.