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

Function generateDescriptionByAddress

lldb_commands/disassemble.py:169–195  ·  view source on GitHub ↗
(addr, target)

Source from the content-addressed store, hash-verified

167
168
169def generateDescriptionByAddress(addr, target):
170 section = addr.section
171 name = ''
172 retDescription = ''
173 loadAddr = hex(addr.GetLoadAddress(target))
174 while section:
175 name = '.' + section.name + name
176 section = section.GetParent()
177
178 # return name +'lkjlkj'
179 if '__DATA.__objc_selrefs' in name:
180 string = str(target.EvaluateExpression('*(char **)' + loadAddr))
181 if len(string.split('"')) > 1:
182 return (False, '"' + string.split('"')[1] + '"')
183 elif '__DATA.__objc_classrefs' in name:
184 idType = ds.getType('id')
185 sbval = target.CreateValueFromAddress('hi', addr, idType)
186 return (False, '(__DATA.__objc_classrefs) {}'.format(sbval.description))
187 elif '__DATA.__cfstring' in name:
188 charType = ds.getType('char*')
189 newAddr = target.ResolveLoadAddress(addr.GetLoadAddress(target) + 0x10) # TODO, do 32 bit
190 sbval = target.CreateValueFromAddress('hi', newAddr, charType)
191 return (False, '(__DATA.__cfstring) {}'.format(sbval.summary))
192
193
194 retDescription += name
195 return (True, loadAddr + ' ' + str(addr.module.file.basename) + retDescription)
196
197
198def generateBranchLines(branches, count, offsetSizeDict):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…