1#ifndef ROSE_BinaryAnalysis_SourceLocations_H
2#define ROSE_BinaryAnalysis_SourceLocations_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/AddressInterval.h>
7#include <Rose/BinaryAnalysis/AddressIntervalSet.h>
8#include <Rose/SourceLocation.h>
10#include <Sawyer/IntervalMap.h>
11#include <Sawyer/Map.h>
12#include <Sawyer/Optional.h>
13#include <Sawyer/Synchronization.h>
15#include <boost/filesystem.hpp>
17#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
18#include <boost/serialization/access.hpp>
27namespace BinaryAnalysis {
39 mutable SAWYER_THREAD_TRAITS::Mutex mutex_;
44#ifdef ROSE_ENABLE_BOOST_SERIALIZATION
45 friend class boost::serialization::access;
48 void serialize(S &s,
const unsigned ) {
49 s & BOOST_SERIALIZATION_NVP(addrToSrc_);
50 s & BOOST_SERIALIZATION_NVP(srcToAddr_);
156 void print(std::ostream&,
const std::string &prefix =
"")
const;
Bidirectional mapping between addresses and source locations.
void fillHoles(size_t maxHoleSize=64)
Fill in small holes in the address space.
void insert(const SourceLocation &, const AddressIntervalSet &)
Insert links between source and adresseses.
void erase(const SourceLocation &, Address)
Remove links between source and addresses.
Sawyer::Optional< Address > operator()(const SourceLocation &loc) const
Find the first address associated with a source location.
SourceLocation nextSourceLocation(const SourceLocation ¤t=SourceLocation()) const
Given a source location, return the next source location.
void erase(const SourceLocation &, const AddressIntervalSet &)
Remove links between source and addresses.
void insert(const SourceLocation &, const AddressInterval &)
Insert links between source and adresseses.
void printAddrToSrc(std::ostream &, const std::string &prefix="") const
Print the address to source mapping.
void printSrcToAddr(std::ostream &, const std::string &prefix="") const
Print the source to address mapping.
void erase(const AddressInterval &)
Remove all links for the specified addresses regardless of source.
void insert(const SourceLocation &, Address)
Insert links between source and adresseses.
SourceLocation operator()(Address va) const
Find the source location for an address.
AddressIntervalSet get(const SourceLocation &) const
Find the addresses associated with a source location.
void print(std::ostream &, const std::string &prefix="") const
Print the source to address mapping.
void erase(const SourceLocation &, const AddressInterval &)
Remove links between source and addresses.
std::set< boost::filesystem::path > allFileNames() const
Get the list of all known source files.
SourceLocations()
Default constructor.
SourceLocations & operator=(const SourceLocations &)
Atomic copy.
SourceLocations(const SourceLocations &)
Atomic copy.
Sawyer::Optional< Address > firstAddress(const SourceLocation &) const
Find the first address associated with a source location.
void erase(const AddressIntervalSet &)
Remove all links for the specified addresses regardless of source.
void insertFromDebug(SgNode *ast)
Insert information from debug tables.
void clear()
Remove all links.
SourceLocation get(Address) const
Find the source location for an address.
void erase(const SourceLocation &)
Remove all links for the specified source location regardless of address.
void erase(Address)
Remove all links for the specified addresses regardless of source.
Information about a source location.
An associative container whose keys are non-overlapping intervals.
Container associating values with keys.
Holds a value or nothing.
This class represents the base class for all IR nodes within Sage III.
std::uint64_t Address
Address.