Jonas Devlieghere 4fe46edf8d
[lldb] Support arm64e C++ vtable pointer signing (#187611)
When targeting arm64e, vtable pointers are signed with a discriminator
that incorporates the object's address
(PointerAuthVTPtrAddressDiscrimination) and class type
(PointerAuthVTPtrTypeDiscrimination).

I had to make a small change to clang, specifically in
getPointerAuthDeclDiscriminator(). Previously, that was computing the
discriminator based on getMangledName(). The latter returns the
AsmLabelAttr, which for functions imported by lldb, is prefixed with
`$__lldb_func`, causing a different discriminator to be generated.
2026-03-25 12:08:02 -05:00

28 lines
489 B
C++

#include <cstdio>
class Base {
public:
virtual int value() { return 10; }
virtual ~Base() = default;
};
class Derived : public Base {
public:
int value() override { return 20; }
};
class OtherDerived : public Base {
public:
int value() override { return 30; }
};
int call_value(Base *obj) { return obj->value(); }
int main() {
Derived d;
OtherDerived od;
Base *base_ptr = &d;
printf("%d %d %d\n", d.value(), od.value(), base_ptr->value());
return 0; // break here
}