[Lldb-commits] [PATCH] D59088: Fix TestDataFormatter.test uninitialized variable

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 7 03:50:55 PST 2019


jankratochvil created this revision.
jankratochvil added a reviewer: JDevlieghere.
jankratochvil added a project: LLDB.
Herald added subscribers: teemperor, jfb.

After D55626 <https://reviews.llvm.org/D55626> I see a failure in my Fedora buildbot <http://lab.llvm.org:8014/builders/lldb-x86_64-fedora/builds/344/steps/test/logs/stdio>:

  FAIL: LLDB :: Reproducer/Functionalities/TestDataFormatter.test (76 of 1540)
  ******************** TEST 'LLDB :: Reproducer/Functionalities/TestDataFormatter.test' FAILED ********************
  Script:
  --
  : 'RUN: at line 5';   rm -rf /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.repro
  : 'RUN: at line 6';   /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/bin/clang -pthread /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp -g -o /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out
  : 'RUN: at line 8';   /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/bin/lldb --no-lldbinit -S /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/lit-lldb-init -x -b -s /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/Reproducer/Functionalities/Inputs/DataFormatter.in --capture /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.repro /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out | /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/bin/FileCheck /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
  : 'RUN: at line 9';   /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/bin/lldb --no-lldbinit -S /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/lit-lldb-init --replay /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.repro | /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/build/bin/FileCheck /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  /home/jkratoch/slave-lldb-x86_64-fedora/lldb-x86_64-fedora/llvm/tools/lldb/lit/Reproducer/Functionalities/TestDataFormatter.test:12:10: error: CHECK: expected string not found in input
  # CHECK: (Foo) foo = (m_i = 0, m_d = 0)
           ^
  <stdin>:15:2: note: scanning from here
   frame #0: 0x000000000040112e TestDataFormatter.test.tmp.out`main(argc=1, argv=0x00007fffffffea08) at foo.cpp:11:7
   ^
  <stdin>:43:1: note: possible intended match here
  (Foo) foo = (m_i = 1, m_d = 2)
  ^

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: '/home/jkratoch/redhat/llvm-monorepo-clangassert/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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59088

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


Index: lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
===================================================================
--- lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
+++ lldb/lit/Reproducer/Functionalities/TestDataFormatter.test
@@ -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
Index: lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp
===================================================================
--- lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp
+++ lldb/lit/Reproducer/Functionalities/Inputs/foo.cpp
@@ -8,6 +8,6 @@
 };
 
 int main(int argc, char **argv) {
-  Foo foo(1, 2.22);
+  static Foo foo(1, 2.22);
   return 0;
 }
Index: lldb/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
===================================================================
--- lldb/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
+++ lldb/lit/Reproducer/Functionalities/Inputs/DataFormatter.in
@@ -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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59088.189685.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190307/fd647c62/attachment-0001.bin>


More information about the lldb-commits mailing list