|
1 | 1 | use prettytable::{row, Table}; |
2 | 2 |
|
3 | 3 | use crate::constants::*; |
4 | | -use crate::header::{MachHeader, MachHeader32, MachHeader64}; |
5 | | -use crate::load_commands::{BuildVersionCommand, DyldInfoCommand, DylibCommand, DynSymtabCommand, EncryptionInfoCommand, EncryptionInfoCommand32, EncryptionInfoCommand64, EntryPointCommand, LcStr, LinkeditDataCommand, LinkerOptionCommand, LoadCommand, NoteCommand, PrebindCksumCommand, PreboundDylibCommand, RoutinesCommand, RoutinesCommand32, RoutinesCommand64, Section, Section32, Section64, SegmentCommand, SegmentCommand32, SegmentCommand64, SourceVersionCommand, SymsegCommand, SymtabCommand, ThreadCommand, TwoLevelHintsCommand, UuidCommand, VersionMinCommand}; |
| 4 | +use crate::header::*; |
| 5 | +use crate::load_commands::*; |
6 | 6 |
|
7 | 7 | pub fn print_header(header: &MachHeader) { |
8 | 8 | let mut table = Table::new(); |
@@ -320,12 +320,23 @@ fn print_common_lcstr(cmd: u32, cmdsize: u32, lc_str_name: &str, lc_str: String, |
320 | 320 |
|
321 | 321 | fn print_prebound_dylib_command(command: &PreboundDylibCommand, table: &mut Table) { |
322 | 322 | print_lc_cmd_and_cmdsize(command.cmd, command.cmdsize, table); |
| 323 | + table.add_row(row![ Fcc->"nmodules", Fyc->format!("0x{:x}", command.nmodules), c->"-"]); |
| 324 | + |
323 | 325 | // TODO: this is problematic because this command has 2 lc_str in its LcStr struct (2 in one Vec<u8>) printing should be different. |
324 | 326 | } |
325 | 327 |
|
326 | 328 | fn print_thread_command(command: &ThreadCommand, table: &mut Table) { |
327 | 329 | print_lc_cmd_and_cmdsize(command.cmd, command.cmdsize, table); |
328 | | - // TODO: implement this after we manage to make it work in parser.rs as well. |
| 330 | + for (index, thread_state) in command.thread_states.iter().enumerate() { |
| 331 | + table.add_row(row![Fgbc->format!("Thread State #{}", index), c->"-", c->"-"]); |
| 332 | + print_thread_state(thread_state, table); |
| 333 | + } |
| 334 | +} |
| 335 | + |
| 336 | +fn print_thread_state(thread_state: &ThreadState, table: &mut Table) { |
| 337 | + table.add_row(row![Fcc->"flavor", Fyc->format!("0x{:x}", thread_state.flavor), c->"-"]); |
| 338 | + table.add_row(row![Fcc->"count", Fyc->format!("0x{:x}", thread_state.count), c->"-"]); |
| 339 | + print_bytes_array("state", &thread_state.state, table); |
329 | 340 | } |
330 | 341 |
|
331 | 342 | fn print_routines_command_32(command: &RoutinesCommand32, table: &mut Table) { |
|
0 commit comments