Exemple #1
0
    def _pullLibsAndSetPaths(self):
        DEFAULT_FILE = 'system/bin/app_process'
        # libraries/binaries to pull from device
        DEFAULT_LIBS = ['system/lib/libdl.so', 'system/lib/libc.so',
                'system/lib/libm.so', 'system/lib/libstdc++.so',
                'system/lib/liblog.so', 'system/lib/libz.so',
                'system/lib/libGLESv2.so', 'system/bin/linker']
        # search path for above libraries/binaries
        DEFAULT_SEARCH_PATHS = ['system/lib', 'system/bin']

        datadir = str(gdb.parameter('data-directory'))
        libdir = os.path.abspath(
                os.path.join(datadir, os.pardir, 'lib', self.device))
        self.datadir = datadir
        self.libdir = libdir
        self.bindir = os.path.abspath(
                os.path.join(datadir, os.pardir, 'bin'))

        # always pull the executable file
        dstpath = os.path.join(libdir, DEFAULT_FILE.replace('/', os.sep))
        if not os.path.exists(dstpath):
            adb.pull('/' + DEFAULT_FILE, dstpath)

        # only pull libs and set paths if automatically loading symbols
        if hasattr(self, 'skipPull') and not self.skipPull:
            sys.stdout.write('Pulling libraries to %s... ' % libdir)
            sys.stdout.flush()
            for lib in DEFAULT_LIBS:
                try:
                    dstpath = os.path.join(libdir, lib.replace('/', os.sep))
                    if not os.path.exists(dstpath):
                        adb.pull('/' + lib, dstpath)
                except gdb.GdbError:
                    sys.stdout.write('\n cannot pull %s... ' % lib)
                    sys.stdout.flush()
            print 'Done'

        gdb.execute('set sysroot ' + libdir, False, True)
        print 'Set sysroot to "%s".' % libdir

        searchPaths = [os.path.join(libdir, d) \
                for d in DEFAULT_SEARCH_PATHS]
        if self.objdir:
            searchPaths.append(os.path.join(self.objdir, 'dist', 'bin'))
            searchPaths.append(os.path.join(self.objdir, 'dist', 'lib'))
        gdb.execute('set solib-search-path ' +
                os.pathsep.join(searchPaths), False, True)
        print 'Updated solib-search-path.'
    def _pullLibsAndSetPaths(self):
        # libraries/binaries to pull from device
        DEFAULT_LIBS = ['lib/libdl.so', 'lib/libc.so', 'lib/libm.so',
                'lib/libstdc++.so', 'lib/liblog.so', 'lib/libz.so',
                'lib/libGLESv2.so', 'bin/linker', 'bin/app_process']
        # search path for above libraries/binaries
        DEFAULT_SEARCH_PATHS = ['lib', 'bin']

        datadir = str(gdb.parameter('data-directory'))
        libdir = os.path.abspath(
                os.path.join(datadir, os.pardir, 'lib', self.device))
        self.datadir = datadir
        self.libdir = libdir
        self.bindir = os.path.abspath(
                os.path.join(datadir, os.pardir, 'bin'))

        sys.stdout.write('Pulling libraries to %s... ' % libdir)
        sys.stdout.flush()
        for lib in DEFAULT_LIBS:
            try:
                dstpath = os.path.join(libdir, lib)
                if not os.path.exists(dstpath):
                    adb.pull('/system/' + lib, dstpath)
            except gdb.GdbError:
                sys.stdout.write('\n cannot pull %s... ' % lib)
                sys.stdout.flush()
        print 'Done'
        gdb.execute('set solib-absolute-prefix ' + libdir, False, True)
        print 'Set solib-absolute-prefix to "%s".' % libdir

        searchPaths = [os.path.join(libdir, d) for d in DEFAULT_SEARCH_PATHS]
        if self.objdir:
            searchPaths.append(os.path.join(self.objdir, 'dist', 'bin'))
            searchPaths.append(os.path.join(self.objdir, 'dist', 'lib'))
        gdb.execute('set solib-search-path ' +
                os.pathsep.join(searchPaths), False, True)
        print 'Updated solib-search-path.'
Exemple #3
0
 def test_pull_n_invalid_dest_folder_host(self):
     global tmp_file_on_target
     result = adb.pull(tmp_file_on_target, NON_EXISTING_DIR)
     self.assertNotEqual(str(result), 0)
Exemple #4
0
 def test_pull_n_invalid_2_parameter(self):
     global tmp_file_on_target
     result = adb.pull(tmp_file_on_target, None)
     self.assertNotEqual(str(result), 0)
Exemple #5
0
 def test_pull_n_invalid_1_parameter(self):
     global dest_folder_host
     result = adb.pull(None, dest_folder_host)
     self.assertNotEqual(str(result), 0)
Exemple #6
0
 def test_pull_p(self):
     global tmp_file_on_target
     global dest_folder_host
     global positive_exp_result_wo_output
     result = adb.pull(tmp_file_on_target, dest_folder_host)
     self.assertEqual(result, positive_exp_result_wo_output)
Exemple #7
0
 def test_pull_n_invalid_dest_folder_host(self):
     global tmp_file_on_target
     result = adb.pull(tmp_file_on_target, NON_EXISTING_DIR)
     self.assertNotEqual(str(result), 0)
Exemple #8
0
 def test_pull_n_invalid_2_parameter(self):
     global tmp_file_on_target
     result = adb.pull(tmp_file_on_target, None)
     self.assertNotEqual(str(result), 0)
Exemple #9
0
 def test_pull_n_invalid_1_parameter(self):
     global dest_folder_host
     result = adb.pull(None, dest_folder_host)
     self.assertNotEqual(str(result), 0)
Exemple #10
0
 def test_pull_p(self):
     global tmp_file_on_target
     global dest_folder_host
     global positive_exp_result_wo_output
     result = adb.pull(tmp_file_on_target, dest_folder_host)
     self.assertEqual(result, positive_exp_result_wo_output)