dmalloc log is not formatting stack addresses

108 Views Asked by At

By building dmalloc lib with following setting in conf.h file

#define HAVE_VPRINTF 0
#define HAVE_SNPRINTF 0
#define HAVE_VSNPRINTF 0

and run my code after linking , log file content have unformatting address info to function names and line numbers.

Unformatted log o/p is given below.

        Venkatesh:~/Dmalloc/dmalloc-5.5.2$ cat logfile
        %ld: %lu: Dmalloc version '%s' from '%s'
        %ld: %lu: flags = %#x, logfile '%s'
        %ld: %lu: interval = %lu, addr = %#lx, seen # = %ld, limit = %ld
        %ld: %lu: starting time = %s
        %ld: %lu: process pid = %ld
        %ld: %lu:   error details: %s
        %ld: %lu:   pointer '%#lx' from '%s' prev access '%s'
        %ld: %lu:   dump of proper fence-top bytes: '%.*s'
        %ld: %lu:   dump of '%#lx'%+d: '%.*s'
        %ld: %lu:   next pointer '%#lx' (size %u) may have run under from '%s'
        %ld: %lu: ERROR: %s: %s (err %d)


If I define HAVE_VSNPRINTF to 1, then I log file has only dmalloc log header, no information about errors as given below.

        Venkatesh:~/Dmalloc/dmalloc-5.5.2$ cat logfile
        1450864250: 5: Dmalloc version '5.5.2' from 'http://dmalloc.com/'
        1450864250: 11: flags = 0x4f4e503, logfile 'logfile'
        1450864250: 17: interval = 100, addr = 0, seen # = 0, limit = 0
        1450864250: 25: starting time = 1450864250
        1450864250: 31: process pid = 10270

My test code is as below.

    #include <stdio.h>
    #include <stdlib.h>

    #ifdef DMALLOC
    #include "dmalloc.h"
    #endif

    int main ()
    {
            char *p;
            p = malloc (50);
            p[51] = 'c'; //Writing character beyond allocated range
            return 0;
    }

Dmalloc optins I am using is : DMALLOC_OPTIONS=debug=0x4f4ed03,inter=100,log=logfile

0

There are 0 best solutions below