-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
RegistersTracker.getJrRegData
method to simplify getting jr inf…
…ormation and `RegistersTracker.processBranch` to track register usage on branches
- Loading branch information
1 parent
1e0daec
commit 1c22fdc
Showing
24 changed files
with
391 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
[package] | ||
name = "rabbitizer" | ||
# Version should be synced with include/common/RabbitizerVersion.h | ||
version = "1.11.2" | ||
version = "1.11.3" | ||
edition = "2021" | ||
authors = ["Anghelo Carvajal <[email protected]>"] | ||
description = "MIPS instruction decoder" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
#ifndef RABBITIZER_JR_REG_DATA_HPP | ||
#define RABBITIZER_JR_REG_DATA_HPP | ||
#pragma once | ||
|
||
#include "analysis/RabbitizerJrRegData.h" | ||
|
||
namespace rabbitizer { | ||
class JrRegData { | ||
protected: | ||
RabbitizerJrRegData regData; | ||
|
||
public: | ||
JrRegData(); | ||
JrRegData(const RabbitizerJrRegData &other); | ||
|
||
/** | ||
* Returns a pointer to the inner RabbitizerJrRegData. | ||
* It is recommended to not mess with it unless you know what you are doing. | ||
*/ | ||
RabbitizerJrRegData *getCPtr(); | ||
const RabbitizerJrRegData *getCPtr() const; | ||
|
||
bool hasInfo() const; | ||
|
||
int offset() const; | ||
uint32_t address() const; | ||
bool checkedForBranching() const; | ||
int lastBranchOffset() const; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
#include "analysis/JrRegData.hpp" | ||
|
||
using namespace rabbitizer; | ||
|
||
JrRegData::JrRegData() { | ||
RabbitizerJrRegData_init(&this->regData); | ||
} | ||
JrRegData::JrRegData(const RabbitizerJrRegData &other) { | ||
RabbitizerJrRegData_copy(&this->regData, &other); | ||
} | ||
|
||
RabbitizerJrRegData *JrRegData::getCPtr() { | ||
return &this->regData; | ||
} | ||
const RabbitizerJrRegData *JrRegData::getCPtr() const { | ||
return &this->regData; | ||
} | ||
|
||
bool JrRegData::hasInfo() const { | ||
return this->regData.hasInfo; | ||
} | ||
|
||
int JrRegData::offset() const { | ||
return this->regData.offset; | ||
} | ||
uint32_t JrRegData::address() const { | ||
return this->regData.address; | ||
} | ||
bool JrRegData::checkedForBranching() const { | ||
return this->regData.checkedForBranching; | ||
} | ||
int JrRegData::lastBranchOffset() const { | ||
return this->regData.lastBranchOffset; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ | ||
/* SPDX-License-Identifier: MIT */ | ||
|
||
#ifndef RABBITIZER_JR_REG_DATA_H | ||
#define RABBITIZER_JR_REG_DATA_H | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include "common/Utils.h" | ||
|
||
#include "RabbitizerTrackedRegisterState.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
|
||
typedef struct RabbitizerJrRegData { | ||
bool hasInfo; | ||
|
||
int offset; | ||
uint32_t address; | ||
bool checkedForBranching; | ||
int lastBranchOffset; | ||
} RabbitizerJrRegData; | ||
|
||
|
||
NON_NULL(1) | ||
void RabbitizerJrRegData_init(RabbitizerJrRegData *self); | ||
NON_NULL(1, 2) | ||
void RabbitizerJrRegData_copy(RabbitizerJrRegData *self, const RabbitizerJrRegData *other); | ||
|
||
NON_NULL(1, 2) | ||
void RabbitizerJrRegData_initFromRegisterState(RabbitizerJrRegData *self, const RabbitizerTrackedRegisterState *state); | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# SPDX-FileCopyrightText: © 2022-2024 Decompollaborate | ||
# SPDX-License-Identifier: MIT | ||
|
||
from __future__ import annotations | ||
|
||
|
||
class JrRegData: | ||
def hasInfo(self) -> bool: ... | ||
def offset(self) -> int: ... | ||
def address(self) -> int: ... | ||
def checkedForBranching(self) -> bool: ... | ||
def lastBranchOffset(self) -> bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,5 @@ from .Config import * | |
|
||
from .rabbitizer import * | ||
|
||
from .JrRegData import * | ||
from .RegistersTracker import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.