From c899769ba90a17d67849737f48d4ac46145ffa30 Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 21 Dec 2024 11:15:02 -0300 Subject: [PATCH 1/2] Fix a crash produced by not handling new `AccessType`s introduced by `rabbitizer` --- CHANGELOG.md | 5 +++++ pyproject.toml | 2 +- requirements.txt | 2 +- spimdisasm/__init__.py | 4 ++-- spimdisasm/common/ContextSymbols.py | 16 +++++++++++++--- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fafb79ea..7d6fac93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix a crash produced by not handling new `AccessType`s introduced by `rabbitizer`. +- `rabbitizer` 1.12.5 or above is required. + ## [1.31.2] - 2024-12-02 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 34076f8e..21dc0baf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "spimdisasm" # Version should be synced with spimdisasm/__init__.py -version = "1.31.2" +version = "1.31.3-dev0" description = "MIPS disassembler" readme = "README.md" license = {file = "LICENSE"} diff --git a/requirements.txt b/requirements.txt index 60c328e1..2e2d92b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -rabbitizer>=1.12.0,<2.0.0 +rabbitizer>=1.12.5,<2.0.0 diff --git a/spimdisasm/__init__.py b/spimdisasm/__init__.py index 8a4a126a..1836cb86 100644 --- a/spimdisasm/__init__.py +++ b/spimdisasm/__init__.py @@ -5,8 +5,8 @@ from __future__ import annotations -__version_info__: tuple[int, int, int] = (1, 31, 2) -__version__ = ".".join(map(str, __version_info__))# + "-dev0" +__version_info__: tuple[int, int, int] = (1, 31, 3) +__version__ = ".".join(map(str, __version_info__)) + "-dev0" __author__ = "Decompollaborate" from . import common as common diff --git a/spimdisasm/common/ContextSymbols.py b/spimdisasm/common/ContextSymbols.py index cfd811d2..1786ad6b 100644 --- a/spimdisasm/common/ContextSymbols.py +++ b/spimdisasm/common/ContextSymbols.py @@ -61,7 +61,7 @@ def fromStr(symTypeStr: str|None) -> SymbolSpecialType|None: @dataclasses.dataclass class AccessTypeInfo: - size: int + size: int|None typeSigned: str|None typeUnsigned: str|None typeNameAliases: set[str] = dataclasses.field(default_factory=set) @@ -92,8 +92,13 @@ def getAllTypes(self) -> set[str]: # Ignore signed WORD since it tends to not give a proper type rabbitizer.AccessType.WORD: AccessTypeInfo(4, None, "u32", {"s32", "vs32", "vu32"}), rabbitizer.AccessType.DOUBLEWORD: AccessTypeInfo(8, "s64", "u64", {"vs64", "vu64"}), + rabbitizer.AccessType.QUADWORD: AccessTypeInfo(16, None, None), rabbitizer.AccessType.FLOAT: AccessTypeInfo(4, "f32", None, {"Vec3f"}), rabbitizer.AccessType.DOUBLEFLOAT: AccessTypeInfo(8, "f64", None), + rabbitizer.AccessType.WORD_LEFT: AccessTypeInfo(None, None, None), + rabbitizer.AccessType.WORD_RIGHT: AccessTypeInfo(None, None, None), + rabbitizer.AccessType.DOUBLEWORD_LEFT: AccessTypeInfo(None, None, None), + rabbitizer.AccessType.DOUBLEWORD_RIGHT: AccessTypeInfo(None, None, None), } @@ -590,11 +595,16 @@ def getSize(self) -> int: if currentType is not None and not isinstance(currentType, SymbolSpecialType): for info in gAccessKinds.values(): if info.typeMatchesAccess(currentType): - return info.size + size = info.size + if size is not None: + return size + break # Infer size based on instruction access type if self.accessType is not None: - return gAccessKinds[self.accessType].size + size = gAccessKinds[self.accessType].size + if size is not None: + return size # Infer size based on symbol's address alignment if self.vram % 4 == 0: From 0d3a4228bad01010329259e03c0447e43b596985 Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 21 Dec 2024 16:23:15 -0300 Subject: [PATCH 2/2] version bump --- CHANGELOG.md | 3 +++ README.md | 2 +- pyproject.toml | 2 +- spimdisasm/__init__.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d6fac93..c6ec65b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.31.3] - 2024-12-21 + ### Fixed - Fix a crash produced by not handling new `AccessType`s introduced by `rabbitizer`. @@ -1718,6 +1720,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Version 1.0.0 [unreleased]: https://github.com/Decompollaborate/spimdisasm/compare/master...develop +[1.31.3]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.2...1.31.3 [1.31.2]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.1...1.31.2 [1.31.1]: https://github.com/Decompollaborate/spimdisasm/compare/1.31.0...1.31.1 [1.31.0]: https://github.com/Decompollaborate/spimdisasm/compare/1.30.2...1.31.0 diff --git a/README.md b/README.md index 7aab1005..329d2a06 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ If you use a `requirements.txt` file in your repository, then you can add this library with the following line: ```txt -spimdisasm>=1.31.2,<2.0.0 +spimdisasm>=1.31.3,<2.0.0 ``` ### Development version diff --git a/pyproject.toml b/pyproject.toml index 21dc0baf..d2a274ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "spimdisasm" # Version should be synced with spimdisasm/__init__.py -version = "1.31.3-dev0" +version = "1.31.3" description = "MIPS disassembler" readme = "README.md" license = {file = "LICENSE"} diff --git a/spimdisasm/__init__.py b/spimdisasm/__init__.py index 1836cb86..251e5461 100644 --- a/spimdisasm/__init__.py +++ b/spimdisasm/__init__.py @@ -6,7 +6,7 @@ from __future__ import annotations __version_info__: tuple[int, int, int] = (1, 31, 3) -__version__ = ".".join(map(str, __version_info__)) + "-dev0" +__version__ = ".".join(map(str, __version_info__))# + "-dev0" __author__ = "Decompollaborate" from . import common as common