Skip to content

Commit 8a4efd2

Browse files
committed
Fix TestDataFormatter.test uninitialized variable
After D55626 I see a failure in my Fedora buildbot. There is uninitialized variable as the Foo constructor has not been run and foo is an autovariable. (lldb) breakpoint set -f foo.cpp -l 11 Breakpoint 1: where = TestDataFormatter.test.tmp.out`main + 30 at foo.cpp:11:7, address = 0x000000000040112e (lldb) run Process 801065 stopped * thread #1, name = 'TestDataFormatt', stop reason = breakpoint 1.1 frame #0: 0x000000000040112e TestDataFormatter.test.tmp.out`main(argc=1, argv=0x00007fffffffcc48) at foo.cpp:11:7 8 }; 9 10 int main(int argc, char **argv) { -> 11 Foo foo(1, 2.22); 12 return 0; 13 } Process 801065 launched: '.../tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out' (x86_64) (lldb) frame var (int) argc = 1 (char **) argv = 0x00007fffffffcc48 (Foo) foo = (m_i = 4198432, m_d = 0) While the testcase expects m_i will be 0. Differential Revision: https://reviews.llvm.org/D59088 llvm-svn: 355611
1 parent 0ccc0b1 commit 8a4efd2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
breakpoint set -f foo.cpp -l 11
22
run
3-
frame var
3+
frame var foo
44
next
5-
frame var
5+
frame var foo
66
cont
77
reproducer generate

lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class Foo {
88
};
99

1010
int main(int argc, char **argv) {
11-
Foo foo(1, 2.22);
11+
static Foo foo(1, 2.22);
1212
return 0;
1313
}

lldb/lit/Reproducer/Functionalities/TestDataFormatter.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This tests that data formatters continue to work when replaying a reproducer.
44

55
# RUN: rm -rf %t.repro
6-
# RUN: %clang %S/Inputs/foo.cpp -g -o %t.out
6+
# RUN: %clangxx %S/Inputs/foo.cpp -g -o %t.out
77

88
# RUN: %lldb -x -b -s %S/Inputs/DataFormatter.in --capture %t.repro %t.out | FileCheck %s
99
# RUN: %lldb --replay %t.repro | FileCheck %s

0 commit comments

Comments
 (0)