<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LLDB Not Stepping into Multiple Inheritance Virtual Functions"
   href="https://bugs.llvm.org/show_bug.cgi?id=44068">44068</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB Not Stepping into Multiple Inheritance Virtual Functions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>acwilson96@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22842" name="attach_22842" title="Reproducer program.">attachment 22842</a> <a href="attachment.cgi?id=22842&action=edit" title="Reproducer program.">[details]</a></span>
Reproducer program.

Overview:

Using LLDB to debug polymorphic objects that have multiple inheritance will not
step into virtual functions.

Steps to Reproduce:
```
$ clang++ -std=c++11 -g -O0 reproducer.cpp -o clang.out
$ lldb clang.out
(lldb) target create "clang.out"
Current executable set to 'clang.out' (x86_64).
(lldb) b 36                                                                    
                                                                               
                  Breakpoint 1: where = clang.out`main + 103 at
reproducer.cpp:36:16, address = 0x0000000000400d67
(lldb) r
Process 2764 launched: '/home/rdtscp/Documents/lldb_reproducer/clang.out'
(x86_64)
Process 2764 stopped
* thread #1, name = 'clang.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400d67 clang.out`main(argc=1,
argv=0x00007fffffffe808) at reproducer.cpp:36:16
   33   int main(int argc, char **argv) {
   34     using namespace Test;
   35     std::shared_ptr<Interface> object = std::shared_ptr<Concrete>(new
Concrete());
-> 36     int output = object->vFun();
   37     std::cout << output << std::endl;
   38     return output;
   39   }
(lldb) s
Process 2764 stopped
* thread #1, name = 'clang.out', stop reason = step in
    frame #0: 0x0000000000400d86 clang.out`main(argc=1,
argv=0x00007fffffffe808) at reproducer.cpp:37:16
   34     using namespace Test;
   35     std::shared_ptr<Interface> object = std::shared_ptr<Concrete>(new
Concrete());
   36     int output = object->vFun();
-> 37     std::cout << output << std::endl;
   38     return output;
   39   }
(lldb)
```

Altering the `Concrete` class to be:
```
class Concrete : // public Base,
                 public Interface {
public:
  virtual int vFun() override {
    volatile int x = rand();
    if (x > 0)
      return x;
    else
      return 0;
  }
};
```

Will result in:
```
$ clang++ -std=c++11 -g -O0 reproducer.cpp -o clang.out
$ lldb clang.out
(lldb) target create "clang.out"
Current executable set to 'clang.out' (x86_64).
(lldb) b 36
Breakpoint 1: where = clang.out`main + 104 at reproducer.cpp:36:16, address =
0x0000000000400cf8
(lldb) r
Process 2869 launched: '/home/rdtscp/Documents/lldb_reproducer/clang.out'
(x86_64)
Process 2869 stopped
* thread #1, name = 'clang.out', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400cf8 clang.out`main(argc=1,
argv=0x00007fffffffe808) at reproducer.cpp:36:16
   33   int main(int argc, char **argv) {
   34     using namespace Test;
   35     std::shared_ptr<Interface> object = std::shared_ptr<Concrete>(new
Concrete());
-> 36     int output = object->vFun();
   37     std::cout << output << std::endl;
   38     return output;
   39   }
(lldb) s
Process 2869 stopped
* thread #1, name = 'clang.out', stop reason = step in
    frame #0: 0x0000000000400fec
clang.out`Test::Concrete::vFun(this=0x0000000000615c20) at reproducer.cpp:23:24
   20                      public Interface {
   21     public:
   22       virtual int vFun() override {
-> 23         volatile int x = rand();
   24         if (x > 0)
   25           return x;
   26         else
(lldb)
```

The above shows that making the `Concrete` class inherit from the `Base` class
prevents us from stepping into `vFun()`.


System Settings:
```
OS: Debian GNU/Linux 9.11 (stretch) x86_64
Model: VirtualBox 1.2
Kernel: 4.9.0-11-amd64
Uptime: 1 hour, 3 minutes
Packages: 1722
Shell: zsh 5.3.1
CPU: Intel i5-7360U (1) @ 2.3GHz
GPU: VMware SVGA II Adapter
Memory: 219MB / 996MB
```

```
$ clang++ --version
clang version 9.0.0-svn364966-1~exp1+0~20190702204433.1332~1.gbpb44072 (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ lldb --version
lldb version 9.0.0
```

Additional Information:
I tried using:
```
g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
```

To see if my code was incorrect, but g++ and gdb were able to step into
"vFun()" fun.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>