<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61723>61723</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb bug] Fail to report parameter value near the function tail
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jwnhy
</td>
</tr>
</table>
<pre>
Tested on the top-of-tree `lldb`
Given the following code
```c
int a[1];
int c;
int crc32_byte (int b) {
c =
a[c ^ b];
}
int main()
{
crc32_byte (a[0]);
}
```
Compiled using `gcc 11.3.0`
Execute the following command
```
(lldb) target create "a.out"
Current executable set to '/home/hluaw/debugger-bugs/para_lost/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 4 at r.c:9:7, address = 0x000000000000114b
(lldb) r
Process 773334 launched: '/home/hluaw/debugger-bugs/para_lost/a.out' (x86_64)
Process 773334 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x000055555555514b a.out`main at r.c:9:7
6 }
7 int main()
8 {
-> 9 crc32_byte (a[0]);
10 }
(lldb) s
Process 773334 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x0000555555555129 a.out`crc32_byte(b=0) at r.c:3:24
1 int a[1];
2 int c;
-> 3 int crc32_byte (int b) {
4 c =
5 a[c ^ b];
6 }
7 int main()
(lldb) s
Process 773334 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x000055555555512d a.out`crc32_byte(b=0) at r.c:5:7
2 int c;
3 int crc32_byte (int b) {
4 c =
-> 5 a[c ^ b];
6 }
7 int main()
8 {
(lldb) s
Process 773334 stopped
* thread #1, name = 'a.out', stop reason = step in
frame #0: 0x000055555555513d a.out`crc32_byte(b=<unavailable>) at r.c:4:4
1 int a[1];
2 int c;
3 int crc32_byte (int b) {
-> 4 c =
5 a[c ^ b];
6 }
7 int main()
```
The `b` should still be in scope (line 4), but `lldb` already cannot obtain the value of `b` and says unavailable.
Examing the execution of `lldb` shows that when stepping from line 5 to line 4, the frame has already been propogated to `main`, which is incorrect.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVk2T2ygT_jXtS9eoJNDnwQfPePxe30PuKZDalrIIVIDGmX-_BfLXxN4ktZtUhbItC-ivpxv6Ec4NB020huIZiu1KzL43dv3lqPv3lTTd-_oTOU8dGo2-J_RmejL7J2-JEMpUqU5CmUK6hXTzv-GNll17o5Q5DvqAreloWQ3b4qdd3gftUUDxnEGxBf58nWw_vtmWs8_y3RMCq8OMBNYgVKc92CLw7el_VNgiFK8ob9VCtb1qHMWggdXAmvPiWVUcHw0GhWlQxZp7bZeQltcXM06Dog5nF0KHMj20LWZZwpPrptev1M6e7mAaR6G7h2qB1RFm1qAX9kABExLRPSYSM3tg7OTAbC1pjxRtCKkIHXn0BoFVwHa9GSk81CyOwHYdyflwIPsk54MDtpuEFZ-VcR7Y7qS4Chh8rcvPZQ6sSe4ckguacfrZkvhrMgHiDPgGjz1ZCsnBRVmZhr0I7BlzFB5t0gLfNMA3FbAXFF1nybkokH5Nb0aW5fLOsl1m_m9NG6SqinOeoxKzbnvqgv1fE_NDM86baaJzutgGfW9JdAiMZyEWLcYlcmDVWWuYD3JoSTij47K8gSzJTlW4t1Ga8TREsUBRnEeWy49wfgPkuZDLUMqXQkXECh_VPiLWy85TbT8Bf8UGL-PHpwERs_Rq6iZF7rdi5zxNeK694Or3cWPNBbdrTMBqCXybBm8vQHLgG5Zfgwu6H15WiMjOi9dLKyLIL_M_ur4Q8wXo22sMiwX9f7jOHuf3ZPHuevtTE9L9bEKKD5X9AHLE_wZ4TNkvhPzuVP2pOeDfyQHwl1mLNzGo0EiAv37ISR6_P3lG_n22YmZ-9wH5pt3G30995DeB3KDrzaw6dH5QCiXhoNG1Zoouq0ETxj7BXlDO_oYUoVAhh-_YCq2NRyN9uLBD438TaiY0-4sJoTt04t3hDeTJmTCIMVC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