(start, heap, line)
| 1171 | |
| 1172 | |
| 1173 | def FormatDisasmLine(start, heap, line): |
| 1174 | line_address = start + line[0] |
| 1175 | stack_slot = heap.stack_map.get(line_address) |
| 1176 | marker = " " |
| 1177 | if stack_slot: |
| 1178 | marker = "=>" |
| 1179 | code = AnnotateAddresses(heap, line[1]) |
| 1180 | |
| 1181 | # Compute the actual call target which the disassembler is too stupid |
| 1182 | # to figure out (it adds the call offset to the disassembly offset rather |
| 1183 | # than the absolute instruction address). |
| 1184 | if heap.reader.arch == MD_CPU_ARCHITECTURE_X86: |
| 1185 | if code.startswith("e8"): |
| 1186 | words = code.split() |
| 1187 | if len(words) > 6 and words[5] == "call": |
| 1188 | offset = int(words[4] + words[3] + words[2] + words[1], 16) |
| 1189 | target = (line_address + offset + 5) & 0xFFFFFFFF |
| 1190 | code = code.replace(words[6], "0x%08x" % target) |
| 1191 | # TODO(jkummerow): port this hack to ARM and x64. |
| 1192 | |
| 1193 | return "%s%08x %08x: %s" % (marker, line_address, line[0], code) |
| 1194 | |
| 1195 | |
| 1196 | def AnnotateAddresses(heap, line): |
no test coverage detected
searching dependent graphs…