From 9ca1f4a43aeb53ed3b146a37f4688d6c9a6acbaa Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 19 Apr 2017 14:28:46 -0400 Subject: [PATCH] Clean up output (#150) * Quiet down some error messages * Address comments --- manticore/core/cpu/abstractcpu.py | 5 +++-- manticore/core/cpu/x86.py | 5 +++-- manticore/core/executor.py | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manticore/core/cpu/abstractcpu.py b/manticore/core/cpu/abstractcpu.py index 44027c4..37ff694 100644 --- a/manticore/core/cpu/abstractcpu.py +++ b/manticore/core/cpu/abstractcpu.py @@ -396,8 +396,9 @@ class Cpu(object): raise InvalidPCException(self.PC) if not self.memory.access_ok(slice(pc, pc+instruction.size), 'x'): - logger.info("Trying to execute instructions from not executable memory") + logger.info("Trying to execute instructions from non-executable memory") raise InvalidPCException(self.PC) + instruction.operands = self._wrap_operands(instruction.operands) self._instruction_cache[pc] = instruction @@ -428,7 +429,7 @@ class Cpu(object): def fallback_to_emulate(*operands): text_bytes = ' '.join('%02x'%x for x in instruction.bytes) - logger.info("UNIMPLEMENTED INSTRUCTION: 0x%016x:\t%s\t%s\t%s", + logger.info("Unimplemented instruction: 0x%016x:\t%s\t%s\t%s", instruction.address, text_bytes, instruction.mnemonic, instruction.op_str) self.emulate(instruction) diff --git a/manticore/core/cpu/x86.py b/manticore/core/cpu/x86.py index a83a131..4573b93 100644 --- a/manticore/core/cpu/x86.py +++ b/manticore/core/cpu/x86.py @@ -5262,8 +5262,9 @@ class X86Cpu(Cpu): elif dest.size == 64 and src.size == 128: dest.write(Operators.EXTRACT(src.read(), 0, dest.size)) else: - logger.error("INVALID SIZES IN MOVQ!") - raise Exception("INVALID SIZES IN MOVQ!") + msg = 'Invalid size in MOVQ' + logger.error(msg) + raise Exception(msg) @instruction def MOVSD(cpu, dest, src): diff --git a/manticore/core/executor.py b/manticore/core/executor.py index 6f35d38..39632e7 100644 --- a/manticore/core/executor.py +++ b/manticore/core/executor.py @@ -253,7 +253,7 @@ class Executor(object): # there recursion limit exceeded problem, # try a slower, iterative solution from ..utils import iterpickle - logger.info("WARNING: using iterpickle to dump state") + logger.warning("Using iterpickle to dump state") f.write(iterpickle.dumps(state, 2)) filesize = f.tell() @@ -383,7 +383,7 @@ class Executor(object): if policy == 'bucket': - logger.info("Metric %r", 'bucket'*10 ) + logger.info("Metric: bucket") for st_name, st_stat in sorted( self._states.items(), key = lambda (st_name,st_stat): metric(st_stat) ): brs = st_stat['branches'] @@ -801,8 +801,8 @@ class Executor(object): break except SyscallNotImplemented as e: - logger.error("SYSCALL NOT IMPLEMENTED, PLEASE IMPLEMENT\n%s", str(e)) - self.generate_testcase(current_state, "UNIMPLEMENTED syscall "+str(e)) + logger.error("Syscall not implemented: %s", str(e)) + self.generate_testcase(current_state, "Unimplemented syscall "+str(e)) current_state = None except AssertionError as e: @@ -823,7 +823,7 @@ class Executor(object): except Exception as e: import traceback trace = traceback.format_exc() - logger.error("THIS SHOULD NOT REACHABLE! Exception in user code: %s\n%s", str(e), trace) + logger.error("Exception: %s\n%s", str(e), trace) for log in trace.splitlines(): logger.error(log) current_state = None