Skip to content

Commit

Permalink
Merge pull request #3 from acj/fix-64-bit-symbol-offsets
Browse files Browse the repository at this point in the history
Fix 64-bit symbol lookup arithmetic
  • Loading branch information
acj authored Dec 31, 2023
2 parents 3e78bcc + 2a7e640 commit 29ed0db
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/process/process_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ impl ProcessInfo {
let library = {
let libmap = maps.iter().find(|m| {
if let Some(path) = m.filename() {
#[cfg(target_os = "windows")]
return is_lib::<T>(path) && m.is_read();
#[cfg(not(target_os = "windows"))]
return is_lib::<T>(path) && m.is_exec();
}
false
Expand Down Expand Up @@ -265,7 +268,7 @@ where
use proc_maps::win_maps::SymbolLoader;

let handler = SymbolLoader::new(pid)?;
let _module = handler.load_module(filename)?; // need to keep this module in scope
let module = handler.load_module(filename)?; // need to keep this module in scope

let mut ret = HashMap::new();

Expand All @@ -277,7 +280,7 @@ where
// If we have a module base (ie from PDB), need to adjust by the offset
// otherwise seems like we can take address directly
let addr = if base == 0 {
addr
offset + addr - module.base
} else {
offset + addr - base
};
Expand Down

0 comments on commit 29ed0db

Please sign in to comment.