Skip to content
Snippets Groups Projects
Commit 6086aedc authored by Jason Hiser's avatar Jason Hiser
Browse files

fixed bug where call-site address was used where landing pad address was...

fixed bug where call-site address was used where landing pad address was needed.  resulted in unnecessary mergning of FDE ranges


Former-commit-id: 9728a615a302c64caaece3e2461525e98205d16f
parent 524151c8
Branches
Tags
No related merge requests found
...@@ -37,7 +37,7 @@ class CreateFunctions_t ...@@ -37,7 +37,7 @@ class CreateFunctions_t
{ {
public: public:
Range_t(const Address_t &a, const Address_t &b) : pair<Address_t,Address_t>(a,b) { } Range_t(const Address_t &a, const Address_t &b) : pair<Address_t,Address_t>(a,b) { }
bool contains(const Address_t &c) const { return first <= c && c<=second; } bool contains(const Address_t &c) const { return first <= c && c<second; }
}; };
using RangeSet_t = set<Range_t>; using RangeSet_t = set<Range_t>;
...@@ -48,6 +48,7 @@ class CreateFunctions_t ...@@ -48,6 +48,7 @@ class CreateFunctions_t
csh cshandle; csh cshandle;
ofstream outfile; ofstream outfile;
execlass_t file_class; execlass_t file_class;
friend ostream& operator<<(ostream& os, const CreateFunctions_t::RangeSet_t& rs);
public: public:
CreateFunctions_t(const string &input_pgm, const string &output_annot, const bool p_verbose) CreateFunctions_t(const string &input_pgm, const string &output_annot, const bool p_verbose)
: :
...@@ -235,21 +236,28 @@ class CreateFunctions_t ...@@ -235,21 +236,28 @@ class CreateFunctions_t
if(verbose) if(verbose)
cout<<"\tCall site (0x"<<cs->getCallSiteAddress()<<"-"<<cs->getCallSiteEndAddress() cout<<"\tCall site (0x"<<cs->getCallSiteAddress()<<"-"<<cs->getCallSiteEndAddress()
<<") with landing pad=0x"<<cs->getLandingPadAddress()<<endl; <<") with landing pad=0x"<<cs->getLandingPadAddress()<<endl;
if(cs->getLandingPadAddress()==0x0)
continue;
auto set1_it=find_if(ALLOF(sccs), [&](const RangeSet_t& s) { return s.find(pair) != s.end(); } ); auto set1_it=find_if(ALLOF(sccs), [&](const RangeSet_t& s) { return s.find(pair) != s.end(); } );
assert(set1_it!=sccs.end()); assert(set1_it!=sccs.end());
auto set2_it=find_if(ALLOF(sccs), [&](const RangeSet_t& s) auto set2_it=find_if(ALLOF(sccs), [&](const RangeSet_t& s)
{ {
return find_if(ALLOF(s), [&](const Range_t& r) { return r.contains(cs->getCallSiteAddress()); }) != s.end(); return find_if(ALLOF(s), [&](const Range_t& r) { return r.contains(cs->getLandingPadAddress()); }) != s.end();
}); });
assert(set2_it!=sccs.end()); assert(set2_it!=sccs.end());
auto set1=*set1_it; auto set1=*set1_it;
auto set2=*set2_it; auto set2=*set2_it;
sccs.erase(set1); if(set1!=set2)
sccs.erase(set2); {
auto set3=RangeSet_t(); sccs.erase(set1);
set_union(ALLOF(set1), ALLOF(set2), inserter(set3, set3.begin())); sccs.erase(set2);
sccs.insert(set3); auto set3=RangeSet_t();
if(verbose)
cout<<"\tMerging: set1="<< hex<< set1 << " and set2="<<set2<<dec<<endl;
set_union(ALLOF(set1), ALLOF(set2), inserter(set3, set3.begin()));
sccs.insert(set3);
}
} }
} }
...@@ -467,8 +475,18 @@ class CreateFunctions_t ...@@ -467,8 +475,18 @@ class CreateFunctions_t
} }
}; };
ostream& operator<<(ostream& os, const CreateFunctions_t::RangeSet_t& rs)
{
for(const auto r : rs)
{
os<<"("<<r.first<<"-"<<r.second<<"), ";
}
return os;
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment