summaryrefslogtreecommitdiff
path: root/library/Process-darwin.cpp
diff options
context:
space:
mode:
authorTimothy Collett2012-06-19 10:51:47 -0400
committerTimothy Collett2012-06-19 10:51:47 -0400
commit40e764a46b4af3d0fe073a74421f8724a0c5d6a8 (patch)
tree7e5ff26fff96e4a475bb48ffed8828de1fe6e04b /library/Process-darwin.cpp
parent9b941bcd4d93aa1cccf8afcd98eec9c158411d05 (diff)
downloaddfhack-40e764a46b4af3d0fe073a74421f8724a0c5d6a8.tar.gz
dfhack-40e764a46b4af3d0fe073a74421f8724a0c5d6a8.tar.bz2
dfhack-40e764a46b4af3d0fe073a74421f8724a0c5d6a8.tar.xz
Some more tweaks to the memory-finding code
Diffstat (limited to 'library/Process-darwin.cpp')
-rw-r--r--library/Process-darwin.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/library/Process-darwin.cpp b/library/Process-darwin.cpp
index d043e5b1..5a97d9e0 100644
--- a/library/Process-darwin.cpp
+++ b/library/Process-darwin.cpp
@@ -130,6 +130,16 @@ string Process::doReadClassName (void * vptr)
#include <mach/vm_statistics.h>
#include <dlfcn.h>
+const char *
+inheritance_strings[] = {
+ "SHARE", "COPY", "NONE", "DONATE_COPY",
+};
+
+const char *
+behavior_strings[] = {
+ "DEFAULT", "RANDOM", "SEQUENTIAL", "RESQNTL", "WILLNEED", "DONTNEED",
+};
+
void Process::getMemRanges( vector<t_memrange> & ranges )
{
@@ -162,7 +172,7 @@ void Process::getMemRanges( vector<t_memrange> & ranges )
int dlcheck;
dlcheck = dladdr((const void*)address, &dlinfo);
if (dlcheck==0) {
- dlinfo.dli_fname = "(none)";
+ dlinfo.dli_fname = "";
}
t_memrange temp;
@@ -177,20 +187,36 @@ void Process::getMemRanges( vector<t_memrange> & ranges )
temp.valid = true;
ranges.push_back(temp);
+ fprintf(stderr,
+ "%08x-%08x %8uK %c%c%c/%c%c%c %11s %6s %10s uwir=%hu sub=%u dlname: %s\n",
+ address, (address + vmsize), (vmsize >> 10),
+ (info.protection & VM_PROT_READ) ? 'r' : '-',
+ (info.protection & VM_PROT_WRITE) ? 'w' : '-',
+ (info.protection & VM_PROT_EXECUTE) ? 'x' : '-',
+ (info.max_protection & VM_PROT_READ) ? 'r' : '-',
+ (info.max_protection & VM_PROT_WRITE) ? 'w' : '-',
+ (info.max_protection & VM_PROT_EXECUTE) ? 'x' : '-',
+ inheritance_strings[info.inheritance],
+ (info.shared) ? "shared" : "-",
+ behavior_strings[info.behavior],
+ info.user_wired_count,
+ info.reserved,
+ dlinfo.dli_fname);
+
address += vmsize;
} else if (kr != KERN_INVALID_ADDRESS) {
- if (the_task != MACH_PORT_NULL) {
+ /*if (the_task != MACH_PORT_NULL) {
mach_port_deallocate(mach_task_self(), the_task);
- }
+ }*/
return;
}
} while (kr != KERN_INVALID_ADDRESS);
- if (the_task != MACH_PORT_NULL) {
+/* if (the_task != MACH_PORT_NULL) {
mach_port_deallocate(mach_task_self(), the_task);
- }
+ }*/
}
uint32_t Process::getBase()