- char* maps_name = bprintf("/proc/%d/maps", (int) getpid());
- FILE* maps = fopen(maps_name, "r");
-
- long int addr = strtol(addrs[i].c_str(), &p, 16);
- if (*p != '\0') {
- XBT_CRITICAL("Cannot parse backtrace address '%s' (addr=%#lx)",
- addrs[i].c_str(), addr);
+ std::string maps_name = std::string("/proc/") + std::to_string(getpid()) + "/maps";
+ std::ifstream maps(maps_name);
+ if (not maps) {
+ XBT_CRITICAL("open(\"%s\") failed: %s", maps_name.c_str(), strerror(errno));
+ continue;