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

via lldb-dev lldb-dev at lists.llvm.org
Thu Aug 11 10:08:19 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28940

            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 at lists.llvm.org
          Reporter: dberlin at dberlin.org
                CC: llvm-bugs at 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 :)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160811/d30c5d0d/attachment-0001.html>


More information about the lldb-dev mailing list