[lldb-dev] [Bug 30824] New: lldb evaluates $N incorrectly when it was a printed register value

via lldb-dev lldb-dev at lists.llvm.org
Fri Oct 28 08:47:57 PDT 2016


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

            Bug ID: 30824
           Summary: lldb evaluates $N incorrectly when it was a printed
                    register value
           Product: lldb
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: rsc at swtch.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Using Ubuntu 14.04 LTS's lldb-3.8 package to debug a trivial program, try
printing a register value (first print, so it ends up being $0) and then
referring to that print in a later expression. The later reference is
incorrectly evaluated:

$ echo 'int main() {return 0;}' | gcc -xc - -o a.out # any binary will do
$ lldb-3.8 --version
lldb version 3.8.0 ( revision )
$ lldb-3.8 a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main, address = 0x00000000004004ed
(lldb) r
Process 62061 launched: '/usr/local/google/home/rsc/a.out' (x86_64)
Process 62061 stopped
* thread #1: tid = 62061, 0x00000000004004ed a.out`main, name = 'a.out', stop
reason = breakpoint 1.1
    frame #0: 0x00000000004004ed a.out`main
a.out`main:
->  0x4004ed <+0>: pushq  %rbp
    0x4004ee <+1>: movq   %rsp, %rbp
    0x4004f1 <+4>: movl   $0x0, %eax
    0x4004f6 <+9>: popq   %rbp
(lldb) print/x $rdi
(unsigned long) $0 = 0x0000000000000001
(lldb) print/x ($rdi)
(unsigned long) $1 = 0x0000000000000001
(lldb) print/x $0
(unsigned long) $0 = 0x0000000000000001
(lldb) print/x ($0)
(unsigned long) $2 = 0x00007ffff7ff6008  <<< WRONG!
(lldb) 

$0 and ($0) should evaluate to the same value. The final print is wrong. This
happens in any non-trivial expression involving printed register values.
Continuing:

(lldb) print/x $rdi
(unsigned long) $3 = 0x0000000000000001
(lldb) print/x $rsi
(unsigned long) $4 = 0x00007fffffffe058
(lldb) print/x $rdi+$rsi
(unsigned long) $5 = 0x00007fffffffe059
(lldb) print/x $3+$4
(unsigned long) $6 = 0x0000ffffeffec010  <<< WRONG!
(lldb)

And so on.

I see this on OS X with the Xcode toolchain lldb as well.

-- 
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/20161028/19a45ca6/attachment.html>


More information about the lldb-dev mailing list