Skip to content

Commit

Permalink
Added find and lower_bound to RangeLookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrwilliams committed Oct 19, 2016
1 parent 883ed46 commit 3c017fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions symtabAPI/h/LineInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class SYMTAB_EXPORT LineInformation :

bool getAddressRanges( const char * lineSource, unsigned int LineNo, std::vector< AddressRange > & ranges );

const_iterator begin() const;
const_iterator end() const;
virtual const_iterator begin() const;
virtual const_iterator end() const;
unsigned getSize() const;

~LineInformation();
virtual ~LineInformation();

protected:
/* We maintain internal copies of all the source file names. Because
Expand Down
19 changes: 16 additions & 3 deletions symtabAPI/h/RangeLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ class SYMTAB_EXPORT RangeLookup
bool getValues( Offset addressInRange, std::vector< Value *> & values );
bool getAddressRanges( Value v, std::vector< AddressRange > & ranges );

const_iterator begin() const;
const_iterator end() const;
virtual const_iterator begin() const;
virtual const_iterator end() const;
virtual const_iterator find(const AddressRange& ar) const;
virtual const_iterator lower_bound(Offset addr) const;

~RangeLookup();
virtual ~RangeLookup();

// /* DEBUG */ void dump( FILE * stream );
// /* DEBUG */ static void testInsertionSpeed();
Expand Down Expand Up @@ -474,6 +476,17 @@ RangeLookup< Value, ValueRange >::~RangeLookup()
{
} /* end RangeLookup destructor */

template< class Value, class ValueRange >
typename RangeLookup< Value, ValueRange >::const_iterator RangeLookup< Value, ValueRange >::find(const AddressRange& ar) const
{
return valuesByAddressRangeMap.find(ar);
} /* end find() */

template< class Value, class ValueRange >
typename RangeLookup< Value, ValueRange >::const_iterator RangeLookup< Value, ValueRange >::lower_bound(Offset addr) const
{
return valuesByAddressRangeMap.lower_bound(AddressRange(addr, addr));
} /* end lower_bound() */

} // namespace SymtabAPI
} // namespace Dyninst
Expand Down

0 comments on commit 3c017fd

Please sign in to comment.