-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
300 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use std::path::Path; | ||
|
||
use resym_core::{pdb_file::PdbFile, pdb_types::PrimitiveReconstructionFlavor}; | ||
|
||
const TEST_PDB_FILE_PATH: &str = "tests/data/test.pdb"; | ||
const TEST_MODULE_INDEX: usize = 27; | ||
const TEST_MODULE_PATH: &str = "D:\\a\\_work\\1\\s\\Intermediate\\crt\\vcstartup\\build\\xmd\\msvcrt_kernel32\\msvcrt_kernel32.nativeproj\\objd\\amd64\\default_local_stdio_options.obj"; | ||
|
||
#[test] | ||
fn test_module_dumping_by_path_portable() { | ||
let mut pdb_file = | ||
PdbFile::load_from_file(Path::new(TEST_PDB_FILE_PATH)).expect("load test.pdb"); | ||
|
||
let module_dump = pdb_file | ||
.reconstruct_module_by_path(TEST_MODULE_PATH, PrimitiveReconstructionFlavor::Portable) | ||
.unwrap_or_else(|_| panic!("module dumping")); | ||
|
||
insta::assert_snapshot!("module_dumping_by_path_portable", module_dump); | ||
} | ||
|
||
#[test] | ||
fn test_module_dumping_by_index_portable() { | ||
test_module_dumping_by_index_internal( | ||
"module_dumping_by_index_portable", | ||
TEST_MODULE_INDEX, | ||
PrimitiveReconstructionFlavor::Portable, | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_module_dumping_by_index_microsoft() { | ||
test_module_dumping_by_index_internal( | ||
"module_dumping_by_index_microsoft", | ||
TEST_MODULE_INDEX, | ||
PrimitiveReconstructionFlavor::Microsoft, | ||
); | ||
} | ||
|
||
#[test] | ||
fn test_module_dumping_by_index_raw() { | ||
test_module_dumping_by_index_internal( | ||
"module_dumping_by_index_raw", | ||
TEST_MODULE_INDEX, | ||
PrimitiveReconstructionFlavor::Raw, | ||
); | ||
} | ||
|
||
fn test_module_dumping_by_index_internal( | ||
snapshot_name: &str, | ||
module_index: usize, | ||
primitives_flavor: PrimitiveReconstructionFlavor, | ||
) { | ||
let mut pdb_file = | ||
PdbFile::load_from_file(Path::new(TEST_PDB_FILE_PATH)).expect("load test.pdb"); | ||
|
||
let module_dump = pdb_file | ||
.reconstruct_module_by_index(module_index, primitives_flavor) | ||
.unwrap_or_else(|_| panic!("module dumping")); | ||
|
||
insta::assert_snapshot!(snapshot_name, module_dump); | ||
} |
10 changes: 10 additions & 0 deletions
10
resym_core/tests/snapshots/module_dumping__module_dumping_by_index_microsoft.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: resym_core/tests/module_dumping.rs | ||
expression: module_dump | ||
--- | ||
using namespace std; | ||
using PUWSTR_C = const WCHAR*; | ||
using TP_CALLBACK_ENVIRON_V3 = _TP_CALLBACK_ENVIRON_V3; | ||
PULONGLONG (__local_stdio_scanf_options)(); // CodeSize=8 | ||
ULONGLONG _OptionsStorage; | ||
VOID (__scrt_initialize_default_local_stdio_options)(); // CodeSize=69 |
10 changes: 10 additions & 0 deletions
10
resym_core/tests/snapshots/module_dumping__module_dumping_by_index_portable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: resym_core/tests/module_dumping.rs | ||
expression: module_dump | ||
--- | ||
using namespace std; | ||
using PUWSTR_C = const wchar_t*; | ||
using TP_CALLBACK_ENVIRON_V3 = _TP_CALLBACK_ENVIRON_V3; | ||
uint64_t* (__local_stdio_scanf_options)(); // CodeSize=8 | ||
uint64_t _OptionsStorage; | ||
void (__scrt_initialize_default_local_stdio_options)(); // CodeSize=69 |
10 changes: 10 additions & 0 deletions
10
resym_core/tests/snapshots/module_dumping__module_dumping_by_index_raw.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: resym_core/tests/module_dumping.rs | ||
expression: module_dump | ||
--- | ||
using namespace std; | ||
using PUWSTR_C = const wchar_t*; | ||
using TP_CALLBACK_ENVIRON_V3 = _TP_CALLBACK_ENVIRON_V3; | ||
unsigned __int64* (__local_stdio_scanf_options)(); // CodeSize=8 | ||
unsigned __int64 _OptionsStorage; | ||
void (__scrt_initialize_default_local_stdio_options)(); // CodeSize=69 |
10 changes: 10 additions & 0 deletions
10
resym_core/tests/snapshots/module_dumping__module_dumping_by_path_portable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: resym_core/tests/module_dumping.rs | ||
expression: module_dump | ||
--- | ||
using namespace std; | ||
using PUWSTR_C = const wchar_t*; | ||
using TP_CALLBACK_ENVIRON_V3 = _TP_CALLBACK_ENVIRON_V3; | ||
uint64_t* (__local_stdio_scanf_options)(); // CodeSize=8 | ||
uint64_t _OptionsStorage; | ||
void (__scrt_initialize_default_local_stdio_options)(); // CodeSize=69 |
Oops, something went wrong.