<html>
<head>
<base href="https://bugs.llvm.org/">
</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 and gdb compute different values for expressions"
href="https://bugs.llvm.org/show_bug.cgi?id=38076">38076</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lldb and gdb compute different values for expressions
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>tianxiao.gu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>chengniansun@gmail.com, davide@freebsd.org, llvm-bugs@lists.llvm.org, su@cs.ucdavis.edu
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20530" name="attach_20530" title="reproducing scripts">attachment 20530</a> <a href="attachment.cgi?id=20530&action=edit" title="reproducing scripts">[details]</a></span>
reproducing scripts
See attached zip file to reproduce the inconsistency.
Affected version:
lldb version 7.0.0 (<a href="http://llvm.org/svn/llvm-project/lldb/trunk">http://llvm.org/svn/llvm-project/lldb/trunk</a> revision
336302)
clang revision 336302
llvm revision 336302
~~~test.c
typedef unsigned int uint32_t;
struct S0 {
signed f2;
};
static g_463 = 0x1561983AL;
void func_1(void)
{
struct S0 l_19;
l_19.f2 = 419;
uint32_t l_4037 = 4294967295UL;
l_19.f2 = g_463; // break here and evaluate ((l_4037 % (-(g_463))) | l_19.f2)
}
int main()
{
func_1();
return 0;
}
~~~
~~~test.sh
#! /bin/bash
BASEDIR=$(pushd $(dirname $BASH_SOURCE[0]) > /dev/null && pwd && popd >
/dev/null)
readonly TEST_NAME=${1:-test.c}
readonly EXE=test.out
readonly CC=clang
readonly MODE=-m64
readonly LINE_NUMBER=12
rm -f $EXE
$CC -w ${MODE} -g3 -o $EXE $TEST_NAME
if [[ ! -f $EXE ]]
then
exit 1
fi
cat << EOF > lldb-cmds.txt
breakpoint set -file $TEST_NAME -line $LINE_NUMBER
process launch
print ((l_4037 % (-(g_463))) | l_19.f2)
EOF
cat << EOF > gdb-cmds.txt
break $TEST_NAME:$LINE_NUMBER
run
print ((l_4037 % (-(g_463))) | l_19.f2)
EOF
LLDB_OUTPUT=$(lldb -s lldb-cmds.txt --batch $EXE | grep "\$0" | awk -e '{print
$5}')
if [[ $? != 0 ]]
then
exit 1
fi
if [[ $LLDB_OUTPUT == "" ]]
then
exit 1
fi
GDB_OUTPUT=$(gdb -x gdb-cmds.txt --batch $EXE | grep "\$1" | awk -e '{print
$3}')
if [[ $? != 0 ]]
then
exit 1
fi
if [[ $GDB_OUTPUT == "" ]]
then
exit 1
fi
echo "LLDB_OUTPUT: $LLDB_OUTPUT, GDB_OUTPUT=$GDB_OUTPUT"
if [[ $LLDB_OUTPUT != $GDB_OUTPUT ]]
then
exit 0
else
exit 1
fi
~~~
Output:
LLDB_OUTPUT: 4294967295, GDB_OUTPUT=358717499</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>