Valgrind reporting: Invalid read of size 8 while using backtrace() function in c++?
im using backtrace() function in my function as follows:

    string newFunction()
    {
         void *array[5002];
         // get void*'s for all entries on the stack
         size_t size
         size = backtrace(array, 5000);
         char** trace = backtrace_symbols(array, size);
         string stackTrace;
         for(size_t index=0; index<size; ++index) 
         {          
           stackTrace += trace[index];
         }
        return stackTrace; 
    }

with above function use in debug build cases i am getting memory fault. The valgrind report shows following log:

    ==31045== Invalid read of size 8
    ==31045==    at 0x358D208806: ??? (in /lib64/libgcc_s-4.1.2-20080825.so.1)
    ==31045==    by 0x358D208933: _Unwind_Backtrace (in /lib64/libgcc_s-4.1.2-20080825.so.1)
    ==31045==    by 0x3588AE6357: backtrace (in /lib64/libc-2.5.so)
    ==31045==    by 0xF2A1F99: (anonymous namespace)::newFunction() (myFIle.cpp:63)


so can any suggestion to resilve above memory fault. Thanks in advance.

Valgrind reporting: Invalid read of size 8 while using backtrace() function in c++?
===

im using backtrace() function in my function as follows:

    string newFunction()
    {
         void *array[5002];
         // get void*'s for all entries on the stack
         size_t size
         size = backtrace(array, 5000);
         char** trace = backtrace_symbols(array, size);
         string stackTrace;
         for(size_t index=0; index<size; ++index) 
         {          
           stackTrace += trace[index];
         }
        return stackTrace; 
    }

with above function use in debug build cases i am getting memory fault. The valgrind report shows following log:

    ==31045== Invalid read of size 8
    ==31045==    at 0x358D208806: ??? (in /lib64/libgcc_s-4.1.2-20080825.so.1)
    ==31045==    by 0x358D208933: _Unwind_Backtrace (in /lib64/libgcc_s-4.1.2-20080825.so.1)
    ==31045==    by 0x3588AE6357: backtrace (in /lib64/libc-2.5.so)
    ==31045==    by 0xF2A1F99: (anonymous namespace)::newFunction() (myFIle.cpp:63)


so can any suggestion to resilve above memory fault. Thanks in advance.
