+ darwin_resume_inferior (inf);
+ return 0;
+}
+
+static void
+darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
+{
+ printf_unfiltered (_("message header:\n"));
+ printf_unfiltered (_(" bits: 0x%x\n"), hdr->msgh_bits);
+ printf_unfiltered (_(" size: 0x%x\n"), hdr->msgh_size);
+ printf_unfiltered (_(" remote-port: 0x%x\n"), hdr->msgh_remote_port);
+ printf_unfiltered (_(" local-port: 0x%x\n"), hdr->msgh_local_port);
+ printf_unfiltered (_(" reserved: 0x%x\n"), hdr->msgh_reserved);
+ printf_unfiltered (_(" id: 0x%x\n"), hdr->msgh_id);
+
+ if (disp_body)
+ {
+ const unsigned char *data;
+ const unsigned long *ldata;
+ int size;
+ int i;
+
+ data = (unsigned char *)(hdr + 1);
+ size = hdr->msgh_size - sizeof (mach_msg_header_t);
+
+ if (hdr->msgh_bits & MACH_MSGH_BITS_COMPLEX)
+ {
+ mach_msg_body_t *bod = (mach_msg_body_t*)data;
+ mach_msg_port_descriptor_t *desc =
+ (mach_msg_port_descriptor_t *)(bod + 1);
+ int k;
+ NDR_record_t *ndr;
+ printf_unfiltered (_("body: descriptor_count=%u\n"),
+ bod->msgh_descriptor_count);
+ data += sizeof (mach_msg_body_t);
+ size -= sizeof (mach_msg_body_t);
+ for (k = 0; k < bod->msgh_descriptor_count; k++)
+ switch (desc[k].type)
+ {
+ case MACH_MSG_PORT_DESCRIPTOR:
+ printf_unfiltered
+ (_(" descr %d: type=%u (port) name=0x%x, dispo=%d\n"),
+ k, desc[k].type, desc[k].name, desc[k].disposition);
+ break;
+ default:
+ printf_unfiltered (_(" descr %d: type=%u\n"),
+ k, desc[k].type);
+ break;
+ }
+ data += bod->msgh_descriptor_count
+ * sizeof (mach_msg_port_descriptor_t);
+ size -= bod->msgh_descriptor_count
+ * sizeof (mach_msg_port_descriptor_t);
+ ndr = (NDR_record_t *)(desc + bod->msgh_descriptor_count);
+ printf_unfiltered
+ (_("NDR: mig=%02x if=%02x encod=%02x "
+ "int=%02x char=%02x float=%02x\n"),
+ ndr->mig_vers, ndr->if_vers, ndr->mig_encoding,
+ ndr->int_rep, ndr->char_rep, ndr->float_rep);
+ data += sizeof (NDR_record_t);
+ size -= sizeof (NDR_record_t);
+ }
+
+ printf_unfiltered (_(" data:"));
+ ldata = (const unsigned long *)data;
+ for (i = 0; i < size / sizeof (unsigned long); i++)
+ printf_unfiltered (" %08lx", ldata[i]);
+ printf_unfiltered (_("\n"));
+ }
+}
+
+static int
+darwin_decode_exception_message (mach_msg_header_t *hdr,
+ struct inferior **pinf,
+ darwin_thread_t **pthread)
+{
+ mach_msg_body_t *bod = (mach_msg_body_t*)(hdr + 1);
+ mach_msg_port_descriptor_t *desc = (mach_msg_port_descriptor_t *)(bod + 1);
+ NDR_record_t *ndr;
+ integer_t *data;
+ struct inferior *inf;
+ darwin_thread_t *thread;
+ task_t task_port;
+ thread_t thread_port;