[lldb-dev] [Bug 17722] New: lldb incorreclty shows virtual base object members

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 29 07:17:33 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17722

            Bug ID: 17722
           Summary: lldb incorreclty shows virtual base object members
           Product: lldb
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: olga.a.chupina at gmail.com
    Classification: Unclassified

Created attachment 11438
  --> http://llvm.org/bugs/attachment.cgi?id=11438&action=edit
test case

Consider the test:
$ cat test.cpp

class A {
  public:
    int a;
    void f() {a=11;};
};

class BA : public virtual A {
  public:
    void f() {a=22;};
};

class CA : public virtual A {
  public:
    void f() {a=33;};
};

class CBA : public BA, public CA {
  public:
    void f() {a=44;};
};

int main()
{
    CBA* ptr = new CBA;
    ptr->f();
    return ptr->a;
}

If I compile it with clang 3.4 compiler with "-g -O0" and debug it with lldb - 
I see the following ouput:
$ clang++ -c   -O0 -g test.cpp                                                  
$ clang++ -o test.exe   -O0 -g test.o                                           
$ lldb test.exe
Current executable set to 'test.exe' (x86_64).
(lldb) b 27
Breakpoint 1: where = test.exe`main + 59 at test.cpp:27, address =
0x0000000100000d9b
(lldb) r
Process 76925 launched: '/private/tmp/test_clang/test.exe' (x86_64)
Process 76925 stopped
* thread #1: tid = 0x1d03, 0x0000000100000d9b test.exe`main + 59 at
test.cpp:27, stop reason = breakpoint 1.1
    frame #0: 0x0000000100000d9b test.exe`main + 59 at test.cpp:27
   24   {
   25       CBA* ptr = new CBA;
   26       ptr->f();
-> 27       return ptr->a;
   28   }
(lldb) p *ptr
(CBA) $0 = {
  (BA) BA = {
    (A) A = {
      (int) a = 4224                 <---- this looks incorrect
    }
  }
  (CA) CA = {
    (A) A = {
      (int) a = 44
    }
  }
}
(lldb) 

The same binary works with gdb.
The test is attached. 


Olga Chupina
---
Software Engineer
Intel Compiler Team
Intel Corp.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131029/8d97157e/attachment.html>


More information about the lldb-dev mailing list