add Instruction::is_pseudo_ins()

This commit is contained in:
Jean-Marie Mineau 2025-02-05 10:16:45 +01:00
parent 095ce2ce93
commit 88ecc534a2
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2

View file

@ -2106,6 +2106,22 @@ impl Instruction {
Ok(serde_json::from_str(json)?) Ok(serde_json::from_str(json)?)
} }
/// Test if the instruction is a dalvik instruction or a pseudo instruction like a label or a
/// debug info.
pub fn is_pseudo_ins(&self) -> bool {
matches!(
self,
Self::Try { .. }
| Self::Label { .. }
| Self::DebugLocal { .. }
| Self::DebugEndLocal { .. }
| Self::DebugEndPrologue {}
| Self::DebugBeginEpilogue {}
| Self::DebugSourceFile { .. }
| Self::DebugLine { .. }
)
}
pub fn __str__(&self) -> String { pub fn __str__(&self) -> String {
match self { match self {
Self::Nop {} => "nop".into(), Self::Nop {} => "nop".into(),