From 04d0770b9006293dd73a9b709c0f8450d45544cb Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Wed, 16 Aug 2017 18:59:12 +0200 Subject: [PATCH] Add missing info for data aborts in the exception parser and turn it into a pip module --- .../parser/exception_dump_parser/__init__.py | 0 .../exception_dump_parser.py | 19 +++++++++++++------ exceptions/parser/setup.py | 13 +++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 exceptions/parser/exception_dump_parser/__init__.py rename exceptions/{ => parser/exception_dump_parser}/exception_dump_parser.py (95%) mode change 100644 => 100755 create mode 100644 exceptions/parser/setup.py diff --git a/exceptions/parser/exception_dump_parser/__init__.py b/exceptions/parser/exception_dump_parser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exceptions/exception_dump_parser.py b/exceptions/parser/exception_dump_parser/exception_dump_parser.py old mode 100644 new mode 100755 similarity index 95% rename from exceptions/exception_dump_parser.py rename to exceptions/parser/exception_dump_parser/exception_dump_parser.py index abcb25f..0fcc964 --- a/exceptions/exception_dump_parser.py +++ b/exceptions/parser/exception_dump_parser/exception_dump_parser.py @@ -98,7 +98,7 @@ faultStatusSources = { 0b1000:'Precise External Abort', 0b10110:'Imprecise External Abort', 0b10:'Debug event' } -if __name__ == "__main__": +def main(args=None): parser = argparse.ArgumentParser(description="Parse Luma3DS exception dumps") parser.add_argument("filename") args = parser.parse_args() @@ -141,6 +141,11 @@ if __name__ == "__main__": typeDetailsStr = " (VFP exception)" print("Exception type: {0}{1}".format("unknown" if exceptionType >= len(handledExceptionNames) else handledExceptionNames[exceptionType], typeDetailsStr)) + + xfsr = registers[18] if exceptionType == 2 else registers[17] if exceptionType == 3 else 0 + if xfsr != 0: + print("Fault status: " + faultStatusSources[xfsr & 0xf]) + if additionalDataSize != 0: print("Current process: {0} ({1:016x})".format(additionalData[:8].decode("ascii"), unpack_from("