Try to create a new parser instance from a given bv/pdb
(
debug_info: &'a mut DebugInfo,
bv: &'a BinaryView,
mut pdb: PDB<'a, S>,
)
| 104 | impl<'a, S: Source<'a> + 'a> PDBParserInstance<'a, S> { |
| 105 | /// Try to create a new parser instance from a given bv/pdb |
| 106 | pub fn new( |
| 107 | debug_info: &'a mut DebugInfo, |
| 108 | bv: &'a BinaryView, |
| 109 | mut pdb: PDB<'a, S>, |
| 110 | ) -> Result<Self> { |
| 111 | let arch = if let Some(arch) = bv.default_arch() { |
| 112 | arch |
| 113 | } else { |
| 114 | return Err(anyhow!("Cannot parse to view with no architecture")); |
| 115 | }; |
| 116 | |
| 117 | let platform = bv |
| 118 | .default_platform() |
| 119 | .expect("Expected bv to have a platform"); |
| 120 | |
| 121 | let address_map = pdb.address_map()?; |
| 122 | |
| 123 | let default_cc = platform |
| 124 | .get_default_calling_convention() |
| 125 | .expect("Expected default calling convention"); |
| 126 | |
| 127 | let thiscall_cc = Self::find_calling_convention(platform.as_ref(), "thiscall") |
| 128 | .unwrap_or(default_cc.clone()); |
| 129 | |
| 130 | let cdecl_cc = platform |
| 131 | .get_cdecl_calling_convention() |
| 132 | .unwrap_or(default_cc.clone()); |
| 133 | |
| 134 | Ok(Self { |
| 135 | debug_info, |
| 136 | bv, |
| 137 | arch, |
| 138 | default_cc, |
| 139 | thiscall_cc, |
| 140 | cdecl_cc, |
| 141 | platform, |
| 142 | pdb, |
| 143 | address_map, |
| 144 | settings: Settings::new(), |
| 145 | settings_query_opts: QueryOptions::new_with_view(bv), |
| 146 | indexed_types: Default::default(), |
| 147 | named_types: Default::default(), |
| 148 | full_type_indices: Default::default(), |
| 149 | type_stack: Default::default(), |
| 150 | namespace_stack: Default::default(), |
| 151 | type_default_returnable: Default::default(), |
| 152 | parsed_symbols: Default::default(), |
| 153 | parsed_symbols_by_name: Default::default(), |
| 154 | named_symbols: Default::default(), |
| 155 | symbol_tree: Default::default(), |
| 156 | symbol_parents: Default::default(), |
| 157 | symbol_stack: Default::default(), |
| 158 | indexed_symbols: Default::default(), |
| 159 | addressed_symbols: Default::default(), |
| 160 | module_cpu_type: None, |
| 161 | }) |
| 162 | } |
| 163 |
nothing calls this directly
no test coverage detected