MCPcopy Index your code
hub / github.com/DerekSelander/LLDB / getFunctionsFromSection

Function getFunctionsFromSection

lldb_commands/ds.py:478–512  ·  view source on GitHub ↗
(section, outputCount=0)

Source from the content-addressed store, hash-verified

476 return formatFromData(data, section, outputCount)
477
478def getFunctionsFromSection(section, outputCount=0):
479 target = getTarget()
480 ptrsize = getType("void*").GetByteSize()
481
482 functionList = []
483 indeces = []
484 descriptions = []
485
486 size = section.GetByteSize() / ptrsize
487 baseAddress = section.addr.GetLoadAddress(target)
488
489 script = "uintptr_t retstring[{}];\n".format(size)
490 script += "uintptr_t *baseAddress = (uintptr_t *){};\n".format(baseAddress)
491 script += "int size = {};\n".format(size)
492 script += r'''
493 memset(&retstring, 0, sizeof(retstring));
494
495 for (int i = 0; i < size; i++) {
496 retstring[i] = baseAddress[i];
497 }
498 retstring
499''&#x27;
500 options = genExpressionOptions(False, True, True)
501 val = target.EvaluateExpression(script, options)
502
503 for i, x in enumerate(val):
504 indeces.append(i * ptrsize)
505 descriptions.append("{}".format(hex(x.unsigned)))
506 retval = ""
507 addr = target.ResolveLoadAddress(x.unsigned)
508 if addr.symbol.IsValid():
509 retval += " {}".format(addr.symbol.name)
510 functionList.append(retval)
511
512 return (indeces, functionList, descriptions)
513
514def getObjCSelRefs(section, outputCount):
515 target = getTarget()

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…