예제 #1
0
파일: build.py 프로젝트: crucible/deqp
def buildApp (buildRoot, androidBuildType, javaApi):
	appDir	= os.path.join(buildRoot, "package")

	# Set up app
	os.chdir(appDir)

	manifestSrcPath = os.path.normpath(os.path.join(common.ANDROID_DIR, "package", "AndroidManifest.xml"))
	manifestDstPath = os.path.normpath(os.path.join(appDir, "AndroidManifest.xml"))

	# Build dir can be the Android dir, in which case the copy is not needed.
	if manifestSrcPath != manifestDstPath:
		shutil.copy(manifestSrcPath, manifestDstPath)

	common.execArgs([
			common.ANDROID_BIN,
			'update', 'project',
			'--name', 'dEQP',
			'--path', '.',
			'--target', javaApi,
		])

	# Build
	common.execArgs([
			common.ANT_BIN,
			androidBuildType,
			"-Dsource.dir=" + os.path.join(common.ANDROID_DIR, "package", "src"),
			"-Dresource.absolute.dir=" + os.path.join(common.ANDROID_DIR, "package", "res")
		])
예제 #2
0
def buildApp (buildRoot, androidBuildType, javaApi, package):
	appDir	= os.path.join(buildRoot, package)

	# Set up app
	os.chdir(appDir)

	manifestSrcPath = os.path.normpath(os.path.join(common.ANDROID_DIR, package, "AndroidManifest.xml"))
	manifestDstPath = os.path.normpath(os.path.join(appDir, "AndroidManifest.xml"))

	# Build dir can be the Android dir, in which case the copy is not needed.
	if manifestSrcPath != manifestDstPath:
		shutil.copy(manifestSrcPath, manifestDstPath)

	common.execArgs([
			common.ANDROID_BIN,
			'update', 'project',
			'--name', 'dEQP',
			'--path', '.',
			'--target', javaApi,
		])

	# Build
	common.execArgs([
			common.ANT_BIN,
			androidBuildType,
			"-Dsource.dir=" + os.path.join(common.ANDROID_DIR, package, "src"),
			"-Dresource.absolute.dir=" + os.path.join(common.ANDROID_DIR,package, "res")
		])
예제 #3
0
def buildApp(buildRoot, isRelease):
    appDir = os.path.join(buildRoot, "package")

    # Set up app
    os.chdir(appDir)

    manifestSrcPath = os.path.normpath(
        os.path.join(common.ANDROID_DIR, "package", "AndroidManifest.xml"))
    manifestDstPath = os.path.normpath(
        os.path.join(appDir, "AndroidManifest.xml"))

    # Build dir can be the Android dir, in which case the copy is not needed.
    if manifestSrcPath != manifestDstPath:
        shutil.copy(manifestSrcPath, manifestDstPath)

    common.execArgs([
        common.ANDROID_BIN,
        'update',
        'project',
        '--name',
        'dEQP',
        '--path',
        '.',
        '--target',
        str(common.ANDROID_JAVA_API),
    ])

    # Build
    common.execArgs([
        common.ANT_BIN, "release" if isRelease else "debug",
        "-Dsource.dir=" + os.path.join(common.ANDROID_DIR, "package", "src"),
        "-Dresource.absolute.dir=" +
        os.path.join(common.ANDROID_DIR, "package", "res")
    ])
def buildNative (nativeLib, buildType):
	deqpDir		= os.path.normpath(os.path.join(common.ANDROID_DIR, ".."))
	buildDir	= getNativeBuildDir(nativeLib, buildType)
	assetsDir	= os.path.join(buildDir, "assets")
	libsDir		= os.path.join(common.ANDROID_DIR, "package", "libs", nativeLib.abiVersion)
	srcLibFile	= os.path.join(buildDir, "libtestercore.so")
	dstLibFile	= os.path.join(libsDir, "lib%s.so" % nativeLib.libName)

	# Remove old lib files if such exist
	if os.path.exists(srcLibFile):
		os.unlink(srcLibFile)

	if os.path.exists(dstLibFile):
		os.unlink(dstLibFile)

	# Remove assets directory so that we don't collect unnecessary cruft to the APK
	if os.path.exists(assetsDir):
		shutil.rmtree(assetsDir)

	# Make build directory if necessary
	if not os.path.exists(buildDir):
		os.makedirs(buildDir)
		os.chdir(buildDir)
		common.execArgs([
				'cmake',
				'-G%s' % common.CMAKE_GENERATOR,
				'-DCMAKE_TOOLCHAIN_FILE=%s/framework/delibs/cmake/toolchain-android-%s.cmake' % (deqpDir, common.ANDROID_NDK_TOOLCHAIN_VERSION),
				'-DANDROID_NDK_HOST_OS=%s' % common.ANDROID_NDK_HOST_OS,
				'-DANDROID_NDK_PATH=%s' % common.ANDROID_NDK_PATH,
				'-DANDROID_ABI=%s' % nativeLib.abiVersion,
				'-DDE_ANDROID_API=%s' % nativeLib.apiVersion,
				'-DCMAKE_BUILD_TYPE=%s' % buildType,
				'-DDEQP_TARGET=android',
				deqpDir
			])

	os.chdir(buildDir)
	common.execute(common.BUILD_CMD)

	if not os.path.exists(libsDir):
		os.makedirs(libsDir)

	# Copy libtestercore.so
	shutil.copyfile(srcLibFile, dstLibFile)

	# Copy gdbserver for debugging
	if buildType.lower() == "debug":
		if nativeLib.abiVersion == "x86":
			shutil.copyfile(os.path.join(common.ANDROID_NDK_PATH, "prebuilt/android-x86/gdbserver/gdbserver"), os.path.join(libsDir, "gdbserver"))
		elif nativeLib.abiVersion == "armeabi-v7a":
			shutil.copyfile(os.path.join(common.ANDROID_NDK_PATH, "prebuilt/android-arm/gdbserver/gdbserver"), os.path.join(libsDir, "gdbserver"))
		else:
			print("Unknown ABI. Won't copy gdbserver to package")
	elif os.path.exists(os.path.join(libsDir, "gdbserver")):
		# Make sure there is no gdbserver if build is not debug build
		os.unlink(os.path.join(libsDir, "gdbserver"))
예제 #5
0
def signApp(keystore, keyname, storepass, keypass):
    os.chdir(os.path.join(common.ANDROID_DIR, "package"))
    common.execArgs([
        common.JARSIGNER_BIN, '-keystore', keystore, '-storepass', storepass,
        '-keypass', keypass, '-sigfile', 'CERT', '-digestalg', 'SHA1',
        '-sigalg', 'MD5withRSA', '-signedjar', 'bin/dEQP-unaligned.apk',
        'bin/dEQP-release-unsigned.apk', keyname
    ])
    common.execArgs([
        common.ZIPALIGN_BIN, '-f', '4', 'bin/dEQP-unaligned.apk',
        'bin/dEQP-release.apk'
    ])
예제 #6
0
def buildNative (buildRoot, libTargetDir, nativeLib, buildType):
	deqpDir		= os.path.normpath(os.path.join(common.ANDROID_DIR, ".."))
	buildDir	= getNativeBuildDir(buildRoot, nativeLib, buildType)
	libsDir		= os.path.join(libTargetDir, nativeLib.abiVersion)
	srcLibFile	= os.path.join(buildDir, common.NATIVE_LIB_NAME)
	dstLibFile	= os.path.join(libsDir, common.NATIVE_LIB_NAME)

	# Make build directory if necessary
	if not os.path.exists(buildDir):
		os.makedirs(buildDir)
		os.chdir(buildDir)
		toolchainFile = '%s/framework/delibs/cmake/toolchain-android-%s.cmake' % (deqpDir, common.ANDROID_NDK_TOOLCHAIN_VERSION)
		common.execArgs([
				'cmake',
				'-G%s' % common.CMAKE_GENERATOR,
				'-DCMAKE_TOOLCHAIN_FILE=%s' % toolchainFile,
				'-DANDROID_NDK_HOST_OS=%s' % common.ANDROID_NDK_HOST_OS,
				'-DANDROID_NDK_PATH=%s' % common.ANDROID_NDK_PATH,
				'-DANDROID_ABI=%s' % nativeLib.abiVersion,
				'-DDE_ANDROID_API=%s' % nativeLib.apiVersion,
				'-DCMAKE_BUILD_TYPE=%s' % buildType,
				'-DDEQP_TARGET=android',
				deqpDir
			])

	os.chdir(buildDir)
	common.execArgs(['cmake', '--build', '.'] + common.EXTRA_BUILD_ARGS)

	if not os.path.exists(libsDir):
		os.makedirs(libsDir)

	shutil.copyfile(srcLibFile, dstLibFile)

	# Copy gdbserver for debugging
	if buildType.lower() == "debug":
		srcGdbserverPath = os.path.join(common.ANDROID_NDK_PATH,
										'prebuilt',
										getPrebuiltsDirName(nativeLib.abiVersion),
										'gdbserver',
										'gdbserver')
		dstGdbserverPath = os.path.join(libsDir, 'gdbserver')
		shutil.copyfile(srcGdbserverPath, dstGdbserverPath)
	else:
		assert not os.path.exists(os.path.join(libsDir, "gdbserver"))
예제 #7
0
def buildNative(buildRoot, libTargetDir, nativeLib, buildType):
    deqpDir = os.path.normpath(os.path.join(common.ANDROID_DIR, ".."))
    buildDir = getNativeBuildDir(buildRoot, nativeLib, buildType)
    libsDir = os.path.join(libTargetDir, nativeLib.abiVersion)
    srcLibFile = os.path.join(buildDir, common.NATIVE_LIB_NAME)
    dstLibFile = os.path.join(libsDir, common.NATIVE_LIB_NAME)

    # Make build directory if necessary
    if not os.path.exists(buildDir):
        os.makedirs(buildDir)
        os.chdir(buildDir)
        toolchainFile = '%s/framework/delibs/cmake/toolchain-android-%s.cmake' % (
            deqpDir, common.ANDROID_NDK_TOOLCHAIN_VERSION)
        common.execArgs([
            'cmake',
            '-G%s' % common.CMAKE_GENERATOR,
            '-DCMAKE_TOOLCHAIN_FILE=%s' % toolchainFile,
            '-DANDROID_NDK_HOST_OS=%s' % common.ANDROID_NDK_HOST_OS,
            '-DANDROID_NDK_PATH=%s' % common.ANDROID_NDK_PATH,
            '-DANDROID_ABI=%s' % nativeLib.abiVersion,
            '-DDE_ANDROID_API=%s' % nativeLib.apiVersion,
            '-DCMAKE_BUILD_TYPE=%s' % buildType, '-DDEQP_TARGET=android',
            deqpDir
        ])

    os.chdir(buildDir)
    common.execArgs(['cmake', '--build', '.'] + common.EXTRA_BUILD_ARGS)

    if not os.path.exists(libsDir):
        os.makedirs(libsDir)

    shutil.copyfile(srcLibFile, dstLibFile)

    # Copy gdbserver for debugging
    if buildType.lower() == "debug":
        srcGdbserverPath = os.path.join(
            common.ANDROID_NDK_PATH, 'prebuilt',
            getPrebuiltsDirName(nativeLib.abiVersion), 'gdbserver',
            'gdbserver')
        dstGdbserverPath = os.path.join(libsDir, 'gdbserver')
        shutil.copyfile(srcGdbserverPath, dstGdbserverPath)
    else:
        assert not os.path.exists(os.path.join(libsDir, "gdbserver"))
예제 #8
0
파일: build.py 프로젝트: crucible/deqp
def signApp (keystore, keyname, storepass, keypass):
	os.chdir(os.path.join(common.ANDROID_DIR, "package"))
	common.execArgs([
			common.JARSIGNER_BIN,
			'-keystore', keystore,
			'-storepass', storepass,
			'-keypass', keypass,
			'-sigfile', 'CERT',
			'-digestalg', 'SHA1',
			'-sigalg', 'MD5withRSA',
			'-signedjar', 'bin/dEQP-unaligned.apk',
			'bin/dEQP-release-unsigned.apk',
			keyname
		])
	common.execArgs([
			common.ZIPALIGN_BIN,
			'-f', '4',
			'bin/dEQP-unaligned.apk',
			'bin/dEQP-release.apk'
		])
예제 #9
0
def install (extraArgs = []):
	curDir = os.getcwd()
	try:
		os.chdir(common.ANDROID_DIR)

		print "Removing old dEQP Package..."
		common.execArgs([common.ADB_BIN] + extraArgs + [
				'uninstall',
				'com.drawelements.deqp'
			])
		print ""

		print "Installing dEQP Package..."
		common.execArgs([common.ADB_BIN] + extraArgs + [
				'install',
				'-r',
				'package/bin/dEQP-debug.apk'
			])
		print ""

	finally:
		# Restore working dir
		os.chdir(curDir)
