|
CCTLib
Calling-context and data-object attribution library for Intel Pin
|
#include <cstdio>#include <cstdint>#include <cstring>#include <cstdlib>#include <algorithm>#include <string>#include <vector>#include <map>#include <set>#include <unordered_map>#include <sstream>#include <iostream>#include <unistd.h>#include "pin.H"#include "cctlib.H"
Include dependency graph for cct_shape_check.cpp:Go to the source code of this file.
Classes | |
| struct | TData |
| struct | CctInventory |
| struct | AssertionRecorder |
Typedefs | |
| using | FnChain = vector< string > |
| using | CheckFn = void(*)(const CctInventory &, AssertionRecorder &) |
Functions | |
| static KNOB< string > | KnobCheck (KNOB_MODE_WRITEONCE, "pintool", "check", "", "name of the per-victim CCT-shape check function to run at Fini (required)") |
| static TData * | GetTls (THREADID t) |
| static VOID | ThreadStart (THREADID t, CONTEXT *, INT32, VOID *) |
| static VOID | ThreadStartRegister (THREADID t, CONTEXT *ctxt, INT32 flags, VOID *v) |
| static VOID | RecordCtxt (uint32_t opaqueHandle, THREADID t) |
| static VOID | CaptureMainHandle (uint32_t opaqueHandle, THREADID t) |
| static VOID | InstrumentInsCallback (INS ins, VOID *, const uint32_t slot) |
| BOOL | InterestingInsCallOrRet (INS ins) |
| static VOID | OnImgLoad (IMG img, VOID *) |
| static bool | isHardSentinelName (const string &n) |
| static bool | isSoftSentinelName (const string &n) |
| static bool | isSentinelName (const string &n) |
| static bool | isRootName (const string &n) |
| static void | BuildInventoryFromThread (THREADID t, CctInventory &inv) |
| static void | expectMarkerAnchored (AssertionRecorder &r, const CctInventory &inv, const string &fn, const string &parent) |
| static void | check_rec_fib_deep (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_ackermann (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_multi_direct (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_indirect_only (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_mixed_direct_indirect (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_stripped (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_exception (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_rec_baseline_nonrec (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_deep_unwind (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_ctor_throw (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_catch_and_resume (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_sig_longjmp (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_sig_sigsegv_recover (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_simple_throw (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_rethrow (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_catchall (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_dtor_cleanup (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_stress_loop (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_polymorphic (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_recurse_trycatch (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_none_tn (const CctInventory &inv, AssertionRecorder &r) |
| static void | check_exc_uncaught_tn (const CctInventory &inv, AssertionRecorder &r) |
| static void | RunChecksAndExit (const string &check) |
| static VOID | ThreadFini (THREADID t, const CONTEXT *, INT32, VOID *) |
| static void | FiniFunc (INT32 code, VOID *v) |
| static INT32 | Usage () |
| int | main (int argc, char *argv[]) |
Variables | |
| static TLS_KEY | g_tlsKey |
| static PIN_LOCK | g_lock |
| static vector< THREADID > | g_threads |
| static ADDRINT | g_mainLo = 0 |
| static ADDRINT | g_mainHi = 0 |
| static const set< string > | kThrowMachineryFns |
| static const map< string, CheckFn > | kChecks |
| static bool | g_checkRan = false |
| static FILE * | gTraceFile |
| using CheckFn = void (*)(const CctInventory&, AssertionRecorder&) |
Definition at line 980 of file cct_shape_check.cpp.
| using FnChain = vector<string> |
Definition at line 163 of file cct_shape_check.cpp.
|
static |
Definition at line 364 of file cct_shape_check.cpp.
References CctInventory::byLeafFn, CctInventory::chains, PinCCTLib::GetFullCallingContext(), GetTls(), PinCCTLib::GetTraceStartHandle(), h(), CctInventory::hitsByLeafFn, isHardSentinelName(), isRootName(), isSoftSentinelName(), CctInventory::maxDepthObserved, CctInventory::sentinelCounts, CctInventory::softSentinelCounts, CctInventory::subByLeafFn, CctInventory::subChains, CctInventory::subMaxDepthObserved, and CctInventory::totalDistinctHandles.
Referenced by RunChecksAndExit().
|
static |
Definition at line 112 of file cct_shape_check.cpp.
References PinCCTLib::GetContextHandle(), GetTls(), h(), and TData::mainCtxtHndl.
Referenced by InstrumentInsCallback().
|
static |
Definition at line 740 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), and AssertionRecorder::expectTrue().
|
static |
Definition at line 849 of file cct_shape_check.cpp.
References expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::subAnyChainContainsFn().
|
static |
Definition at line 722 of file cct_shape_check.cpp.
References CctInventory::anyChainContainsFn(), AssertionRecorder::expectLE(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), and CctInventory::maxCountInAnyChain().
|
static |
Definition at line 706 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), AssertionRecorder::expectEQ(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::maxCountInAnyChain().
|
static |
Definition at line 865 of file cct_shape_check.cpp.
References expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::subAnyChainContainsFn().
|
static |
Definition at line 952 of file cct_shape_check.cpp.
References AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), and CctInventory::subAnyChainContainsFn().
|
static |
Definition at line 893 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), and AssertionRecorder::expectTrue().
|
static |
Definition at line 905 of file cct_shape_check.cpp.
References AssertionRecorder::expectLE(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::maxCountInAnyChain().
|
static |
Definition at line 827 of file cct_shape_check.cpp.
References expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::subAnyChainContainsFn().
|
static |
Definition at line 809 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), and AssertionRecorder::expectTrue().
|
static |
Definition at line 881 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), and AssertionRecorder::expectTrue().
|
static |
Definition at line 963 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), and CctInventory::hasFn().
|
static |
Definition at line 577 of file cct_shape_check.cpp.
References CctInventory::everySubChainToFnHasImmediateParent(), AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 672 of file cct_shape_check.cpp.
References AssertionRecorder::expectGE(), AssertionRecorder::expectNoSentinels(), and CctInventory::subChains.
|
static |
Definition at line 656 of file cct_shape_check.cpp.
References CctInventory::everySubChainToFnHasImmediateParent(), AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 561 of file cct_shape_check.cpp.
References CctInventory::everySubChainToFnHasImmediateParent(), AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 603 of file cct_shape_check.cpp.
References AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 626 of file cct_shape_check.cpp.
References AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 589 of file cct_shape_check.cpp.
References CctInventory::everySubChainToFnHasImmediateParent(), AssertionRecorder::expectEQ(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::subChainCountForFn(), CctInventory::subHasFn(), and CctInventory::subMaxCountInAnyChain().
|
static |
Definition at line 643 of file cct_shape_check.cpp.
References AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), and CctInventory::hasFn().
|
static |
Definition at line 768 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), and CctInventory::hasFn().
|
static |
Definition at line 783 of file cct_shape_check.cpp.
References expectMarkerAnchored(), AssertionRecorder::expectNoSentinels(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), and CctInventory::subAnyChainContainsFn().
|
static |
Definition at line 542 of file cct_shape_check.cpp.
References CctInventory::everyChainToFnHasImmediateParent(), AssertionRecorder::expectTrue(), CctInventory::hasFn(), kThrowMachineryFns, and CctInventory::noAncestorOfFnIsInSet().
Referenced by check_exc_catch_and_resume(), check_exc_catchall(), check_exc_ctor_throw(), check_exc_deep_unwind(), check_exc_dtor_cleanup(), check_exc_polymorphic(), check_exc_recurse_trycatch(), check_exc_rethrow(), check_exc_simple_throw(), check_exc_stress_loop(), check_sig_longjmp(), and check_sig_sigsegv_recover().
|
static |
Definition at line 1113 of file cct_shape_check.cpp.
References g_checkRan, KnobCheck(), and RunChecksAndExit().
Referenced by main().
|
inlinestatic |
Definition at line 66 of file cct_shape_check.cpp.
References g_tlsKey.
Referenced by BuildInventoryFromThread(), CaptureMainHandle(), RecordCtxt(), and RunChecksAndExit().
|
static |
Definition at line 122 of file cct_shape_check.cpp.
References CaptureMainHandle(), g_mainHi, g_mainLo, and RecordCtxt().
Referenced by main().
|
inline |
Definition at line 145 of file cct_shape_check.cpp.
Referenced by main().
|
static |
Definition at line 342 of file cct_shape_check.cpp.
Referenced by BuildInventoryFromThread(), and isSentinelName().
|
static |
Definition at line 359 of file cct_shape_check.cpp.
Referenced by BuildInventoryFromThread().
|
static |
Definition at line 355 of file cct_shape_check.cpp.
References isHardSentinelName(), and isSoftSentinelName().
|
static |
Definition at line 349 of file cct_shape_check.cpp.
Referenced by BuildInventoryFromThread(), and isSentinelName().
|
static |
Referenced by FiniFunc(), and ThreadFini().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 1134 of file cct_shape_check.cpp.
References FiniFunc(), g_lock, g_tlsKey, gTraceFile, InstrumentInsCallback(), InterestingInsCallOrRet(), OnImgLoad(), PinCCTLib::PinCCTLibInit(), ThreadFini(), ThreadStartRegister(), and Usage().
|
static |
Definition at line 151 of file cct_shape_check.cpp.
References g_mainHi, and g_mainLo.
Referenced by main().
|
static |
Definition at line 100 of file cct_shape_check.cpp.
References PinCCTLib::GetContextHandle(), GetTls(), h(), and TData::hits.
Referenced by InstrumentInsCallback().
|
static |
Definition at line 1038 of file cct_shape_check.cpp.
References BuildInventoryFromThread(), CctInventory::byLeafFn, CctInventory::chains, AssertionRecorder::checkName, f(), AssertionRecorder::failures, g_threads, GetTls(), CctInventory::hitsByLeafFn, kChecks, CctInventory::maxDepthObserved, PIN_ExitProcess, PinCCTLib::PrintFullCallingContext(), and CctInventory::totalDistinctHandles.
Referenced by FiniFunc(), and ThreadFini().
|
static |
Definition at line 1031 of file cct_shape_check.cpp.
References g_checkRan, KnobCheck(), and RunChecksAndExit().
Referenced by main().
|
static |
Definition at line 70 of file cct_shape_check.cpp.
References g_tlsKey.
Referenced by ThreadStartRegister().
|
static |
Definition at line 80 of file cct_shape_check.cpp.
References PinCCTLib::flags, g_lock, g_threads, and ThreadStart().
Referenced by main().
|
static |
Definition at line 1127 of file cct_shape_check.cpp.
Referenced by main().
|
static |
Definition at line 1029 of file cct_shape_check.cpp.
Referenced by FiniFunc(), and ThreadFini().
|
static |
Definition at line 77 of file cct_shape_check.cpp.
Referenced by main(), and ThreadStartRegister().
|
static |
Definition at line 96 of file cct_shape_check.cpp.
Referenced by InstrumentInsCallback(), and OnImgLoad().
|
static |
Definition at line 96 of file cct_shape_check.cpp.
Referenced by InstrumentInsCallback(), and OnImgLoad().
|
static |
Definition at line 78 of file cct_shape_check.cpp.
Referenced by RunChecksAndExit(), and ThreadStartRegister().
|
static |
Definition at line 65 of file cct_shape_check.cpp.
Referenced by GetTls(), main(), and ThreadStart().
|
static |
Definition at line 1132 of file cct_shape_check.cpp.
Referenced by main().
|
static |
Definition at line 981 of file cct_shape_check.cpp.
Referenced by RunChecksAndExit().
|
static |
Definition at line 516 of file cct_shape_check.cpp.
Referenced by expectMarkerAnchored().