Skip to content
Snippets Groups Projects
Commit 7db14102 authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

more permissive switch detection for arm.

Former-commit-id: ee9fd233519e8352be75cb8cc1f830352e8dc9fe
parent 3b88b310
No related branches found
No related tags found
No related merge requests found
...@@ -802,22 +802,48 @@ notes: ...@@ -802,22 +802,48 @@ notes:
cout << "\tEntry #"<<dec<<target_count<<"= ent-addr="<<hex<<entry_address cout << "\tEntry #"<<dec<<target_count<<"= ent-addr="<<hex<<entry_address
<< " ent="<<hex<<+table_entry // print as int, not char. << " ent="<<hex<<+table_entry // print as int, not char.
<< " ibta="<<candidate_ibta<<endl; << " ibta="<<candidate_ibta;
// stop if we failed to find an instruction, // stop if we failed to find an instruction,
// or find an instruction outside the function // or find an instruction outside the function
if( ibtarget == nullptr || ibtarget->GetFunction()!=i10_func ) if( ibtarget == nullptr )
{
cout<<" -- no target insn!"<<endl;
break; break;
}
const auto ibtarget_func=ibtarget->GetFunction();
if( i10_func == nullptr )
{
// finding switch in non-function is OK.
}
else if(ibtarget_func == nullptr )
{
// finding target in non-function is OK
}
else if( i10_func != ibtarget_func )
{
// finding switch in function to different function, not ok.
cout<<" -- switch to diff func? No."<<endl;
}
// record that we found something that looks valid-enough to try to pin // record that we found something that looks valid-enough to try to pin
// stop if we couldn't pin. // stop if we couldn't pin.
if(!possible_target(candidate_ibta,entry_address,prov)) if(!possible_target(candidate_ibta,entry_address,prov))
{
cout<<" -- not possible target!"<<endl;
break; break;
}
cout<<" -- valid target!"<<endl;
targets.insert(candidate_ibta); targets.insert(candidate_ibta);
// this was running away when looking for byte-entries. occasionally there is no // this was running away when looking for byte-entries. occasionally there is no
// byte offset that's not a valid instructoin, and we run until the end of the section. // byte offset that's not a valid instructoin, and we run until the end of the section.
if(target_count> 1024) break; if(target_count> 1024)
{
cout<<"Caution, exiting loop after 1024 valid entries."<<endl;
break;
}
} }
cout << "\tUnique target count="<<dec<<targets.size()<<endl; cout << "\tUnique target count="<<dec<<targets.size()<<endl;
return target_count>1; return target_count>1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment