Issues running lldb-Suite test cases while building Apple Swift 5 toolchain on PowerPC64LE

swift5
swift
#1

Facing following issues running lldb-Suite test cases while building Apple Swift 5 toolchain on PowerPC64LE.
Around 109 test cases fail with the same error message:-

	<bound method SBProcess.Kill of <lldb.SBProcess; proxy of <Swig Object of type 'lldb::SBProcess *' at 0x3fff8e8d51b0> >>: success

Following is the detailed failure of one of the failing test cases:-

	********************
	FAIL: lldb-Suite :: lang/swift/anytype_array/TestAnyTypeArray.py (755 of 1748)
	******************** TEST 'lldb-Suite :: lang/swift/anytype_array/TestAnyTypeArray.py' FAILED ********************
	lldb version 7.0.0 (https://github.com/apple/swift-lldb.git revision bdd5e8f63d81a08a39436469a0b24f467aab84ad)
	Swift version 5.0-dev (LLVM b02b353cf7, Swift 22bcbe510b)
	LLDB library dir: /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin
	LLDB import library dir: /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin
	Skipping following debug info categories: ['dsym', 'gmodules']

	Session logs for test failures/errors/unexpected successes will go into directory '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-traces'
	Command invoked: /home/sar/swift-source/lldb/test/dotest.py -q --arch= -s /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-traces --build-dir /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex -S nm -u CXXFLAGS -u CFLAGS --executable /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb --dsymutil /home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/./bin/dsymutil --filecheck /home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/./bin/FileCheck -C /home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang --swift-compiler /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swiftc --swift-library /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy --build-dir /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex --test-subdir lang/swift --skip-category=watchpoint --skip-category=dwo -t -E -Xcc -F/home/sar/swift-source/build/buildbot_linux/foundation-linux-powerpc64le/CoreFoundation-prefix/System/Library/Frameworks -I/home/sar/swift-source/build/buildbot_linux/foundation-linux-powerpc64le/swift -I/home/sar/swift-source/swift-corelibs-libdispatch -L/home/sar/swift-source/build/buildbot_linux/foundation-linux-powerpc64le -L/home/sar/swift-source/build/buildbot_linux/libdispatch-linux-powerpc64le -L/home/sar/swift-source/build/buildbot_linux/libdispatch-linux-powerpc64le/src -Xlinker -rpath -Xlinker /home/sar/swift-source/build/buildbot_linux/libdispatch-linux-powerpc64le/src -Xlinker -rpath -Xlinker /home/sar/swift-source/build/buildbot_linux/libdispatch-linux-powerpc64le -Xlinker -rpath -Xlinker /home/sar/swift-source/build/buildbot_linux/foundation-linux-powerpc64le /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array -p TestAnyTypeArray.py
	Change dir to: /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array
	UNSUPPORTED: LLDB (/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7-ppc64le) :: test_dsym (lldbsuite.test.lldbtest.TestAnyTypeArray) (test case does not fall in any category of interest for this run) 
	runCmd: settings set symbols.clang-modules-cache-path "/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-lldb"
	output: None

	runCmd: settings set symbols.enable-external-lookup false
	output: None


	os command: make VPATH=/home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array -C /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf -I /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array -f /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/Makefile MAKE_DSYM=NO ARCH=ppc64le  CC=/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7 SWIFTC=/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swiftc 
	with pid: 14541
	stdout: make: Entering directory '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf'
	### Compiling /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swift -frontend -c -primary-file /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift \
	   \
	  -g -Onone -serialize-debugging-options -module-cache-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-clang -sdk / -enable-anonymous-context-mangled-names -module-name a -emit-module-path \
	  /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/main.partial.swiftmodule \
	  -o /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/main.o
	### Merging swift modules for a
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swift -frontend -g -Onone -serialize-debugging-options -module-cache-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-clang -sdk / -enable-anonymous-context-mangled-names -merge-modules \
	  -emit-module main.partial.swiftmodule \
	  -emit-parseable-module-interface-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.swiftinterface \
	  -parse-as-library -sil-merge-partial-modules \
	  -disable-diagnostic-passes -disable-sil-perf-optzns \
	  -module-name a \
	  -o /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.swiftmodule
	### Wrapping swift module
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swift -modulewrap a.swiftmodule -o /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.swiftmodule.o
	### Linking a.out
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swiftc  a.swiftmodule.o main.o  -Onone -Xfrontend -serialize-debugging-options   -module-cache-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-clang -sdk "/" -o "a.out"
	make: Leaving directory '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf'

	stderr: /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift:6:7: warning: immutable value 'patatino' was never used; consider replacing with '_' or removing it
	  let patatino: [Any.Type] = [
		  ^~~~~~~~
		  _

	retcode: 0


	FAIL: LLDB (/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7-ppc64le) :: test_dwarf (lldbsuite.test.lldbtest.TestAnyTypeArray)
	**<bound method SBProcess.Kill of <lldb.SBProcess; proxy of <Swig Object of type 'lldb::SBProcess *' at 0x3fff8e8d51b0> >>: success**

	UNSUPPORTED: LLDB (/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7-ppc64le) :: test_dwo (lldbsuite.test.lldbtest.TestAnyTypeArray) (test case does not fall in any category of interest for this run) 
	UNSUPPORTED: LLDB (/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7-ppc64le) :: test_gmodules (lldbsuite.test.lldbtest.TestAnyTypeArray) (test case does not fall in any category of interest for this run) 
	Restore dir to: /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/test-results
	======================================================================
	FAIL: test_dwarf (lldbsuite.test.lldbtest.TestAnyTypeArray)
	----------------------------------------------------------------------
	Traceback (most recent call last):
	  File "/home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1766, in test_method
		return attrvalue(self)
	  File "/home/sar/swift-source/lldb/packages/Python/lldbsuite/test/decorators.py", line 145, in wrapper
		func(*args, **kwargs)
	  File "/home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lldbinline.py", line 134, in _test
		self.do_test()
	  File "/home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lldbinline.py", line 161, in do_test
		"inline test did not hit a single breakpoint")
	AssertionError: False is not True : inline test did not hit a single breakpoint
	Config=ppc64le-/home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/clang-7
	----------------------------------------------------------------------
	Ran 4 tests in 0.483s

	RESULT: FAILED (0 passes, 1 failures, 0 errors, 3 skipped, 0 expected failures, 0 unexpected successes)
(Davide C. C. Italiano) #2

This is the real error.
I suppose the binary didn't even run, hence the debugger can't attach and set breakpoint. Can you make sure the compiled binary runs correctly?

#3

@dcci

The Command invoked has following parameter:
--executable /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb

I tried the following basic verification:-

	sar@267538d18c75:~$ ll /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb                                          -rwxr-xr-x 1 sar sar 409432 Mar  1 07:04 /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb*
	sar@267538d18c75:~$ /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb --help
	OVERVIEW: LLDB

	USAGE: lldboptions

	ATTACHING:
	  --attach-name <name> Tells the debugger to attach to a process with the given name.
	  --attach-pid <pid>   Tells the debugger to attach to a process with the given pid.
	  -n <value>           Alias for --attach-name
	  -p <value>           Alias for --attach-pid
	  --wait-for           Tells the debugger to wait for a process with the given pid or name to launch before attaching.
	  -w                   Alias for --wait-for

	COMMANDS:
	  --batch              Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
	  -b                   Alias for --batch
	  -K <value>           Alias for --source-on-crash
	  -k <value>           Alias for --one-line-on-crash
	  --no-lldbinit        Do not automatically parse any '.lldbinit' files.
	  --one-line-before-file <command>
						   Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
	  --one-line-on-crash <command>
						   When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
	  --one-line <command> Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
	  -O <value>           Alias for --one-line-before-file
	  -o <value>           Alias for --one-line
	  -Q                   Alias for --source-quietly
	  --source-before-file <file>
						   Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
	  --source-on-crash <file>
						   When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
	  --source-quietly     Tells the debugger to execute this one-line lldb command before any file has been loaded.
	  --source <file>      Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
	  -S <value>           Alias for --source-before-file
	  -s <value>           Alias for --source
	  -x                   Alias for --no-lldbinit

	OPTIONS:
	  --arch <architecture> Tells the debugger to use the specified architecture when starting and running the program.
	  -a <value>            Alias for --arch
	  --capture <filename>  Tells the debugger to capture a reproducer to <filename>.
	  --core <filename>     Tells the debugger to use the full path to <filename> as the core file.
	  -c <value>            Alias for --core
	  --debug               Tells the debugger to print out extra information for debugging itself.
	  -d                    Alias for --debug
	  --editor              Tells the debugger to open source files using the host's "external editor" mechanism.
	  -e                    Alias for --editor
	  --file <filename>     Tells the debugger to use the file <filename> as the program to be debugged.
	  -f <value>            Alias for --file
	  --help                Prints out the usage information for the LLDB debugger.
	  -h                    Alias for --help
	  --no-use-colors       Do not use colors.
	  --replay <filename>   Tells the debugger to replay a reproducer from <filename>.
	  --version             Prints out the current version number of the LLDB debugger.
	  -v                    Alias for --version
	  -X                    Alias for --no-use-color

	REPL:
	  -r=<flags>     Alias for --repl=<flags>
	  --repl-language <language>
					 Chooses the language for the REPL.
	  --repl=<flags> Runs lldb in REPL mode with a stub process with the given flags.
	  --repl         Runs lldb in REPL mode with a stub process.
	  -R <value>     Alias for --repl-language
	  -r             Alias for --repl

	SCRIPTING:
	  -l <value>    Alias for --script-language
	  --python-path Prints out the path to the lldb.py file for this version of lldb.
	  -P            Alias for --python-path
	  --script-language <language>
					Tells the debugger to use the specified scripting language for user-defined scripts.

	EXAMPLES:
	  The debugger can be started in several modes.

	  Passing an executable as a positional argument prepares lldb to debug the
	  given executable. Arguments passed after -- are considered arguments to the
	  debugged executable.

		lldb --arch x86_64 /path/to/program -- --arch arvm7

	  Passing one of the attach options causes lldb to immediately attach to the
	  given process.

		lldb -p <pid>
		lldb -n <process-name>

	  Passing --repl starts lldb in REPL mode.

		lldb -r

	  Passing --core causes lldb to debug the core file.

		lldb -c /path/to/core

	  Command options can be combined with either mode and cause lldb to run the
	  specified commands before or after events, like loading the file or crashing,
	  in the order provided on the command line.

		lldb -O 'settings set stop-disassembly-count 20' -o 'run' -o 'bt'
		lldb -S /source/before/file -s /source/after/file
		lldb -K /source/before/crash -k /source/after/crash
	
	sar@267538d18c75:~$ /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb
	(lldb) script print "Here is some text"
	Here is some text
	(lldb) help
	Debugger commands:
	  apropos           -- List debugger commands related to a word or subject.
	  breakpoint        -- Commands for operating on breakpoints (see 'help b' for shorthand.)
	  bugreport         -- Commands for creating domain-specific bug reports.
	  command           -- Commands for managing custom LLDB commands.
	  disassemble       -- Disassemble specified instructions in the current target.  Defaults to the current function for the current thread and
						   stack frame.
	  expression        -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  frame             -- Commands for selecting and examing the current thread's stack frames.
	  gdb-remote        -- Connect to a process via remote GDB server.  If no host is specifed, localhost is assumed.
	  gui               -- Switch into the curses based GUI mode.
	  help              -- Show a list of all debugger commands, or give details about a specific command.
	  kdp-remote        -- Connect to a process via remote KDP server.  If no UDP port is specified, port 41139 is assumed.
	  language          -- Commands specific to a source language.
	  log               -- Commands controlling LLDB internal logging.
	  memory            -- Commands for operating on memory in the current target process.
	  platform          -- Commands to manage and create platforms.
	  plugin            -- Commands for managing LLDB plugins.
	  process           -- Commands for interacting with processes on the current platform.
	  quit              -- Quit the LLDB debugger.
	  register          -- Commands to access registers for the current thread and stack frame.
	  reproducer        -- Commands controlling LLDB reproducers.
	  script            -- Invoke the script interpreter with provided code and display any results.  Start the interactive interpreter if no
						   code is supplied.
	  settings          -- Commands for managing LLDB settings.
	  source            -- Commands for examining source code described by debug information for the current target process.
	  statistics        -- Print statistics about a debugging session
	  target            -- Commands for operating on debugger targets.
	  thread            -- Commands for operating on one or more threads in the current process.
	  type              -- Commands for operating on the type system.
	  version           -- Show the LLDB debugger version.
	  watchpoint        -- Commands for operating on watchpoints.
	Current command abbreviations (type 'help command alias' for more info):
	  add-dsym  -- Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using the
				   options to specify a module to download symbols for.
	  attach    -- Attach to process by ID or name.
	  b         -- Set a breakpoint using one of several shorthand formats.
	  bt        -- Show the current thread's call stack.  Any numeric argument displays at most that many frames.  The argument 'all' displays
				   all threads.
	  c         -- Continue execution of all threads in the current process.
	  call      -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  continue  -- Continue execution of all threads in the current process.
	  detach    -- Detach from the current target process.
	  di        -- Disassemble specified instructions in the current target.  Defaults to the current function for the current thread and stack
				   frame.
	  dis       -- Disassemble specified instructions in the current target.  Defaults to the current function for the current thread and stack
				   frame.
	  display   -- Evaluate an expression at every stop (see 'help target stop-hook'.)
	  down      -- Select a newer stack frame.  Defaults to moving one frame, a numeric argument can specify an arbitrary number.
	  env       -- Shorthand for viewing and setting environment variables.
	  exit      -- Quit the LLDB debugger.
	  f         -- Select the current stack frame by index from within the current thread (see 'thread backtrace'.)
	  file      -- Create a target using the argument as the main executable.
	  finish    -- Finish executing the current stack frame and stop after returning.  Defaults to current thread unless specified.
	  image     -- Commands for accessing information for one or more target modules.
	  j         -- Set the program counter to a new address.
	  jump      -- Set the program counter to a new address.
	  kill      -- Terminate the current target process.
	  l         -- List relevant source code using one of several shorthand formats.
	  list      -- List relevant source code using one of several shorthand formats.
	  n         -- Source level single step, stepping over calls.  Defaults to current thread unless specified.
	  next      -- Source level single step, stepping over calls.  Defaults to current thread unless specified.
	  nexti     -- Instruction level single step, stepping over calls.  Defaults to current thread unless specified.
	  ni        -- Instruction level single step, stepping over calls.  Defaults to current thread unless specified.
	  p         -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  parray    -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  po        -- Evaluate an expression on the current thread.  Displays any returned value with formatting controlled by the type's author.
	  poarray   -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  print     -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  q         -- Quit the LLDB debugger.
	  r         -- Launch the executable in the debugger.
	  rbreak    -- Sets a breakpoint or set of breakpoints in the executable.
	  repl      -- Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.
	  run       -- Launch the executable in the debugger.
	  s         -- Source level single step, stepping into calls.  Defaults to current thread unless specified.
	  si        -- Instruction level single step, stepping into calls.  Defaults to current thread unless specified.
	  sif       -- Step through the current block, stopping if you step directly into a function whose name matches the TargetFunctionName.
	  step      -- Source level single step, stepping into calls.  Defaults to current thread unless specified.
	  stepi     -- Instruction level single step, stepping into calls.  Defaults to current thread unless specified.
	  t         -- Change the currently selected thread.
	  tbreak    -- Set a one-shot breakpoint using one of several shorthand formats.
	  undisplay -- Stop displaying expression at every stop (specified by stop-hook index.)
	  up        -- Select an older stack frame.  Defaults to moving one frame, a numeric argument can specify an arbitrary number.
	  v         -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local,
				   file static and file global variables can be specified. Children of aggregate variables can be specified such as
				   'var->child.x'.  The -> and [] operators in 'frame variable' do not invoke operator overloads if they exist, but directly
				   access the specified element.  If you want to trigger operator overloads use the expression command to print the variable
				   instead.
				   It is worth noting that except for overloaded operators, when printing local variables 'expr local_var' and 'frame var
				   local_var' produce the same results.  However, 'frame variable' is more efficient, since it uses debug information and memory
				   reads directly, rather than parsing and evaluating an expression, which may even involve JITing and running code in the target
				   program.
	  var       -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local,
				   file static and file global variables can be specified. Children of aggregate variables can be specified such as
				   'var->child.x'.  The -> and [] operators in 'frame variable' do not invoke operator overloads if they exist, but directly
				   access the specified element.  If you want to trigger operator overloads use the expression command to print the variable
				   instead.
				   It is worth noting that except for overloaded operators, when printing local variables 'expr local_var' and 'frame var
				   local_var' produce the same results.  However, 'frame variable' is more efficient, since it uses debug information and memory
				   reads directly, rather than parsing and evaluating an expression, which may even involve JITing and running code in the target
				   program.
	  vo        -- Show variables for the current stack frame. Defaults to all arguments and local variables in scope. Names of argument, local,
				   file static and file global variables can be specified. Children of aggregate variables can be specified such as
				   'var->child.x'.  The -> and [] operators in 'frame variable' do not invoke operator overloads if they exist, but directly
				   access the specified element.  If you want to trigger operator overloads use the expression command to print the variable
				   instead.
				   It is worth noting that except for overloaded operators, when printing local variables 'expr local_var' and 'frame var
				   local_var' produce the same results.  However, 'frame variable' is more efficient, since it uses debug information and memory
				   reads directly, rather than parsing and evaluating an expression, which may even involve JITing and running code in the target
				   program.
	  x         -- Read from the memory of the current target process.
	For more information on any command, type 'help <command-name>'.
	(lldb)

Anything else that I should be trying/verifying?

(Davide C. C. Italiano) #4

When I say run the executable, I mean, run the inferior, i.e. the program being debugged.

#5

Do you mean this in the above example:-
/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out

	sar@267538d18c75:~/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.ll
	dbtest.test_dwarf$ ll
	total 136
	drwxr-xr-x 2 sar sar  4096 Mar  1 07:33 ./
	drwxr-xr-x 3 sar sar  4096 Mar  1 07:33 ../
	-rw-r--r-- 1 sar sar   113 Mar  1 07:33 Makefile
	**-rwxr-xr-x 1 sar sar 74368 Mar  1 07:33 a.out***
	-rw-r--r-- 1 sar sar   179 Mar  1 07:33 a.swiftinterface
	-rw-r--r-- 1 sar sar 11184 Mar  1 07:33 a.swiftmodule
	-rw-r--r-- 1 sar sar 11784 Mar  1 07:33 a.swiftmodule.o
	-rw-r--r-- 1 sar sar  6616 Mar  1 07:33 main.o
	-rw-r--r-- 1 sar sar 11184 Mar  1 07:33 main.partial.swiftmodule
(Davide C. C. Italiano) #6

Yes, a.out, exactly.

#8
	sar@267538d18c75:~/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.ll
	dbtest.test_dwarf$ /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/./bin/lldb
	(lldb) target create /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out
	Current executable set to '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out' (powerpc64le).
	(lldb) run
	Process 27906 launched: '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out' (powerpc64le)
	Process 27906 exited with status = 0 (0x00000000)
	(lldb)
(Davide C. C. Italiano) #9

Sorry, I ran out of ideas here. You need to debug why the breakpoint is not hit, as your setup is relatively unique (PPC64, which we don't support explicitly), and I can't really reproduce on any machine I got (I tried linux too). If you have something more specific, don't hesitate to ask.

#10

@dcci
Iam invoking the toolchain and the tests using the following command:-

	./swift/utils/build-toolchain srtbundle --test

I assume this creates a release build, where source files are compiled without any debug information.
So in that case the binaries(a.out and others) might not really help in debugging with lldb, hence the tests fail. Could this be the case here?

#11

@dcci, any inputs on the above comment?

(Davide C. C. Italiano) #12

The tests should always build with -g, so I'm not sure whether that's the problem.
You might want to try running the tests manually with lldb to make sure the breakpoints are hit. Sorry I can't be more helpful, but I don't have anything similar to your setup handy to give a try.

#13

Hi @dcci ,

Looks like the tests are built with -g option:-

	### Compiling /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swift -frontend -c -primary-file /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift \
	   \
	  -g -Onone -serialize-debugging-options -module-cache-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-clang -sdk / -enable-anonymous-context-mangled-names -module-name a -emit-module-path \
	  /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/main.partial.swiftmodule \
	  -o /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/main.o
	### Merging swift modules for a
	/home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/bin/swift -frontend -g -Onone -serialize-debugging-options -module-cache-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/module-cache-clang -sdk / -enable-anonymous-context-mangled-names -merge-modules \
	  -emit-module main.partial.swiftmodule \
	  -emit-parseable-module-interface-path /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.swiftinterface \
	  -parse-as-library -sil-merge-partial-modules \
	  -disable-diagnostic-passes -disable-sil-perf-optzns \
	  -module-name a \
	  -o /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.swiftmodule

I tried manually debugging the test binary, and here is the output:-

	sar@e2641fd15168:~$ /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/bin/lldb
	(lldb) target create /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out
	Current executable set to '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out' (powerpc64le).
	(lldb) breakpoint set -f /home/sar/swift-source/lldb/packages/Python/lldbsuite/test/lang/swift/anytype_array/main.swift -l 14
	Breakpoint 1: where = a.out`main + 28 at main.swift:14:9, address = 0x0000000000000dbc
	(lldb) b main
	Breakpoint 2: 2 locations.
	(lldb) run
	Process 5911 launched: '/home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out' (powerpc64le)
	Process 5911 stopped
	* thread #1, name = 'a.out', stop reason = breakpoint 1.1 2.1
		frame #0: 0x0000000020000dbc a.out`main at main.swift:14:9
	   11     return 0 //%self.expect('frame variable -d run -- patatino', substrs=['Any.Type', '3 values', 'String', 'Int', 'Float'])
	   12   }
	   13
	-> 14   let _ = main()
	Target 0: (a.out) stopped.
	(lldb) bt all
	* thread #1, name = 'a.out', stop reason = breakpoint 1.1 2.1
	  * frame #0: 0x0000000020000dbc a.out`main at main.swift:14:9
		frame #1: 0x00003fffb737309c libc.so.6
		frame #2: 0x00003fffb7373298 libc.so.6`__libc_start_main + 184
	(lldb) image list
	[  0] 6A70B8E5-8978-24E2-B6FB-CD2EA250BA58-77496103 0x0000000020000000 /home/sar/swift-source/build/buildbot_linux/lldb-linux-powerpc64le/lldb-test-build.noindex/lang/swift/anytype_array/lldbsuite.test.lldbtest.test_dwarf/a.out
	[  1] 79B77F3A-F49D-6F75-0840-5120D5968CA9-0145C43B 0x00003fffb7fa0000 /lib/powerpc64le-linux-gnu/ld-2.23.so
	[  2] 8FF97540-619C-F153-7002-5627A4A87181-B9D1C08F 0x00003fffb7f80000 [vdso] (0x00003fffb7f80000)
	[  3] 3870E4E4 0x00003fffb7f00000 /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux/libswiftSwiftOnoneSupport.so
	[  4] A8C44F75 0x00003fffb7860000 /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux/libswiftCore.so
	[  5] 704EB228-6146-630E-7C5D-DE01D9FC81A4-02C264CE 0x00003fffb7640000 /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6
	[  6] 88162EB5-0FAB-9455-1A1F-DA0D4804EE49-DDB88487 0x00003fffb7550000 /lib/powerpc64le-linux-gnu/libm.so.6
	[  7] 214936BC-5342-4FA4-02F8-0A9BDD696868-C8FAE57E 0x00003fffb7520000 /lib/powerpc64le-linux-gnu/libgcc_s.so.1
	[  8] 3201796D-D0A0-95E1-1FCC-32539807A6EF-D37B1F01 0x00003fffb7350000 /lib/powerpc64le-linux-gnu/libc.so.6
	[  9] 6B35AAA8-FB77-6536-3D47-C5FBFCA1D41F-DCB55B14 0x00003fffb7310000 /lib/powerpc64le-linux-gnu/libpthread.so.0
	[ 10] A6DD345B-37DB-0CD4-1028-8C3E113AA9A7-6B3BD3ED 0x00003fffb72e0000 /usr/lib/powerpc64le-linux-gnu/libatomic.so.1
	[ 11] 7AE2513B-2B12-9C1E-4E48-3869012B5849-9A7CCA93 0x00003fffb72b0000 /lib/powerpc64le-linux-gnu/libdl.so.2
	[ 12] 1B52A2A3-E49D-38E7-05C6-1CED403ADFB1-15D6EDE6 0x00003fffb6f10000 /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicui18nswift.so.61
	[ 13] FC86F283-3712-3F13-DD26-CDD76B292E4B-ED2D3629 0x00003fffb6cc0000 /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicuucswift.so.61
	[ 14] BDAFEB7C-12EF-60B4-F753-765C2B2EBA12-0900EA0A 0x00003fffb5300000 /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicudataswift.so.61
	(lldb) thread list
	Process 5911 stopped
	* thread #1: tid = 5911, 0x0000000020000dbc a.out`main at main.swift:14:9, name = 'a.out', stop reason = breakpoint 1.1 2.1
	(lldb) continue
	Process 5911 resuming
	Process 5911 stopped
	* thread #1, name = 'a.out', stop reason = breakpoint 2.2
		frame #0: 0x0000000020000e10 a.out`main() at main.swift:7:5
	   4
	   5    func main() -> Int {
	   6      let patatino: [Any.Type] = [
	-> 7        String.self,
	   8        Int.self,
	   9        Float.self,
	   10     ]
	Target 0: (a.out) stopped.
	(lldb) bt all
	* thread #1, name = 'a.out', stop reason = breakpoint 2.2
	  * frame #0: 0x0000000020000e10 a.out`main() at main.swift:7:5
		frame #1: 0x0000000020000dc0 a.out`main at main.swift:14:9
		frame #2: 0x00003fffb737309c libc.so.6
		frame #3: 0x00003fffb7373298 libc.so.6`__libc_start_main + 184
	(lldb) continue
	Process 5911 resuming
	Process 5911 exited with status = 0 (0x00000000)
	(lldb)

Not sure what am I missing.

(Davide C. C. Italiano) #14

If this works then the bug it's likely to be in the test driver (dotest.py)

try to run a single test with dotest.py -p TestName -t --no-multiprocess where TestName is the name of one of the tests failing for you. At that point what I would do is grabbing the python invocation that fails and attach with the python debugger pdb to see why that fails.
Sorry I can't be more helpful here.

#15

Hi @dcci ,

Thanks a lot for all your help and patience with all my queries. :slight_smile:

Used the 'llvm-readelf' utility to find details about the libraries linked with lldb binary and realised that the directories mentioned in RUNPATH might not have the required libraries.

Similar to reasons mentioned in my earlier issue "TestFoundation test suite failing while building Swift Toolchain", I manually copied the libraries and it worked. The lldb test suite was executed, though it fails now for only 7 test cases:-
Failing Tests (7):
LLDB :: SwiftREPL/ErrorReturn.test
LLDB :: tools/lldb-mi/symbol/symbol-list-lines.test
lldb-Suite :: lang/swift/dwarfimporter/C/TestSwiftDWARFImporterC.py
lldb-Suite :: lang/swift/reference_storage_types/TestSwiftReferenceStorageTypes.py
lldb-Suite :: lang/swift/repl_in_c/TestSwiftReplInC.py
lldb-Suite :: lang/swift/unknown_self/TestSwiftUnknownSelf.py
lldb-Suite :: lang/swift/variables/swift/TestSwiftTypes.py

TestFoundation test suite failing while building Swift Toolchain
#16

Attached to this issue are the details of the final 7 failing lldb tests. - https://bugs.swift.org/browse/SR-9888