Beispiel #1
0
static void 
ModuleSharedPtrLogger(void* p, const ModuleSP& sp, bool will_decrement)
{
    if (sp.get())
    {
        const char *module_basename = sp->GetFileSpec().GetFilename().GetCString();
        // If "p" is set, then it is the basename of a module to watch for. This
        // basename MUST be uniqued first by getting it from a ConstString or this
        // won't work.
        if (p && p != module_basename)
        {
            return;
        }
        long use_count = sp.use_count();
        if (will_decrement)
            --use_count;

        printf("\nModuleSP(%p): %c %p {%lu} %s/%s\n", &sp, will_decrement ? '-' : '+', sp.get(), use_count, sp->GetFileSpec().GetDirectory().GetCString(), module_basename);
        StreamFile stdout_strm(stdout, false);
        Host::Backtrace (stdout_strm, 512);
    }
}