[lldb-dev] [Bug 27800] New: LLDB step-in misses internal breakpoint and continues execution

via lldb-dev lldb-dev at lists.llvm.org
Tue May 17 20:07:54 PDT 2016


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

            Bug ID: 27800
           Summary: LLDB step-in misses internal breakpoint and continues
                    execution
           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: progers7 at gatech.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16383
  --> https://llvm.org/bugs/attachment.cgi?id=16383&action=edit
Reproduction test files

lldb-340.4.70
llvm 7.0.0 (clang-700.0.72) (also occurs at trunk at r268813)

Reproduction steps:
1. Compile
  g++ -O1 -gdwarf-4 -c TestClass.cpp
  g++ -gdwarf-4 lldbBug.cpp TestClass.o -o lldbBug -lm

2. Launch lldb and break at TestSubclass::reproStepBug()
  lldb lldbBug
  breakpoint set --name TestSubclass::reproStepBug
  run

3. Once the breakpoint is hit, try stepping
  thread step-in
  [bug!!]

The bug is that lldb's internal step breakpoint is skipped over due to
optimizations. Because the optimized code is linked in, there is no warning
about stepping with optimizations.

In multithreaded programs, this bug results in the current thread continuing
out from underneath lldb. From the user's perspective, the thread just becomes
invalid:
Process 37950 stopped ...
(lldb) thread step-in
(lldb) thread step-in
error: invalid thread
(lldb) thread step-in
error: invalid thread


--------------TestClass.cpp--------------
#include "TestClass.h"

__attribute__ ((optnone)) static bool getMember(const TestClass* testObject) {
    return testObject->member;
}

void TestClass::callMember() const
{
    if (getMember(this))
        member->callMember();
}

---------------TestClass.h---------------
class TestClass {
public:
    explicit TestClass(TestClass* m) : member(m) { }
    void callMember() const;
    TestClass* member;
};

class TestSubclass : public TestClass {
public:
    explicit TestSubclass() : TestClass(0) { }

    // To repro, break at this function and then step through the two calls.
    void reproStepBug() {
        callMember();
        callMember();
    }
};

--------------lldbBug.cpp--------------
#include "TestClass.h"

int main(int argc, char *argv[]) {
    TestSubclass object;
    object.reproStepBug();
    return 0;
}

-- 
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/20160518/00226a53/attachment.html>


More information about the lldb-dev mailing list