I added an option -jfw which does this in r5134
Thanks.
While working on a completely unsupported dump, I've noticed that an unrecognized function listed in find_generic_funcs() prevents the rest of the functions from being used. Did not go as far as finding the piece of code that does this (the code is rather convoluted), but making add_generic_sig_match() return immediately when the first get_saved_sig_val() fails does seem to help.
edit:
patch below does what I wrote above plus fixes two possible memory leaks
Index: tools/finsig_thumb2.c
===================================================================
--- tools/finsig_thumb2.c (revision 5136)
+++ tools/finsig_thumb2.c (working copy)
@@ -663,10 +663,12 @@
int k;
char *s = n;
+ int mallocd = 0;
if (suffix != 0)
{
s = malloc(strlen(n) + strlen(suffix) + 1);
sprintf(s, "%s%s", n, suffix);
+ mallocd = 1;
}
for (k=0; sig_names[k].name != 0; k++)
@@ -677,10 +679,14 @@
{
sig_names[k].val = eadr;
sig_names[k].flags |= EV_MATCH;
+ if (mallocd)
+ free(s);
return;
}
else if (sig_names[k].val == eadr) // same name, same address
{
+ if (mallocd)
+ free(s);
return;
}
else // same name, different address
@@ -2687,6 +2693,7 @@
for(i=1; i<=64; i++) {
if (!disasm_iter(fw,is)) {
+ free(blobs);
return 0;
}
if (is->insn->id == ARM_INS_LDR && is->insn->detail->arm.operands[1].type == ARM_OP_MEM) {
@@ -4228,6 +4235,7 @@
uint32_t adr=get_saved_sig_val(name);
if(!adr) {
printf("add_generic_sig_match: missing %s\n",name);
+ return;
}
add_generic_func_match(match_fns,match_fn_count,MAX_GENERIC_FUNCS,fn,adr);
char veneer[128];