[lldb-dev] [Bug 45944] New: LLDB print wrong value for a parameter at Og

2020-05-15 Thread via lldb-dev
https://bugs.llvm.org/show_bug.cgi?id=45944

Bug ID: 45944
   Summary: LLDB print wrong value for a parameter at Og
   Product: lldb
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Keywords: wrong-debug
  Severity: enhancement
  Priority: P
 Component: All Bugs
  Assignee: lldb-dev@lists.llvm.org
  Reporter: massare...@diag.uniroma1.it
CC: ditali...@apple.com, jdevliegh...@apple.com,
llvm-b...@lists.llvm.org

LLDB show a wrong value at line 10 for parameter val in function ff.

$ cat a.c
typedef int uint32_t;
uint32_t a[256];
uint32_t c, e, f, g, h;
void d(b) {
   c = a[(c ^ b) & 255];
}

void ff(uint32_t val) {
  d(val >> 8);
  c = a[(c ^ 24) & 255];
}

int main() {
ff(47656);
}

$ clang -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
c25b20c0f6c13d68dbc2e185764082d61ae4a132)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Selected GCC installation: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/11.0.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

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

$ gdb -v
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git

$ clang -Og -g -o opt amod.c

$ lldb opt
(lldb) b ff
Breakpoint 1: where = opt`ff + 1 at amod.c:9:9, address = 0x004004a1
(lldb) r
Process 60 launched: 'opt' (x86_64)
Process 60 stopped
* thread #1, name = 'opt', stop reason = breakpoint 1.1
frame #0: 0x004004a1 opt`ff(val=47656) at amod.c:9:9
   6}
   7
   8void ff(uint32_t val) {
-> 9  d(val >> 8);
   10 c = a[(c ^ 24) & 255];
   11   }
   12   
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x00400484 opt`d(b=186) at amod.c:5:11
   2uint32_t a[256];
   3uint32_t c, e, f, g, h;
   4void d(b) {
-> 5   c = a[(c ^ b) & 255];
   6}
   7
   8void ff(uint32_t val) {
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x0040049a opt`d(b=186) at amod.c:6:1
   3uint32_t c, e, f, g, h;
   4void d(b) {
   5   c = a[(c ^ b) & 255];
-> 6}
   7
   8void ff(uint32_t val) {
   9  d(val >> 8);
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x004004a9 opt`ff(val=186) at amod.c:10:10
   7
   8void ff(uint32_t val) {
   9  d(val >> 8);
-> 10 c = a[(c ^ 24) & 255];
   11   }
   12   
   13   int main() {
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x004004c1 opt`ff(val=186) at amod.c:11:1
   8void ff(uint32_t val) {
   9  d(val >> 8);
   10 c = a[(c ^ 24) & 255];
-> 11   }
   12   
   13   int main() {
   14   ff(47656);
(lldb) s
Process 60 stopped
* thread #1, name = 'opt', stop reason = step in
frame #0: 0x004004db opt`main at amod.c:15:1
   12   
   13   int main() {
   14   ff(47656);
-> 15   }
(lldb) s

$ gdb opt
(gdb) b ff
Breakpoint 1 at 0x4004a1: file amod.c, line 9.
(gdb) r
Starting program: opt 

Breakpoint 1, ff (val=val@entry=47656) at amod.c:9
9 d(val >> 8);
(gdb) s
d (b=186) at amod.c:5
5  c = a[(c ^ b) & 255];
(gdb) s
d (b=186) at amod.c:6
6   }
(gdb) s
ff (val=val@entry=47656) at amod.c:10
10c = a[(c ^ 24) & 255];
(gdb) p val
$1 = 47656
(gdb) s
11  }
(gdb) s
main () at amod.c:15
15  }
(gdb) s

-- 
You are receiving this mail because:
You are the assignee for the bug.___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


[lldb-dev] Pre-merge lldb testing

2020-05-15 Thread Eric Christopher via lldb-dev
Hi All,

We've been testing[1] a number of patches upstream by default via some
pre-merge checks in phabricator. I was thinking of turning them on for lldb
as well. Mostly it well just help people know whether or not they've broken
lldb before they commit something, but won't stop committing or do anything
else that direction.

Let me know what you think and otherwise I'd like to turn it on in a week
or so. This will also help keep the test suite a little cleaner on linux
FWIW.

There are a few additional links down below and if you have any questions
send them my way.

Thanks!

-eric


[1]
https://github.com/google/llvm-premerge-checks/blob/master/docs/user_doc.md
[2] https://reviews.llvm.org/project/members/78/
[3] https://github.com/google/llvm-premerge-checks/issues
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev