X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace.hpp;h=a59a6eb8901e97195d2f268082101a331396881b;hb=b25c4b9fccc76976d633bc5b183a84553ab01998;hp=c87fc946c9e5e8e647473f2352179ccbfdd34669;hpb=91343f5cfc53e18d5a59eecef3a0c3726fb0c04e;p=apitrace diff --git a/retrace.hpp b/retrace.hpp index c87fc94..a59a6eb 100644 --- a/retrace.hpp +++ b/retrace.hpp @@ -26,7 +26,14 @@ #ifndef _RETRACE_HPP_ #define _RETRACE_HPP_ +#include + +#include #include +#include + +#include "trace_model.hpp" + namespace retrace { @@ -73,6 +80,68 @@ public: }; +void +addRegion(unsigned long long address, void *buffer, unsigned long long size); + +void +delRegionByPointer(void *ptr); + +void * +toPointer(trace::Value &value, bool bind = false); + + +/** + * Output verbosity when retracing files. + */ +extern int verbosity; + + +std::ostream &warning(trace::Call &call); + + +void ignore(trace::Call &call); +void unsupported(trace::Call &call); + + +typedef void (*Callback)(trace::Call &call); + +struct Entry { + const char *name; + Callback callback; +}; + + +struct stringComparer { + bool operator() (const char *a, const char *b) const { + return strcmp(a, b) < 0; + } +}; + + +extern const Entry stdc_callbacks[]; + + +class Retracer +{ + typedef std::map Map; + Map map; + + std::vector callbacks; + +public: + Retracer() { + addCallbacks(stdc_callbacks); + } + + virtual ~Retracer() {} + + void addCallback(const Entry *entry); + void addCallbacks(const Entry *entries); + + void retrace(trace::Call &call); +}; + + } /* namespace retrace */ #endif /* _RETRACE_HPP_ */