[lldb-dev] [Bug 31212] New: LLDB steps incorrectly for binaries compiled using GCC 6.2 on Ubuntu 16.10

via lldb-dev lldb-dev at lists.llvm.org
Tue Nov 29 13:00:26 PST 2016


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

            Bug ID: 31212
           Summary: LLDB steps incorrectly for binaries compiled using GCC
                    6.2 on Ubuntu 16.10
           Product: lldb
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: eldar.abusalimov at jetbrains.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Step-over and step-in skip source lines and behave more like step-out for code
compiled on Ubuntu 16.10 using GCC 6.2, which by default compiles with -pie.
Everything works correctly when using -fno-pie explicitly. The weird thing is,
everything also works fine when compiling on Ubuntu 16.04 using GCC 6.2 from
ppa:ubuntu-toolchain-r/test.

The issue is also reproducible with binaries compiled on Ubuntu 16.10 using GCC
6.2 which are then debugged on another system, like Ubuntu 16.04.

Source code:

    #include <iostream>

    void printHello() {
        std::cout << "Hello, World! from function" << std::endl;
        std::cout << "Hello, World! from function" << std::endl;
        std::cout << "Hello, World! from function" << std::endl;
    }

    int main() {
        printHello();
        std::cout << "Hello, World! from main()" << std::endl;
        std::cout << "Hello, World! from main()" << std::endl;
        std::cout << "Hello, World! from main()" << std::endl;
        return 0;
    }


Debug session:

    $ lldb ClionProjects/bug_test/cmake-build-debug/bug_test
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named lldb.embedded_interpreter
    (lldb) target create "ClionProjects/bug_test/cmake-build-debug/bug_test"
    Current executable set to
'ClionProjects/bug_test/cmake-build-debug/bug_test' (x86_64).
    (lldb) b main.cpp:10
    Breakpoint 1: where = bug_test`main + 4 at main.cpp:10, address =
0x0000000000000993
    (lldb) r
    Process 2545 launched:
'/home/user/ClionProjects/bug_test/cmake-build-debug/bug_test' (x86_64)
    Process 2545 stopped
    * thread #1: tid = 2545, 0x0000555555554993 bug_test`main + 4 at
main.cpp:10, name = 'bug_test', stop reason = breakpoint 1.1
        frame #0: 0x0000555555554993 bug_test`main + 4 at main.cpp:10
       7       }
       8       
       9       int main() {
    -> 10          printHello();
       11          std::cout << "Hello, World! from main()" << std::endl;
       12          std::cout << "Hello, World! from main()" << std::endl;
       13          std::cout << "Hello, World! from main()" << std::endl;
    (lldb) s
    Process 2545 stopped
    * thread #1: tid = 2545, 0x0000555555554914 bug_test`printHello() + 4 at
main.cpp:4, name = 'bug_test', stop reason = step in
        frame #0: 0x0000555555554914 bug_test`printHello() + 4 at main.cpp:4
       1       #include <iostream>
       2       
       3       void printHello() {
    -> 4           std::cout << "Hello, World! from function" << std::endl;
       5           std::cout << "Hello, World! from function" << std::endl;
       6           std::cout << "Hello, World! from function" << std::endl;
       7       }
    (lldb) s
    Hello, World! from function
    Hello, World! from function
    Hello, World! from function
    Process 2545 stopped
    * thread #1: tid = 2545, 0x0000555555554998 bug_test`main + 9 at
main.cpp:11, name = 'bug_test', stop reason = step in
        frame #0: 0x0000555555554998 bug_test`main + 9 at main.cpp:11
       8       
       9       int main() {
       10          printHello();
    -> 11          std::cout << "Hello, World! from main()" << std::endl;
       12          std::cout << "Hello, World! from main()" << std::endl;
       13          std::cout << "Hello, World! from main()" << std::endl;
       14          return 0;
    (lldb) s
    Hello, World! from main()
    Hello, World! from main()
    Hello, World! from main()
    Process 2545 stopped
    * thread #1: tid = 2545, 0x00007ffff76a93f1 libc.so.6`__libc_start_main +
241, name = 'bug_test', stop reason = step in
        frame #0: 0x00007ffff76a93f1 libc.so.6`__libc_start_main + 241
    libc.so.6`__libc_start_main:
    ->  0x7ffff76a93f1 <+241>: movl   %eax, %edi
        0x7ffff76a93f3 <+243>: callq  0x7ffff76c3320            ; exit
        0x7ffff76a93f8 <+248>: xorl   %eax, %eax
        0x7ffff76a93fa <+250>: jmp    0x7ffff76a9337            ; <+55>
    (lldb)

-- 
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/20161129/f37050d3/attachment.html>


More information about the lldb-dev mailing list