Ejemplo n.º 1
0
    def runDebug(self, exc_info):
        if flags.can_touch_runtime_system("switch console") and self._intf_tty_num != 1:
            iutil.vtActivate(1)

        iutil.eintr_retry_call(os.open, "/dev/console", os.O_RDWR)  # reclaim stdin
        iutil.eintr_ignore(os.dup2, 0, 1)  # reclaim stdout
        iutil.eintr_ignore(os.dup2, 0, 2)  # reclaim stderr
        #                      ^
        #                      |
        #                      +------ dup2 is magic, I tells ya!

        # bring back the echo
        import termios

        si = sys.stdin.fileno()
        attr = termios.tcgetattr(si)
        attr[3] = attr[3] & termios.ECHO
        termios.tcsetattr(si, termios.TCSADRAIN, attr)

        print("\nEntering debugger...")
        print("Use 'continue' command to quit the debugger and get back to " "the main window")
        import pdb

        pdb.post_mortem(exc_info.stack)

        if flags.can_touch_runtime_system("switch console") and self._intf_tty_num != 1:
            iutil.vtActivate(self._intf_tty_num)
Ejemplo n.º 2
0
    def runDebug(self, exc_info):
        if flags.can_touch_runtime_system("switch console") \
                and self._intf_tty_num != 1:
            iutil.vtActivate(1)

        iutil.eintr_retry_call(os.open, "/dev/console",
                               os.O_RDWR)  # reclaim stdin
        iutil.eintr_ignore(os.dup2, 0, 1)  # reclaim stdout
        iutil.eintr_ignore(os.dup2, 0, 2)  # reclaim stderr
        #                      ^
        #                      |
        #                      +------ dup2 is magic, I tells ya!

        # bring back the echo
        import termios
        si = sys.stdin.fileno()
        attr = termios.tcgetattr(si)
        attr[3] = attr[3] & termios.ECHO
        termios.tcsetattr(si, termios.TCSADRAIN, attr)

        print("\nEntering debugger...")
        print("Use 'continue' command to quit the debugger and get back to "\
              "the main window")
        import pdb
        pdb.post_mortem(exc_info.stack)

        if flags.can_touch_runtime_system("switch console") \
                and self._intf_tty_num != 1:
            iutil.vtActivate(self._intf_tty_num)
Ejemplo n.º 3
0
    def dumpState(self):
        from meh import ExceptionInfo
        from meh.dump import ReverseExceptionDump
        from inspect import stack as _stack
        from traceback import format_stack

        # Skip the frames for dumpState and the signal handler.
        stack = _stack()[2:]
        stack.reverse()
        exn = ReverseExceptionDump(ExceptionInfo(None, None, stack),
                                   self.mehConfig)

        # gather up info on the running threads
        threads = "\nThreads\n-------\n"
        for thread_id, frame in sys._current_frames().items():
            threads += "\nThread %s\n" % (thread_id,)
            threads += "".join(format_stack(frame))

        # dump to a unique file
        (fd, filename) = mkstemp(prefix="anaconda-tb-", dir="/tmp")
        dump_text = exn.traceback_and_object_dump(self)
        dump_text += threads
        dump_text_bytes = dump_text.encode("utf-8")
        iutil.eintr_retry_call(os.write, fd, dump_text_bytes)
        iutil.eintr_ignore(os.close, fd)

        # append to a given file
        with open("/tmp/anaconda-tb-all.log", "a+") as f:
            f.write("--- traceback: %s ---\n" % filename)
            f.write(dump_text + "\n")
    def dumpState(self):
        from meh import ExceptionInfo
        from meh.dump import ReverseExceptionDump
        from inspect import stack as _stack
        from traceback import format_stack

        # Skip the frames for dumpState and the signal handler.
        stack = _stack()[2:]
        stack.reverse()
        exn = ReverseExceptionDump(ExceptionInfo(None, None, stack),
                                   self.mehConfig)

        # gather up info on the running threads
        threads = "\nThreads\n-------\n"

        # Every call to sys._current_frames() returns a new dict, so it is not
        # modified when threads are created or destroyed. Iterating over it is
        # thread safe.
        for thread_id, frame in sys._current_frames().items():
            threads += "\nThread %s\n" % (thread_id, )
            threads += "".join(format_stack(frame))

        # dump to a unique file
        (fd, filename) = mkstemp(prefix="anaconda-tb-", dir="/tmp")
        dump_text = exn.traceback_and_object_dump(self)
        dump_text += threads
        dump_text_bytes = dump_text.encode("utf-8")
        iutil.eintr_retry_call(os.write, fd, dump_text_bytes)
        iutil.eintr_ignore(os.close, fd)

        # append to a given file
        with open("/tmp/anaconda-tb-all.log", "a+") as f:
            f.write("--- traceback: %s ---\n" % filename)
            f.write(dump_text + "\n")
Ejemplo n.º 5
0
    def setVNCPassword(self):
        """Set the vnc server password. Output to file. """

        r, w = os.pipe()
        password_string = "%s\n" % self.password
        iutil.eintr_retry_call(os.write, w, password_string.encode("utf-8"))

        with open(self.pw_file, "wb") as pw_file:
            # the -f option makes sure vncpasswd does not ask for the password again
            rc = iutil.execWithRedirect("vncpasswd", ["-f"],
                    stdin=r, stdout=pw_file, binary_output=True, log_output=False)

            iutil.eintr_ignore(os.close, r)
            iutil.eintr_ignore(os.close, w)

        return rc