[llvm-bugs] [Bug 43760] New: gdb cannot break on function that has thunk
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 22 02:52:33 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43760
Bug ID: 43760
Summary: gdb cannot break on function that has thunk
Product: clang
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: manjian2006 at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
```
#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
```
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191022/88852d9a/attachment.html>
More information about the llvm-bugs
mailing list