예제 #10
0
def debug(adbCmd, deqpCmdLine, targetGDBPort, hostGDBPort, jdbPort, jdbCmd,
          gdbCmd, buildDir, deviceLibs, breakpoints, serial, deviceGdbCmd,
          appProcessName, linkerName):

    programPid = -1
    gdbServerProcess = None
    gdbProcess = None
    jdbProcess = None
    curDir = os.getcwd()
    debugDir = os.path.join(common.ANDROID_DIR, "debug")
    serialArg = "-s " + serial if serial != None else ""

    if os.path.exists(debugDir):
        shutil.rmtree(debugDir)

    os.makedirs(debugDir)
    os.chdir(debugDir)
    try:
        # Start execution
        print("Starting intent...")
        common.execArgs([adbCmd] + (["-s", serial] if serial != None else []) +
                        [
                            "shell", "am", "start", "-W", "-D", "-n",
                            "com.drawelements.deqp/android.app.NativeActivity",
                            "-e", "cmdLine", "\"\"unused " + deqpCmdLine +
                            "\"\""
                        ])
        print("Intent started")

        # Kill existing gdbservers
        print("Check and kill existing gdbserver")
        gdbPid = getADBProgramPID(adbCmd, "gdbserver", serial)
        if gdbPid != -1:
            print("Found gdbserver with PID %i" % gdbPid)
            common.execArgs(
                [adbCmd] + (["-s", serial] if serial != None else []) + [
                    "shell", "run-as", "com.drawelements.deqp", "kill", "-9",
                    str(gdbPid)
                ])
            print("Killed gdbserver")
        else:
            print("Couldn't find existing gdbserver")

        programPid = getADBProgramPID(adbCmd,
                                      "com.drawelements.deqp:testercore",
                                      serial)

        print("Find process PID")
        if programPid == -1:
            common.die("Couldn't get PID of testercore")
        print("Process running with PID %i" % programPid)

        # Start gdbserver
        print(
            "Start gdbserver for PID %i redirect stdout to gdbserver-stdout.txt"
            % programPid)
        gdbServerProcess = subprocess.Popen(
            [adbCmd] + (["-s", serial] if serial != None else []) + [
                "shell", "run-as", "com.drawelements.deqp", deviceGdbCmd,
                "localhost:" + str(targetGDBPort), "--attach",
                str(programPid)
            ],
            stdin=subprocess.PIPE,
            stdout=open("gdbserver-stdout.txt", "wb"),
            stderr=open("gdbserver-stderr.txt", "wb"))
        print("gdbserver started")

        time.sleep(1)

        gdbServerProcess.poll()

        if gdbServerProcess.returncode != None:
            common.die(
                "gdbserver returned unexpectly with return code %i see gdbserver-stdout.txt for more info"
                % gdbServerProcess.returncode)

        # Setup port forwarding
        print("Forwarding local port to gdbserver port")
        common.execArgs([adbCmd] + (["-s", serial] if serial != None else []) +
                        [
                            "forward", "tcp:" + str(hostGDBPort), "tcp:" +
                            str(targetGDBPort)
                        ])

        # Pull some data files for debugger
        print("Pull /system/bin/%s from device" % appProcessName)
        common.execArgs([adbCmd] + (["-s", serial] if serial != None else []) +
                        ["pull", "/system/bin/" + str(appProcessName)])

        print("Pull /system/bin/%s from device" % linkerName)
        common.execArgs([adbCmd] + (["-s", serial] if serial != None else []) +
                        ["pull", "/system/bin/" + str(linkerName)])

        for lib in deviceLibs:
            print("Pull library %s from device" % lib)
            try:
                common.execArgs([adbCmd] +
                                (["-s", serial] if serial != None else []) +
                                ["pull", lib])
            except Exception as e:
                print("Failed to pull library '%s'. Error: %s" % (lib, str(e)))

        print("Copy %s from build dir" % common.NATIVE_LIB_NAME)
        shutil.copyfile(os.path.join(buildDir, common.NATIVE_LIB_NAME),
                        common.NATIVE_LIB_NAME)

        # Forward local port for jdb
        print("Forward local port to jdb port")
        common.execArgs(
            [adbCmd] + (["-s", serial] if serial != None else []) +
            ["forward", "tcp:" + str(jdbPort), "jdwp:" + str(programPid)])

        # Connect JDB
        print("Start jdb process redirectd stdout to jdb-stdout.txt")
        jdbProcess = subprocess.Popen([
            jdbCmd, "-connect",
            "com.sun.jdi.SocketAttach:hostname=localhost,port=" + str(jdbPort),
            "-sourcepath", "../package"
        ],
                                      stdin=subprocess.PIPE,
                                      stdout=open("jdb-stdout.txt", "wb"),
                                      stderr=open("jdb-stderr.txt", "wb"))
        print("Started jdb process")

        # Write gdb.setup
        print("Write gdb.setup")
        gdbSetup = open("gdb.setup", "wb")
        gdbSetup.write("file %s\n" % appProcessName)
        gdbSetup.write("set solib-search-path .\n")
        gdbSetup.write("target remote :%i\n" % hostGDBPort)
        gdbSetup.write("set breakpoint pending on\n")

        for breakpoint in breakpoints:
            print("Set breakpoint at %s" % breakpoint)
            gdbSetup.write("break %s\n" % breakpoint)

        gdbSetup.write("set breakpoint pending off\n")
        gdbSetup.close()

        print("Start gdb")
        gdbProcess = subprocess.Popen(common.shellquote(gdbCmd) +
                                      " -x gdb.setup",
                                      shell=True)

        gdbProcess.wait()

        print("gdb returned with %i" % gdbProcess.returncode)
        gdbProcess = None

        print("Close jdb process with 'quit'")
        jdbProcess.stdin.write("quit\n")
        jdbProcess.wait()
        print("JDB returned %s" % str(jdbProcess.returncode))
        jdbProcess = None

        print("Kill gdbserver process")
        gdbServerProcess.kill()
        gdbServerProcess = None
        print("Killed gdbserver process")

        print("Kill program %i" % programPid)
        common.execArgs(
            [adbCmd] + (["-s", serial] if serial != None else []) + [
                "shell", "run-as", "com.drawelements.deqp", "kill", "-9",
                str(programPid)
            ])
        print("Killed program")

    finally:
        if jdbProcess and jdbProcess.returncode == None:
            print("Kill jdb")
            jdbProcess.kill()
        elif jdbProcess:
            print("JDB returned %i" % jdbProcess.returncode)

        if gdbProcess and gdbProcess.returncode == None:
            print("Kill gdb")
            gdbProcess.kill()
        elif gdbProcess:
            print("GDB returned %i" % gdbProcess.returncode)

        if gdbServerProcess and gdbServerProcess.returncode == None:
            print("Kill gdbserver")
            gdbServerProcess.kill()
        elif gdbServerProcess:
            print("GDB server returned %i" % gdbServerProcess.returncode)

        if programPid != -1:
            print("Kill program %i" % programPid)
            common.execArgs(
                [adbCmd] + (["-s", serial] if serial != None else []) + [
                    "shell", "run-as", "com.drawelements.deqp", "kill", "-9",
                    str(programPid)
                ])
            print("Killed program")

        os.chdir(curDir)
