MCPcopy
hub / github.com/DerekSelander/LLDB / getProtocols

Function getProtocols

lldb_commands/ds.py:313–335  ·  view source on GitHub ↗
(section, outputCount)

Source from the content-addressed store, hash-verified

311 return (indeces, stringList)
312
313def getProtocols(section, outputCount):
314 target = getTarget()
315 indeces = []
316 stringList = []
317
318 ptrsize = getType("void*").GetByteSize()
319 sz = section.GetByteSize() / ptrsize
320 addr = section.GetLoadAddress(target)
321 script = "int dssize = {};\nchar *protNames[{}];\nClass *clsPointer = (Class*){};".format(sz, sz, addr)
322 script += r'''
323@import ObjectiveC;
324memset(&protNames, 0, sizeof(protNames));
325for (int i = 0; i < dssize; i++) {
326 protNames[i] = (char*)protocol_getName(clsPointer[i]);
327}
328protNames''&#x27;
329 val = target.EvaluateExpression(script, genExpressionOptions(False, True, True))
330 for i in range(val.GetNumChildren()):
331 x = val.GetChildAtIndex(i)
332 indeces.append(i * ptrsize)
333 stringList.append(x.summary.replace("\"", ""))
334
335 return (indeces, stringList)
336
337def getLINKEDITData(section):
338 addr = section.addr

Callers 1

formatFromDataFunction · 0.85

Calls 3

getTargetFunction · 0.85
getTypeFunction · 0.85
genExpressionOptionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…