Bug 167212 - Valgrind does not attach to GDB correctly, traceback spits garbage
Summary: Valgrind does not attach to GDB correctly, traceback spits garbage
Status: RESOLVED INTENTIONAL
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.3.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: wanted3.6.0
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-22 14:35 UTC by jonesy
Modified: 2014-09-25 08:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jonesy 2008-07-22 14:35:41 UTC
Versions: running Ubuntu 8.04, gdb 6.8, valgrind 3.3.1.  Using the
--db-attach=yes feature of Valgrind, I try to view the traceback info and all I
receive is "?? in ()" for a couple of lines, like so:
0x040ba990 in ?? () from /lib/ld-linux.so.2
(gdb) bt
#0  0x040ba990 in ?? () from /lib/ld-linux.so.2
#1  0x4b4a4948 in ?? ()
#2  0x4f4e4d4c in ?? ()
#3  0x53525150 in ?? ()
#4  0x57565554 in ?? ()
#5  0x5b5a5958 in ?? ()
#6  0x5f5e5d5c in ?? ()
#7  0x63626160 in ?? ()
#8  0x67666564 in ?? ()
#9  0x040891ac in ?? ()
#10 0x04123ff4 in ?? ()
#11 0xbef5f5c8 in ?? ()
#12 0x040ba944 in calloc@plt () from /lib/ld-linux.so.2
#13 0x04126598 in ?? ()
#14 0xffffffff in ?? ()
#15 0x0401aff4 in ?? ()
#16 0x0404bad8 in ?? ()
#17 0x0401d8c8 in ?? ()
#18 0xbef5f5b0 in ?? ()

I have discovered that if I recompile gdb 6.8 with the
CXXFLAGs=-fno-omit-frame-pointer turned on and recompile valgrind 3.3.1, then it
is able to attach correctly, giving useful traceback information.  I checked the
bug database and found similar output issues from other valgrind users, but no
one seemed to receive this output based on this particular problem.  Have you
come across this before?
Comment 1 jonesy 2008-07-23 15:17:15 UTC
Here is a simple test program that will cause this behavior on a default Ubuntu 7.10 system:

#include <iostream>

struct A
{
    A()
    {
    }

    int i;
    int j;
};

void printA(A* p_a)
{
    std::cout << p_a->i << std::endl;
}

int main()
{
    A* a = new A();
    printA(a);
    return 0;
}
Comment 2 Nicholas Nethercote 2009-06-26 03:55:50 UTC
We often have GDB attaching problems, it would be good to improve this situation, or at least document better the limitations.
Comment 3 Florian Krohm 2014-09-25 08:17:44 UTC
The --db-attach feature is deprecated as of valgrind 3.10.0.
It will be removed in the next valgrind feature release.
The built-in GDB server capabilities are superior and should be
used instead. 
Therefore, this bug will not be fixed.