[Lldb-commits] [lldb] r355611 - Fix TestDataFormatter.test uninitialized variable

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 7 09:35:47 PST 2019


Author: jankratochvil
Date: Thu Mar  7 09:35:47 2019
New Revision: 355611

URL: http://llvm.org/viewvc/llvm-project?rev=355611&view=rev
Log:
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

Modified:
    lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
    lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp
    lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test

Modified: lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in?rev=355611&r1=355610&r2=355611&view=diff
==============================================================================
--- lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/Inputs/DataFormatter.in Thu Mar  7 09:35:47 2019
@@ -1,7 +1,7 @@
 breakpoint set -f foo.cpp -l 11
 run
-frame var
+frame var foo
 next
-frame var
+frame var foo
 cont
 reproducer generate

Modified: lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp?rev=355611&r1=355610&r2=355611&view=diff
==============================================================================
--- lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/Inputs/foo.cpp Thu Mar  7 09:35:47 2019
@@ -8,6 +8,6 @@ private:
 };
 
 int main(int argc, char **argv) {
-  Foo foo(1, 2.22);
+  static Foo foo(1, 2.22);
   return 0;
 }

Modified: lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test?rev=355611&r1=355610&r2=355611&view=diff
==============================================================================
--- lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test (original)
+++ lldb/trunk/lit/Reproducer/Functionalities/TestDataFormatter.test Thu Mar  7 09:35:47 2019
@@ -3,7 +3,7 @@
 # This tests that data formatters continue to work when replaying a reproducer.
 
 # RUN: rm -rf %t.repro
-# RUN: %clang %S/Inputs/foo.cpp -g -o %t.out
+# RUN: %clangxx %S/Inputs/foo.cpp -g -o %t.out
 
 # RUN: %lldb -x -b -s %S/Inputs/DataFormatter.in --capture %t.repro %t.out | FileCheck %s
 # RUN: %lldb --replay %t.repro | FileCheck %s




More information about the lldb-commits mailing list