Пример #1
0
    def classpaths(self):
        """Retrieve the classpath and bootclasspath of the target VM. If the
        classpath is not defined, returns an empty list. If the bootclasspath
        is not defined returns an empty list.
        """
        response = self.send_command("VM::ClassPaths")
        (base_dir, count, off) = parser.unpack(response, "si", add_offset=True)
        classpaths = []

        while len(classpaths) < count:
            path = parser.unpack(response[off:], "s", add_offset=True)
            off += path.pop()
            path = path.pop()
            classpaths.append(path)

        # Get the count of boot class paths
        count = parser.unpack_int(response[off:])
        off += 4

        bootclasspaths = []

        while len(bootclasspaths) < count:
            path = parser.unpack(response[off:], "s", add_offset=True)
            off += path.pop()
            path = path.pop()
            bootclasspaths.append(path)

        return (classpaths, bootclasspaths)
Пример #2
0
    def classpaths(self):
        """Retrieve the classpath and bootclasspath of the target VM. If the
        classpath is not defined, returns an empty list. If the bootclasspath
        is not defined returns an empty list.
        """
        response = self.send_command("VM::ClassPaths")
        (base_dir, count, off) = parser.unpack(response, "si", add_offset=True)
        classpaths = []

        while len(classpaths) < count:
            path = parser.unpack(response[off:], "s", add_offset=True)
            off += path.pop()
            path = path.pop()
            classpaths.append(path)

        # Get the count of boot class paths
        count = parser.unpack_int(response[off:])
        off += 4

        bootclasspaths = []

        while len(bootclasspaths) < count:
            path = parser.unpack(response[off:], "s", add_offset=True)
            off += path.pop()
            path = path.pop()
            bootclasspaths.append(path)

        return (classpaths, bootclasspaths)
Пример #3
0
    def get_threadgroups(self):
        """Return a list of thread groups."""
        data = self.send_command("VM::TopLevelThreadGroups")
        count = parser.unpack_int(data)
        offset = 4
        groups = []

        while len(groups) < count:
            group_data = parser.unpack(data[offset:], "o", add_offset=True)
            offset += group_data.pop()
            group_id = group_data.pop()
            groups.append(group_id)

        return groups
Пример #4
0
    def get_threads(self):
        """Return a list of threads."""
        data = self.send_command("VM::AllThreads")
        count = parser.unpack_int(data)
        offset = 4
        threads = []

        while len(threads) < count:
            thread_data = parser.unpack(data[offset:], "o", add_offset=True)
            offset += thread_data.pop()
            thread_id = thread_data.pop()
            threads.append(thread_id)

        return threads
Пример #5
0
    def get_threadgroups(self):
        """Return a list of thread groups."""
        data = self.send_command("VM::TopLevelThreadGroups")
        count = parser.unpack_int(data)
        offset = 4
        groups = []

        while len(groups) < count:
            group_data = parser.unpack(data[offset:], "o", add_offset=True)
            offset += group_data.pop()
            group_id = group_data.pop()
            groups.append(group_id)

        return groups
Пример #6
0
    def get_threads(self):
        """Return a list of threads."""
        data = self.send_command("VM::AllThreads")
        count = parser.unpack_int(data)
        offset = 4
        threads = []

        while len(threads) < count:
            thread_data = parser.unpack(data[offset:], "o", add_offset=True)
            offset += thread_data.pop()
            thread_id = thread_data.pop()
            threads.append(thread_id)

        return threads
Пример #7
0
    def get_classes(self):
        """Returns the list of all the classes currently loaded."""
        format = "brsi"
        data = self.send_command("VM::AllClasses")
        count = parser.unpack_int(data)
        classes = []
        offset = 4

        while len(classes) < count:
            class_data = parser.unpack(data[offset:], format, add_offset=True)
            offset += class_data.pop()
            (cid, cadd, sig, status) = class_data
            while sig and sig[0] in const.jni_types:
                sig = sig[1:]
            while sig and sig[-1] in (";", ):
                sig = sig[:-1]
            sig = sig.split("$")[0]
            sig = sig.replace("/", ".")
            classes.append(sig)

        return sorted(list(set(classes)))
Пример #8
0
    def get_classes(self):
        """Returns the list of all the classes currently loaded."""
        format = "brsi"
        data = self.send_command("VM::AllClasses")
        count = parser.unpack_int(data)
        classes = []
        offset = 4

        while len(classes) < count:
            class_data = parser.unpack(data[offset:], format, add_offset=True)
            offset += class_data.pop()
            (cid, cadd, sig, status) = class_data
            while sig and sig[0] in const.jni_types:
                sig = sig[1:]
            while sig and sig[-1] in (";",):
                sig = sig[:-1]
            sig = sig.split("$")[0]
            sig = sig.replace("/", ".")
            classes.append(sig)

        return sorted(list(set(classes)))