parameters: (self)
docstring: Returns true if the gem5 instance specified in args has a kernel panic
          Note: this gets around the problem that gem5 doesn't exit on panics.
docstring_summary: Returns true if the gem5 instance specified in args has a kernel panic
          Note: this gets around the problem that gem5 doesn't exit on panics.
docstring_tokens: Returns true if the gem5 instance specified in args has a kernel panic Note : this gets around the problem that gem5 doesn t exit on panics .
function: def checkKernelPanic(self) -> bool:
          """
          Returns true if the gem5 instance specified in args has a kernel panic
          Note: this gets around the problem that gem5 doesn't exit on panics.
          """
          term_path = self.outdir / "system.pc.com_1.device"
          if not term_path.exists():
              return False
  
          with open(term_path, "rb") as f:
              try:
                  f.seek(-1000, os.SEEK_END)
              except OSError:
                  return False
              try:
                  # There was a case where reading `term_path` resulted in a
                  # UnicodeDecodeError. It is known that the terminal output
                  # (content of 'system.pc.com_1.device') is written from a
                  # buffer from gem5, and when gem5 stops, the content of the
                  # buffer is stopped being copied to the file. The buffer is
                  # not flushed as well. So, it might be a case that the content
                  # of the `term_path` is corrupted as a Unicode character could
                  # be longer than a byte.
                  last = f.readlines()[-1].decode()
                  if "Kernel panic" in last:
                      return True
                  else:
                      return False
              except UnicodeDecodeError:
                  return False
function_tokens: def checkKernelPanic ( self ) -> bool : term_path = self . outdir / "system.pc.com_1.device" if not term_path . exists ( ) : return False with open ( term_path , "rb" ) as f : try : f . seek ( - 1000 , os . SEEK_END ) except OSError : return False try : # There was a case where reading `term_path` resulted in a # UnicodeDecodeError. It is known that the terminal output # (content of 'system.pc.com_1.device') is written from a # buffer from gem5, and when gem5 stops, the content of the # buffer is stopped being copied to the file. The buffer is # not flushed as well. So, it might be a case that the content # of the `term_path` is corrupted as a Unicode character could # be longer than a byte. last = f . readlines ( ) [ - 1 ] . decode ( ) if "Kernel panic" in last : return True else : return False except UnicodeDecodeError : return False