cmd = (struct segment_command_64*)((void*)cmd + cmd->cmdsize);
}
+
+ // We should not be here, but if we are there, we should say about this
+ PyErr_SetString(
+ PyExc_RuntimeError, "Cannot find section address.\n");
return 0;
}
munmap(map, fs.st_size);
if (close(fd) != 0) {
+ // This might hide one of the above exceptions, maybe we
+ // should chain them?
PyErr_SetFromErrno(PyExc_OSError);
}
return result;
mach_port_t proc_ref = pid_to_task(pid);
if (proc_ref == 0) {
- PyErr_SetString(PyExc_PermissionError, "Cannot get task for PID");
return 0;
}
address += size;
}
+
+ PyErr_SetString(PyExc_RuntimeError,
+ "mach_vm_region failed to find the section");
return 0;
}
if (!match_found) {
map_filename[0] = '\0';
+ PyErr_Format(PyExc_RuntimeError,
+ "Cannot find map start address for map: %s", map);
}
return result_address;
static uintptr_t
search_map_for_section(pid_t pid, const char* secname, const char* map)
{
+ PyErr_SetString(PyExc_NotImplementedError,
+ "Not supported on this platform");
return 0;
}
#endif
static uintptr_t
get_async_debug(pid_t pid)
{
- uintptr_t result = search_map_for_section(pid, "AsyncioDebug", "_asyncio.cpython");
+ uintptr_t result = search_map_for_section(pid, "AsyncioDebug",
+ "_asyncio.cpython");
if (result == 0 && !PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Cannot find AsyncioDebug section");
}
}
total_bytes_read = len;
#else
+ PyErr_SetString(
+ PyExc_RuntimeError,
+ "Memory reading is not supported on this platform");
return -1;
#endif
return total_bytes_read;
pid,
coro_address + offsets->gen_object.gi_frame_state,
&gi_frame_state);
+ if (err) {
+ return -1;
+ }
if (gi_frame_state == FRAME_SUSPENDED_YIELD_FROM) {
char owner;