From af4df812ae3937b62d8fb3c1acc917c42c01f9f2 Mon Sep 17 00:00:00 2001 From: Andrew Gallagher Date: Wed, 25 Oct 2023 19:55:23 -0700 Subject: [PATCH] [third-party/py-spy/0.3.14] Align virtual address base Summary: This fixes a bug where we were calculating incorrect address offsets. This tool now works on our Python binaries. Test Plan: ``` $ buck2 run fbsource//third-party/py-spy/0.3.14:py-spy -- dump -p 1245593 ``` Reviewers: bmaurer, itamaro, lisroach Reviewed By: bmaurer Subscribers: mzlee Differential Revision: https://phabricator.intern.facebook.com/D50649635 --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + src/binary_parser.rs | 8 +++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fdf60cf..0664710e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -953,6 +953,16 @@ version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "parking_lot_core" version = "0.9.10" @@ -1065,6 +1075,7 @@ dependencies = [ "lru", "memmap2", "num-traits", + "page_size", "proc-maps", "py-spy-testdata", "rand", diff --git a/Cargo.toml b/Cargo.toml index c0e6c946..8327bd32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ lru = "0.10" num-traits = "0.2" regex = ">=1.6.0" tempfile = "3.6.0" +page_size = "0.6.0" proc-maps = "0.4.0" memmap2 = "0.9.4" cpp_demangle = "0.4" diff --git a/src/binary_parser.rs b/src/binary_parser.rs index 4df02687..7dae27b9 100644 --- a/src/binary_parser.rs +++ b/src/binary_parser.rs @@ -150,9 +150,11 @@ pub fn parse_binary(filename: &Path, addr: u64, size: u64) -> Result