2008年11月4日火曜日

visualizing .asm with graphiviz

このエントリーをブックマークに追加 このエントリーを含むはてなブックマーク
When you are tired, stop coding. Because you are getting no where.
If your head is clear, you get the clear ans.

def graphbuilder(t):
edge_list = []
for proc in t.findall('procedure'):
for frag in proc.findall('fragment'):
for op in frag.findall('op'):
operator = op.get('operator')
operand = op.get('operand')
if operator.startswith('call'):
if operand.startswith('dword'):
call_target = operand.rsplit(' ')[-1][:-1]
else:
call_target = operand
edge_list.append((proc.get('addr'), call_target))
return pydot.graph_from_edges(edge_list, directed=True)

0 件のコメント: