[lldb-dev] [Bug 45886] New: Wrong variable value change during debugging at Og

via lldb-dev lldb-dev at lists.llvm.org
Tue May 12 05:46:11 PDT 2020


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

            Bug ID: 45886
           Summary: Wrong variable value change during debugging at Og
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: massarelli at diag.uniroma1.it
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

The variable b inside function a changes value unexpectedly at line 3.

$ cat a.c
void a(b) {
  printf("%X\n");
}

int main() {
  a(0);
}

$ lldb -v
lldb version 11.0.0
  clang revision c25b20c0f6c13d68dbc2e185764082d61ae4a132
  llvm revision c25b20c0f6c13d68dbc2e185764082d61ae4a132

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/tmp/gcc_build --disable-multilib
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200511 (experimental) (GCC) 

$ gcc -Og -g -o opt_2 a.c

$ lldb opt_2

(lldb) b main
Breakpoint 1: where = opt_2`main + 4 at a.c:6:3, address = 0x000000000040050e
(lldb) r
Process 313 launched: 'opt_2' (x86_64)
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = breakpoint 1.1
    frame #0: 0x000000000040050e opt_2`main at a.c:6:3
   3    }
   4    
   5    int main() {
-> 6      a(0);
   7    }
(lldb) s
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
    frame #0: 0x00000000004004f2 opt_2`a(b=0) at a.c:1:11
-> 1    void a(b) {
   2      printf("%X\n");
   3    }
   4    
   5    int main() {
   6      a(0);
   7    }
(lldb) s
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
    frame #0: 0x00000000004004f6 opt_2`a(b=0) at a.c:2:3
   1    void a(b) {
-> 2      printf("%X\n");
   3    }
   4    
   5    int main() {
   6      a(0);
   7    }
(lldb) s
FFFFE5B8
Process 313 stopped
* thread #1, name = 'opt_2', stop reason = step in
    frame #0: 0x0000000000400505 opt_2`a(b=1) at a.c:3:1
   1    void a(b) {
   2      printf("%X\n");
-> 3    }
   4    
   5    int main() {
   6      a(0);
   7    }
(lldb) p b
(int) $0 = 1

-- 
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/20200512/1a84ace4/attachment.html>


More information about the lldb-dev mailing list