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

added findFDE(addr) api for efficiency

parent 3a620bef
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,7 @@ class EHFrameParser_t
virtual void print() const=0;
virtual const shared_ptr<FDEVector_t> getFDEs() const =0;
virtual const shared_ptr<CIEVector_t> getCIEs() const =0;
virtual const shared_ptr<FDEContents_t> findFDE(uint64_t addr) const =0;
static unique_ptr<const EHFrameParser_t> factory(const string filename);
static unique_ptr<const EHFrameParser_t> factory(
......
......@@ -1675,8 +1675,16 @@ const shared_ptr<CIEVector_t> split_eh_frame_impl_t<ptrsize>::getCIEs() const
[](const cie_contents_t<ptrsize> &a){ return shared_ptr<CIEContents_t>(new cie_contents_t<ptrsize>(a));});
return ret;
}
template <int ptrsize>
const shared_ptr<FDEContents_t> split_eh_frame_impl_t<ptrsize>::findFDE(uint64_t addr) const
{
const auto tofind=fde_contents_t<ptrsize>( addr, addr+1);
const auto fde_it=fdes.find(tofind);
const auto raw_ret_ptr = (fde_it==fdes.end()) ? nullptr : new fde_contents_t<ptrsize>(*fde_it);
return shared_ptr<FDEContents_t>(raw_ret_ptr);
}
unique_ptr<const EHFrameParser_t> EHFrameParser_t::factory(const string filename)
{
......
......@@ -403,6 +403,8 @@ class split_eh_frame_impl_t : public EHFrameParser_t
virtual const shared_ptr<FDEVector_t> getFDEs() const;
virtual const shared_ptr<CIEVector_t> getCIEs() const;
virtual const shared_ptr<FDEContents_t> findFDE(uint64_t addr) const;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment