mirror of
https://github.com/geohot/qira
synced 2025-03-13 10:33:30 +03:00
more robust dwarf handling and better output
This commit is contained in:
parent
60dd7a7a90
commit
ba90d00859
@ -31,10 +31,13 @@ warn = bcolors.WARNING + "[-]" + bcolors.ENDC
|
||||
def get_functions(dwarfinfo):
|
||||
function_starts = set()
|
||||
for cu in dwarfinfo.iter_CUs():
|
||||
for die in cu.iter_DIEs():
|
||||
if die.tag == "DW_TAG_subprogram":
|
||||
if 'DW_AT_low_pc' in die.attributes:
|
||||
function_starts.add(die.attributes['DW_AT_low_pc'].raw_value)
|
||||
try:
|
||||
for die in cu.iter_DIEs():
|
||||
if die.tag == "DW_TAG_subprogram":
|
||||
if 'DW_AT_low_pc' in die.attributes:
|
||||
function_starts.add(die.attributes['DW_AT_low_pc'].raw_value)
|
||||
except:
|
||||
continue
|
||||
return function_starts
|
||||
|
||||
def test_files(fns,quiet=False,profile=False):
|
||||
@ -76,9 +79,16 @@ def test_files(fns,quiet=False,profile=False):
|
||||
if len(missed) == 0:
|
||||
print "{} {}: {} found all {} function(s).".format(ok_green, short_fn, engine, total_fxns)
|
||||
else:
|
||||
fmt = "{} {}: {} missed {}/{} functions: {}."
|
||||
print fmt.format(warn, short_fn, engine,
|
||||
len(missed), total_fxns, ", ".join(hex(fxn) for fxn in missed))
|
||||
if args.verbose:
|
||||
fmt = "{} {}: {} missed {}/{} function(s): {}."
|
||||
missed_s = ", ".join(hex(fxn) for fxn in missed)
|
||||
print fmt.format(warn, short_fn, engine,
|
||||
len(missed), total_fxns, missed_s)
|
||||
else:
|
||||
fmt = "{} {}: {} missed {}/{} function(s)."
|
||||
print fmt.format(warn, short_fn, engine,
|
||||
len(missed), total_fxns)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
#todo: radare and summary screen comparing total performance by engine/arch
|
||||
@ -90,6 +100,8 @@ if __name__ == "__main__":
|
||||
help="don't warn about missing dwarf information")
|
||||
parser.add_argument('--profile',dest="profile",action='store_true',
|
||||
help='use internal profiling, output to prof.png')
|
||||
parser.add_argument('--verbose',dest="verbose",action="store_true",
|
||||
help='show all missed functions')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.files != []:
|
||||
|
Loading…
x
Reference in New Issue
Block a user