You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logger.debug("add dref from 0x%x to 0x%x: %s"% (line.ea, address, str(result)))
90
-
line.comments.repeat=safe_name(address)
91
-
92
-
prev=line
36
+
defsafe_name(address):
37
+
name=sark.Line(address).name
38
+
ifnameisNoneorname==''orname[0:4] =='unk_':
39
+
return"0x%x"%address
40
+
else:
41
+
return"%s"%name
93
42
94
43
defdref_range_fixer(startEA, endEA):
95
44
forlineinsark.lines(startEA, endEA):
96
45
forxrefinline.xrefs_to:
97
46
ifxref.iscodeorxref.frm==idc.BADADDRorstr(xref.type) !='Data_Text': # only try to fix data references from code in ROM of the Data_Text type (as created by the dumb seq xref routine above)
98
47
continue
99
48
logger.debug("fixing xref (type:%s) to %s from ROM:%x"% (xref.type, safe_name(line.ea), xref.frm))
print("data xrefs (drefs) added for all sequential loads of the bytes 16-bit addresses into RAM.\nIf any lines are renamed in the RAM segment, then the drefs can be fixed by running dref_fixer() on a selection of ram addresses or dref_all_fixer() to perform this operation over all of the RAM segment.")
60
+
defavr_dumb_seq_load_xrefs(startEA, endEA):
61
+
prev=None
62
+
forlineinsark.lines(startEA, endEA):
63
+
ifprevisNone:
64
+
prev=line
65
+
continue
66
+
67
+
try:
68
+
curr_insn=line.insn
69
+
prev_insn=prev.insn
70
+
exceptsark.exceptions.SarkNoInstruction:
71
+
logger.debug("skipping @ 0x%x"%line.ea)
72
+
prev=line
73
+
continue
74
+
75
+
if (len(prev_insn.operands) !=2orlen(curr_insn.operands) !=2or
print("some utility functions are defined. run\nall_avr_dumb_seq_load_xrefs() to define data xrefs (drefs) for all sequential loads of the bytes 16-bit addresses into RAM throughout the whole binary,\nall_avr_dumb_seq_load_xrefs_here() for the current function and\navr_dumb_seq_load_xrefs(startEA, endEA) for a custom range\nIf any lines are renamed in the RAM segment, then the drefs can be fixed by running dref_fixer() on a selection of ram addresses or dref_all_fixer() to perform this operation over all of the RAM segment.")
0 commit comments