/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 2008-2018 Free Software Foundation, Inc.
+ Copyright (C) 2008-2019 Free Software Foundation, Inc.
Contributed by AdaCore.
darwin_inferior *priv = new darwin_inferior;
inf->priv.reset (priv);
- TRY
+ try
{
kret = task_for_pid (gdb_task, inf->pid, &priv->task);
if (kret != KERN_SUCCESS)
darwin_setup_exceptions (inf);
}
- CATCH (ex, RETURN_MASK_ALL)
+ catch (const gdb_exception &ex)
{
exit_inferior (inf);
inferior_ptid = null_ptid;
- throw_exception (ex);
+ throw;
}
- END_CATCH
target_ops *darwin_ops = get_native_target ();
if (!target_is_pushed (darwin_ops))
/* Maybe it was cached by some earlier gdb. */
if (stat (new_name.c_str (), &sb) != 0 || !S_ISREG (sb.st_mode))
{
- TRY
+ try
{
copy_shell_to_cache (shell, new_name);
}
- CATCH (ex, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &ex)
{
warning (_("This version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb tried to work around SIP by\n\
If you correct the problem, gdb will automatically try again the next time\n\
you \"run\". To prevent these attempts, you can use:\n\
set startup-with-shell off"),
- ex.message);
+ ex.what ());
return false;
}
- END_CATCH
printf_filtered (_("Note: this version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb has worked around this by\n\
if (exec_file)
printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
- target_pid_to_str (ptid_t (pid)));
+ target_pid_to_str (ptid_t (pid)).c_str ());
else
printf_unfiltered (_("Attaching to %s\n"),
- target_pid_to_str (ptid_t (pid)));
-
- gdb_flush (gdb_stdout);
+ target_pid_to_str (ptid_t (pid)).c_str ());
}
if (pid == 0 || ::kill (pid, 0) < 0)
mourn_inferior ();
}
-const char *
+std::string
darwin_nat_target::pid_to_str (ptid_t ptid)
{
- static char buf[80];
long tid = ptid.tid ();
if (tid != 0)
- {
- snprintf (buf, sizeof (buf), _("Thread 0x%lx of process %u"),
- tid, ptid.pid ());
- return buf;
- }
+ return string_printf (_("Thread 0x%lx of process %u"),
+ tid, ptid.pid ());
return normal_pid_to_str (ptid);
}