[lldb-dev] [Bug 38076] New: lldb and gdb compute different values for expressions
via lldb-dev
lldb-dev at lists.llvm.org
Thu Jul 5 21:40:17 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38076
Bug ID: 38076
Summary: lldb and gdb compute different values for expressions
Product: lldb
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: lldb-dev at lists.llvm.org
Reporter: tianxiao.gu at gmail.com
CC: chengniansun at gmail.com, davide at freebsd.org,
llvm-bugs at lists.llvm.org, su at cs.ucdavis.edu
Created attachment 20530
--> https://bugs.llvm.org/attachment.cgi?id=20530&action=edit
reproducing scripts
See attached zip file to reproduce the inconsistency.
Affected version:
lldb version 7.0.0 (http://llvm.org/svn/llvm-project/lldb/trunk 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
--
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/20180706/c28e5c9d/attachment.html>
More information about the lldb-dev
mailing list