The dyninst parsing of binaries can take a significant amount of
memory. On machines without enough memory to parse a large binary we
want the analysis to fail gracefully with a warning that the liveness
analysis was unable to run and continue on rather than immediately
exiting with a std::bad_alloc exception.
Dwarf_Addr addr,
location_context ctx)
{
+ try{
+ // Doing this inside a try/catch because dyninst may require
+ // too much memory to parse the binary.
// should cache the executable names like the other things
analysis func_to_analyze(executable);
MachRegister r;
bool used;
la->query(iloc, LivenessAnalyzer::Before, r, used);
return (used ? 1 : -1);
+ } catch (std::bad_alloc & ex){
+ s.print_warning(_F("unable to allocate memory for liveness analysis of %s",
+ executable.c_str()), e->tok);
+ return 0;
+ }
}
#endif // HAVE_DYNINST