Re: [RFA] Darwin/x86 port (v2 - part 2: darwin-nat.?)

Eli Zaretskii
2008-11-14T11:32:20Z

> Date: Wed, 12 Nov 2008 11:11:32 +0100
> From: Tristan Gingold <gingold@adacore.com>
>
> darwin-nat.c:

Thanks.

> void
> mach_check_error (kern_return_t ret, const char *file,
> unsigned int line, const char *func)
> {
> if (ret == KERN_SUCCESS)
> return;
> if (func == NULL)
> func = "[UNKNOWN]";
>
> error ("error on line %u of \"%s\" in function \"%s\": %s (0x%lx)\n",
> line, file, func, mach_error_string (ret), (unsigned long) ret);

Again, please enclose all user messages in _(), for future
translations.

> if (0)
> printf_unfiltered ("darwin_check_new_threads: old=%d new=%d\n",
> old_nbr, new_nbr);

Should we delete this dead code?

> if (0)
> printf_unfiltered (" old=%x new=%x\n", old_id, new_id);

And this.

> #if 0
> kret = mach_port_deallocate (gdb_task, exc_msg.thread_port);
> MACH_CHECK_ERROR (kret);
> #endif

And this.

> res = PTRACE (PT_CONTINUE, pid, (caddr_t)1, 0);
> if (res < 0)
> printf_unfiltered ("ptrace CONT: res=%d\n", res);

This looks like a debugging print-out, so perhaps it should be printed
only if some debug option is set.

> if (kret != MACH_MSG_SUCCESS)
> {
> printf_unfiltered ("mach_msg: ret=%x\n", kret);

And this one as well.

> /* Debug: display message. */
> if (0)
> {
> const unsigned long *buf = (unsigned long *) hdr;
> unsigned int i;

More dead code to be removed?

> printf ("Bad local-port: %x\n", hdr->msgh_local_port);

Another debug printout?

> /* Wait until gdb is ready. */
> res = read (ptrace_fds[0], &c, 1);
> if (res != 0)
> fprintf (stderr, "unexpected read result: %d\n", res);

And another?

> printf_unfiltered ("Unable to detach to process-id %d: %s (%d)",
^^^^^^^^^^^^
"to detach from"

> add_setshow_zinteger_cmd ("inferior", class_obscure,
> &inferior_debug_flag, _("\
> Set if printing inferior communication debugging statements."), _("\
> Show if printing inferior communication debugging statements."), NULL,
> NULL, NULL,
> &setdebuglist, &showdebuglist);
>
> add_setshow_boolean_cmd ("mach-exceptions", class_support,
> &enable_mach_exceptions, _("\
> Set if mach exceptions are caught."), _("\
> Show if mach exceptions are caught."), _("\
> When this mode is on, all low level exceptions are reported before being\n\
> reported by the kernel."),
> &set_enable_mach_exceptions, NULL,
> &setlist, &showlist);

These options should be described in the GDB user manual. Please
submit a suitable documentation patch.