[Bug 28940] New: LLDB calls wrong C++ method when virtual hides non-virtual

Bug ID 28940
Summary LLDB calls wrong C++ method when virtual hides non-virtual
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter dberlin@dberlin.org
CC llvm-bugs@lists.llvm.org
Classification Unclassified

If i have a virtual in a subclass that hides a non-virtual in a base-class,
LLDB calls the non-virtual.

Example from LLVM:

class Value {
..
  /// \brief Support for debugging, callable in GDB: V->dump()
  void dump() const;
}

<somewhere else>

class MemoryAccess: public Value {
 virtual void dump() const;
}

(lldb) p Dominator->MemoryAccess::dump()
1 = MemoryDef(liveOnEntry)

(this is the correct dump)

(lldb) p Dominator->dump()
While deleting: void %
Use still stuck around after Def is destroyed:Unknown value to print out!
UNREACHABLE executed at ../lib/IR/AsmWriter.cpp:3437!
error: Execution was interrupted, reason: signal SIGABRT.
The process has been returned to the state before expression evaluation.

This is calling Value::dump().

What dump is called certainly depends on the pointer type.
If the pointer type here was Value*, i would expect this behavior.

However, it is "const MemoryAccess *Dominator", so it should be calling the
virtual dump here.

(and for anyone curious, fixing llvm ... would be hard :P)

gdb calls the correct dump here :)