예제 #11
0
파일: debug.py 프로젝트: MIPS/external-deqp
def debug (
	adbCmd,
	deqpCmdLine,
	targetGDBPort,
	hostGDBPort,
	jdbPort,
	jdbCmd,
	gdbCmd,
	buildDir,
	deviceLibs,
	breakpoints,
	serial,
	deviceGdbCmd,
	appProcessName,
	linkerName
	):

	programPid			= -1
	gdbServerProcess	= None
	gdbProcess			= None
	jdbProcess			= None
	curDir				= os.getcwd()
	debugDir			= os.path.join(common.ANDROID_DIR, "debug")
	serialArg			= "-s " + serial if serial != None else ""

	if os.path.exists(debugDir):
		shutil.rmtree(debugDir)

	os.makedirs(debugDir)
	os.chdir(debugDir)
	try:
		# Start execution
		print("Starting intent...")
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["shell", "am", "start", "-W", "-D", "-n", "com.drawelements.deqp/android.app.NativeActivity", "-e", "cmdLine", "\"\"unused " + deqpCmdLine  + "\"\""])
		print("Intent started")

		# Kill existing gdbservers
		print("Check and kill existing gdbserver")
		gdbPid = getADBProgramPID(adbCmd, "gdbserver", serial)
		if gdbPid != -1:
			print("Found gdbserver with PID %i" % gdbPid)
			common.execArgs([adbCmd]
							+ (["-s", serial] if serial != None else [])
							+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(gdbPid)])
			print("Killed gdbserver")
		else:
			print("Couldn't find existing gdbserver")

		programPid = getADBProgramPID(adbCmd, "com.drawelements.deqp:testercore", serial)

		print("Find process PID")
		if programPid == -1:
			common.die("Couldn't get PID of testercore")
		print("Process running with PID %i" % programPid)

		# Start gdbserver
		print("Start gdbserver for PID %i redirect stdout to gdbserver-stdout.txt" % programPid)
		gdbServerProcess = subprocess.Popen([adbCmd]
											+ (["-s", serial] if serial != None else [])
											+ ["shell", "run-as", "com.drawelements.deqp", deviceGdbCmd, "localhost:" + str(targetGDBPort), "--attach", str(programPid)], stdin=subprocess.PIPE, stdout=open("gdbserver-stdout.txt", "wb"), stderr=open("gdbserver-stderr.txt", "wb"))
		print("gdbserver started")

		time.sleep(1)

		gdbServerProcess.poll()

		if gdbServerProcess.returncode != None:
			common.die("gdbserver returned unexpectly with return code %i see gdbserver-stdout.txt for more info" % gdbServerProcess.returncode)

		# Setup port forwarding
		print("Forwarding local port to gdbserver port")
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["forward", "tcp:" + str(hostGDBPort), "tcp:" + str(targetGDBPort)])

		# Pull some data files for debugger
		print("Pull /system/bin/%s from device" % appProcessName)
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["pull", "/system/bin/" + str(appProcessName)])

		print("Pull /system/bin/%s from device" % linkerName)
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["pull", "/system/bin/" + str(linkerName)])

		for lib in deviceLibs:
			print("Pull library %s from device" % lib)
			try:
				common.execArgs([adbCmd]
								+ (["-s", serial] if serial != None else [])
								+ ["pull", lib])
			except Exception as e:
				print("Failed to pull library '%s'. Error: %s" % (lib, str(e)))

		print("Copy %s from build dir" % common.NATIVE_LIB_NAME)
		shutil.copyfile(os.path.join(buildDir, common.NATIVE_LIB_NAME), common.NATIVE_LIB_NAME)

		# Forward local port for jdb
		print("Forward local port to jdb port")
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["forward", "tcp:" + str(jdbPort), "jdwp:" + str(programPid)])

		# Connect JDB
		print("Start jdb process redirectd stdout to jdb-stdout.txt")
		jdbProcess = subprocess.Popen([jdbCmd, "-connect", "com.sun.jdi.SocketAttach:hostname=localhost,port=" + str(jdbPort), "-sourcepath", "../package"], stdin=subprocess.PIPE, stdout=open("jdb-stdout.txt", "wb"), stderr=open("jdb-stderr.txt", "wb"))
		print("Started jdb process")

		# Write gdb.setup
		print("Write gdb.setup")
		gdbSetup = open("gdb.setup", "wb")
		gdbSetup.write("file %s\n" % appProcessName)
		gdbSetup.write("set solib-search-path .\n")
		gdbSetup.write("target remote :%i\n" % hostGDBPort)
		gdbSetup.write("set breakpoint pending on\n")

		for breakpoint in breakpoints:
			print("Set breakpoint at %s" % breakpoint)
			gdbSetup.write("break %s\n" % breakpoint)

		gdbSetup.write("set breakpoint pending off\n")
		gdbSetup.close()

		print("Start gdb")
		gdbProcess = subprocess.Popen(common.shellquote(gdbCmd) + " -x gdb.setup", shell=True)

		gdbProcess.wait()

		print("gdb returned with %i" % gdbProcess.returncode)
		gdbProcess=None

		print("Close jdb process with 'quit'")
		jdbProcess.stdin.write("quit\n")
		jdbProcess.wait()
		print("JDB returned %s" % str(jdbProcess.returncode))
		jdbProcess=None

		print("Kill gdbserver process")
		gdbServerProcess.kill()
		gdbServerProcess=None
		print("Killed gdbserver process")

		print("Kill program %i" % programPid)
		common.execArgs([adbCmd]
						+ (["-s", serial] if serial != None else [])
						+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(programPid)])
		print("Killed program")

	finally:
		if jdbProcess and jdbProcess.returncode == None:
			print("Kill jdb")
			jdbProcess.kill()
		elif jdbProcess:
			print("JDB returned %i" % jdbProcess.returncode)

		if gdbProcess and gdbProcess.returncode == None:
			print("Kill gdb")
			gdbProcess.kill()
		elif gdbProcess:
			print("GDB returned %i" % gdbProcess.returncode)

		if gdbServerProcess and gdbServerProcess.returncode == None:
			print("Kill gdbserver")
			gdbServerProcess.kill()
		elif gdbServerProcess:
			print("GDB server returned %i" % gdbServerProcess.returncode)

		if programPid != -1:
			print("Kill program %i" % programPid)
			common.execArgs([adbCmd]
							+ (["-s", serial] if serial != None else [])
							+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(programPid)])
			print("Killed program")

		os.chdir(curDir)