Re: memprof problem (backtrace)

I think I've tracked down where the hang is occurring, using memprof with glibc 2.3.5 on Linux (though I don't undestand _why_ it's occurring).

The do_malloc function in memprof's libmemintercept calls mi_call_with_backtrace(), which in turns calls the glibc function backtrace(), and backtrace is not returning.

Below is a commented version of the code, in stack-frame.c: does this suggest anything?

mi_call_with_backtrace (int to_skip,
                        void callback (int, void **, void *),
                        void *data)
    int bufsiz = 128, count;
    size_t sz = bufsiz * sizeof (void *);
    void **buf;

    buf = alloca (sz);
    fprintf(stderr, "mi_call_with_backtrace: "
                    " alloca(%d) called, buf = %p\n",
           (int) sz, (void *) buf);
    /* the line above produces sensible-looking results */

    fprintf(stderr, " calling backtrace on buf\n");
    /* the line above is printing OK */

    count = backtrace (buf, bufsiz);
    fprintf(stderr, " count = %d\n", count);
    /* ... but we never get to here! */

    if (count == bufsiz)
        bufsiz = bufsiz * 2;
        goto again;

    callback (count - to_skip, buf + to_skip, data);

Allin Cottrell

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]