darling icon indicating copy to clipboard operation
darling copied to clipboard

Implement `vmmap`

Open trungnt2910 opened this issue 4 years ago • 6 comments

Tool What tool is missing? What is it supposed to do? Is it or a variant open-source?

vmmap is missing. vmmap itself is not open-source, but I've actually got an open source variant working on Big Sur (threw the code away though).

Example Command What is an example command for this tool?

Taken from CoreCLR source:

char vmmapCommand[100];
int chars = snprintf(vmmapCommand, sizeof(vmmapCommand), "/usr/bin/vmmap -interleaved %d -wide", dwProcessId);
_ASSERTE(chars > 0 && chars <= sizeof(vmmapCommand));

System Information What system are you running?

Software Version
Darling 289628cccf0cd7567c1d275f09600ad214d26acd

trungnt2910 avatar Nov 20 '21 12:11 trungnt2910

An additional note: As Darling runs specifically on Linux, we might be able to exploit the procfs maps.

The tool I tested is known to be missing regions compared to the real vmmap.

trungnt2910 avatar Nov 20 '21 12:11 trungnt2910

There is an open source reimplementation, but it lacks support for all the parameters.

LubosD avatar Nov 20 '21 12:11 LubosD

This one worked on my Big Sur, but doesn't work on Darling (problem with mach_vm_region_recurse I guess?).

trungnt2910 avatar Nov 20 '21 12:11 trungnt2910

There is an open source reimplementation, but it lacks support for all the parameters.

Also it doesn't compile at all.

trungnt2910 avatar Nov 20 '21 12:11 trungnt2910

image

I have a basically working implementation of vmmap on Darling in C++, and I'm planning to release it under the MIT license. It may be merged into Darling if you're interested.

trungnt2910 avatar Nov 22 '21 02:11 trungnt2910

https://github.com/trungnt2910/vmmap

Here, if you are interested.

trungnt2910 avatar Nov 22 '21 06:11 trungnt2910