mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Implement custom debug for flags
This commit is contained in:
@@ -390,7 +390,6 @@ impl From<Dictionary> for XPCObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct XPCMessage {
|
pub struct XPCMessage {
|
||||||
pub flags: u32,
|
pub flags: u32,
|
||||||
pub message: Option<XPCObject>,
|
pub message: Option<XPCObject>,
|
||||||
@@ -469,3 +468,37 @@ impl XPCMessage {
|
|||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for XPCMessage {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
let mut parts = Vec::new();
|
||||||
|
|
||||||
|
if self.flags & 0x00000001 != 0 {
|
||||||
|
parts.push("AlwaysSet".to_string());
|
||||||
|
}
|
||||||
|
if self.flags & 0x00000100 != 0 {
|
||||||
|
parts.push("DataFlag".to_string());
|
||||||
|
}
|
||||||
|
if self.flags & 0x00010000 != 0 {
|
||||||
|
parts.push("WantingReply".to_string());
|
||||||
|
}
|
||||||
|
if self.flags & 0x00400000 != 0 {
|
||||||
|
parts.push("InitHandshake".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for any unknown bits (not covered by known flags)
|
||||||
|
let known_mask = 0x00000001 | 0x00000100 | 0x00010000 | 0x00400000;
|
||||||
|
let custom_bits = self.flags & !known_mask;
|
||||||
|
if custom_bits != 0 {
|
||||||
|
parts.push(format!("Custom(0x{:08X})", custom_bits));
|
||||||
|
}
|
||||||
|
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"XPCMessage {{ flags: [{}], message_id: {:?}, message: {:?} }}",
|
||||||
|
parts.join(" | "),
|
||||||
|
self.message_id,
|
||||||
|
self.message
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user