Default for maximum number of instructions

This commit is contained in:
caheckman 2020-03-27 15:55:39 -04:00
parent d9bd93c36b
commit a8dcc7266b
8 changed files with 34 additions and 11 deletions

View file

@ -80,6 +80,7 @@ OptionDatabase::OptionDatabase(Architecture *g)
registerOption(new OptionJumpLoad());
registerOption(new OptionToggleRule());
registerOption(new OptionAliasBlock());
registerOption(new OptionMaxInstruction());
}
OptionDatabase::~OptionDatabase(void)
@ -816,3 +817,19 @@ string OptionAliasBlock::apply(Architecture *glb,const string &p1,const string &
return "Alias block level unchanged";
return "Alias block level set to " + p1;
}
string OptionMaxInstruction::apply(Architecture *glb,const string &p1,const string &p2,const string &p3) const
{
if (p1.size() == 0)
throw ParseError("Must specify number of instructions");
int4 newMax = -1;
istringstream s1(p1);
s1.unsetf(ios::dec | ios::hex | ios::oct); // Let user specify base
s1 >> newMax;
if (newMax < 0)
throw ParseError("Bad maxinstruction parameter");
glb->max_instructions = newMax;
return "Maximum instructions per function set";
}