<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 - gdb cannot break on function that has thunk"
   href="https://bugs.llvm.org/show_bug.cgi?id=43760">43760</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>gdb cannot break on function that has thunk
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>```
#include <stdio.h>
class BaseClassOne {
public:
  virtual void foo();
};

class BaseClassTwo {
public:
  virtual void bar();
};

class DeriveClass: public BaseClassOne, BaseClassTwo {
public:
  void foo() override;
  void bar() override;
};

void BaseClassOne::foo() {
  printf("This is BaseClassOne: %p\n", this);
}

void BaseClassTwo::bar() {
  printf("This is BaseClassTwo: %p\n", this);
}

void DeriveClass::foo() {
  printf("This is DeriveClass foo: %p\n", this);
}

void DeriveClass::bar() {
  printf("This is DeriveClass bar: %p\n", this);
}
```

gdb can break on DeriveClass::bar, but not_ZThn8_N11DeriveClass3barEv。The
expression static_cast<BaseClassTwo*>(o)->bar() will not trigger the break
point, because thunk do function inline like the following show:

```
; Function Attrs: nounwind uwtable
define dso_local void @_ZThn8_N11DeriveClass3barEv(%class.DeriveClass*)
unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds %class.DeriveClass, %class.DeriveClass* %0, i64
-1, i32 1
  %3 = bitcast %class.BaseClassTwo* %2 to %class.DeriveClass*
  tail call void @_ZN11DeriveClass3barEv(%class.DeriveClass* %3)
  ret void
}


; Function Attrs: nounwind uwtable
define dso_local void @_ZThn8_N11DeriveClass3barEv(%class.DeriveClass*)
unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds %class.DeriveClass, %class.DeriveClass* %0, i64
-1, i32 1
  %3 = bitcast %class.BaseClassTwo* %2 to %class.DeriveClass*
  %4 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8],
[29 x i8]* @.str.3, i64 0, i64 0), %class.DeriveClass* %3) #2
  ret void
```</pre>
        </div>
      </p>


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

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>