#include #include #include #include #include #include #include #include #define NO_MINMAX #include int main(int argc, char* argv[]) { int pid = getpid (); std::ostringstream ostr; ostr << "/proc/" << pid << "/maps"; std::ifstream ifs(ostr.str().c_str()); std::cout << ifs.rdbuf() << std::endl; uintptr_t addr; WCHAR wbuf[PATH_MAX]; char nbuf[4*PATH_MAX]; while (std::cin) { std::cin >> std::hex >> addr; if (std::cin) { wbuf[0] = L'\0'; int rval = cygwin_internal(CW_GET_MODULE_PATH_FOR_ADDR, addr, wbuf, PATH_MAX); wcstombs (nbuf, wbuf, 4*PATH_MAX); std::cout << "0x" << std::hex << std::setw(8) << std::setfill('0') << addr << " (" << std::dec << rval << ") " << nbuf << std::endl; } } return 0; }