rem: debug_nub_read_memory message; debug_nub_read_memory_reply reply; status_t err;  message.reply_port = sTeamDebugInfo.reply_port; message.address = (void*)memaddr; message.size = len;  err = haiku_send_debugger_message(&sTeamDebugInfo, B_DEBUG_MESSAGE_READ_MEMORY, &message, sizeof(message), &reply, sizeof(reply)); if (err != B_OK || reply.error != B_OK) return 0;  memcpy(myaddr, reply.data, reply.size); return reply.size;
add: ssize_t bytesRead = debug_read_memory_partial(&sTeamDebugInfo.context, (const void *)memaddr, myaddr, len); return (bytesRead < 0 ? 0 : bytesRead);
context: haiku_child_deprecated_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,	int write, struct mem_attrib *attrib, struct target_ops *target){	TRACE(("haiku_child_deprecated_xfer_memory(0x%8lx, %p, %d, %d, %p, %p)\n",		(uint32)memaddr, myaddr, len, write, attrib, target));	if (len <= 0)		return 0;	if (write) {		// write		debug_nub_write_memory message;		debug_nub_write_memory_reply reply;		status_t err;		if (len > B_MAX_READ_WRITE_MEMORY_SIZE)			len = B_MAX_READ_WRITE_MEMORY_SIZE;		message.reply_port = sTeamDebugInfo.reply_port;		message.address = (void*)memaddr;		message.size = len;		memcpy(message.data, myaddr, len);		err = haiku_send_debugger_message(&sTeamDebugInfo,			B_DEBUG_MESSAGE_WRITE_MEMORY, &message, sizeof(message), &reply,			sizeof(reply));		if (err != B_OK || reply.error != B_OK){TRACE(("haiku_child_deprecated_xfer_memory() failed: %lx\n",(err != B_OK ? err : reply.error)));			return 0;}TRACE(("haiku_child_deprecated_xfer_memory(): -> %ld\n", reply.size));		return reply.size;	} else {		// read		debug_nub_read_memory message;		debug_nub_read_memory_reply reply;		status_t err;		message.reply_port = sTeamDebugInfo.reply_port;		message.address = (void*)memaddr;		message.size = len;		err = haiku_send_debugger_message(&sTeamDebugInfo,			B_DEBUG_MESSAGE_READ_MEMORY, &message, sizeof(message), &reply,			sizeof(reply));		if (err != B_OK || reply.error != B_OK)			return 0;		memcpy(myaddr, reply.data, reply.size);		return reply.size;	}	return -1;}