<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - lldb-mi can't get variables of a frame (-stack-list-* MI-commands) if the thread didn't cause the stop event"
href="https://llvm.org/bugs/show_bug.cgi?id=28621">28621</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lldb-mi can't get variables of a frame (-stack-list-* MI-commands) if the thread didn't cause the stop event
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>edmunoz@microsoft.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16771" name="attach_16771" title="Simple repro">attachment 16771</a> <a href="attachment.cgi?id=16771&action=edit" title="Simple repro">[details]</a></span>
Simple repro
lldb-mi provides a set of commands to list variables from a stack frame,
namely: stack-list-variables -stack-list-arguments and -stack-list-locals.
In a multithreaded process, these commands return a empty list if queried for a
thread that didn't cause the stopped event.
The root cause for this bug is <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLDB thread states aren't properly maintained"
href="show_bug.cgi?id=15824">https://llvm.org/bugs/show_bug.cgi?id=15824</a>
lldb-mi checks the stopped reason for the thread being queried through those
commands and returns an empty list if the stopped reason in none or invalid.
This doesn't affect the normal command line interface for lldb (through the
similar command "frame variable") since lldb doesn't have such a strict check
(it just checks that the process is paused and that the frame exists).
In order to fix this bug, lldb-mi should perform the same checks as lldb.
Repro steps:
1. Compile the attached file a.cpp: clang++ -g a.cpp -lpthread
2. Start lldb-mi and execute the following
-file-exec-and-symbols "<path to a.out>"
-break-insert -f on a.cpp:5
-exec-run
After hitting the breakpoint
-stack-list-variables 0 --thread 1 --frame 5
^done,variables=[]
However, going through the non-MI command:
-interpreter-exec console "thread select 1"
-interpreter-exec console "frame select 5"
-interpreter-exec console "frame variable"
(int) argc = 1
(char **) argv = 0x00007fff5fbffee0
(int) x = 3
(int) y = 0
(pthread_t) id = 0x00000001000b6000
The expected result is:
-stack-list-variables 0 --thread 1 --frame 5
^done,variables=[{arg="1",name="argc"},{arg="1",name="argv"},{name="x"},{name="y"},{name="id"}]</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>