Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X: mapped memory regions report incorrect file name #394

Closed
giampaolo opened this issue May 23, 2014 · 3 comments
Closed

OS X: mapped memory regions report incorrect file name #394

giampaolo opened this issue May 23, 2014 · 3 comments

Comments

@giampaolo
Copy link
Owner

From asqueella on June 18, 2013 01:11:25

In _psutil_osx.c get_process_memory_maps() (see #260) the file names are off by one line.

I think the proc_regionfilename() should be called with the base address of a 
region, not with address+size: 
https://code.google.com/p/psutil/source/browse/psutil/_psutil_osx.c?spec=svn578700e9906f2e92ef76a56dabf3ed7d7a9740c2&r=578700e9906f2e92ef76a56dabf3ed7d7a9740c2#346
 This is OS X 10.7 (Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; 
root:xnu-1699.32.7~1/RELEASE_X86_64):

$ sudo python examples/pmap.py 60271
00000000033a1000         4K  r--/rwx [prv]
0000000003400000        12K  rw-/rwx /Users/...
0000000003500000    100000K  r--/r-x /Users/...

$ vmmap -v 60271
MALLOC metadata        00000001033a1000-00000001033a2000 [    4K     4K     4K] 
r--/rwx SM=COW
MALLOC_TINY            0000000103400000-0000000103500000 [ 1024K    12K    12K] 
rw-/rwx SM=COW          DefaultMallocZone_0x103371000
mapped file            0000000103500000-00000001096a8000 [ 97.7M  97.7M     0K] 
r--/r-x SM=S/A          /Users/...

Original issue: http://code.google.com/p/psutil/issues/detail?id=394

@giampaolo
Copy link
Owner Author

From [email protected] on June 17, 2013 16:35:45

Thanks for the report looks like that may be correct... arguments to 
proc_regionfilename() should be

proc_regionfilename(
  int pid, 
  uint64_t address,
  void *buffer,
  uint32_t buffersize
);

I think the address += size is meant to be incrementing to the next memory map 
but it's happening before the first call to proc_regionfilename() and throwing 
everything off by one.

@giampaolo
Copy link
Owner Author

From [email protected] on June 17, 2013 17:15:11

Checked in as part of revision 825b10935cc0

Status: FixedInHG

@giampaolo
Copy link
Owner Author

From g.rodola on July 11, 2013 01:54:35

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant