MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / print_memory_information

Function print_memory_information

view/minidump/src/command.rs:8–41  ·  view source on GitHub ↗
(bv: &BinaryView)

Source from the content-addressed store, hash-verified

6use binaryninja::binary_view::{BinaryView, BinaryViewBase, BinaryViewExt};
7
8pub fn print_memory_information(bv: &BinaryView) {
9 debug!("Printing memory information");
10 if let Some(minidump_bv) = bv.parent_view() {
11 if let Ok(read_buffer) = minidump_bv.read_buffer(0, minidump_bv.len() as usize) {
12 if let Ok(minidump_obj) = Minidump::read(read_buffer.get_data()) {
13 if let Ok(memory_info_list) = minidump_obj.get_stream::<MinidumpMemoryInfoList>() {
14 let mut memory_info_list_writer = Vec::new();
15 match memory_info_list.print(&mut memory_info_list_writer) {
16 Ok(_) => {
17 if let Ok(memory_info_str) = str::from_utf8(&memory_info_list_writer) {
18 info!("{memory_info_str}");
19 } else {
20 error!("Could not convert the memory information description from minidump into a valid string");
21 }
22 }
23 Err(_) => {
24 error!("Could not get memory information from minidump");
25 }
26 }
27 } else {
28 error!(
29 "Could not parse a valid MinidumpMemoryInfoList stream from the minidump"
30 );
31 }
32 } else {
33 error!("Could not parse a valid minidump file from the parent binary view's data buffer");
34 }
35 } else {
36 error!("Could not read data from parent binary view");
37 }
38 } else {
39 error!("Could not get the parent binary view");
40 }
41}

Callers 1

actionMethod · 0.85

Calls 4

read_bufferMethod · 0.80
parent_viewMethod · 0.45
lenMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected