Skip to content

Instantly share code, notes, and snippets.

@joubertnel
Last active February 23, 2019 23:06
Show Gist options
  • Save joubertnel/267ca0fff4eaad494cc19ec3ba7953ed to your computer and use it in GitHub Desktop.
Save joubertnel/267ca0fff4eaad494cc19ec3ba7953ed to your computer and use it in GitHub Desktop.
darwin-nat.c variable shadowing diff
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 8c34aa8a3f..d36e23b450 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -687,7 +687,6 @@ darwin_decode_exception_message (mach_msg_header_t *hdr,
/* Not a known inferior. This could happen if the child fork, as
the created process will inherit its exception port.
FIXME: should the exception port be restored ? */
- kern_return_t kret;
mig_reply_error_t reply;
inferior_debug
@@ -1125,14 +1124,14 @@ darwin_decode_message (mach_msg_header_t *hdr,
if (!priv->no_ptrace)
{
- pid_t res;
+ pid_t wpid;
int wstatus;
- res = wait4 (inf->pid, &wstatus, 0, NULL);
- if (res < 0 || res != inf->pid)
+ wpid = wait4 (inf->pid, &wstatus, 0, NULL);
+ if (wpid < 0 || wpid != inf->pid)
{
- printf_unfiltered (_("wait4: res=%d: %s\n"),
- res, safe_strerror (errno));
+ printf_unfiltered (_("wait4: wpid=%d: %s\n"),
+ wpid, safe_strerror (errno));
status->kind = TARGET_WAITKIND_IGNORE;
return minus_one_ptid;
}
@@ -1147,8 +1146,8 @@ darwin_decode_message (mach_msg_header_t *hdr,
status->value.sig = gdb_signal_from_host (WTERMSIG (wstatus));
}
- inferior_debug (4, _("darwin_wait: pid=%d exit, status=0x%x\n"),
- res, wstatus);
+ inferior_debug (4, _("darwin_wait: pid=%d exit, wpid=0x%x\n"),
+ wpid, wstatus);
/* Looks necessary on Leopard and harmless... */
wait4 (inf->pid, &wstatus, 0, NULL);
@@ -1559,7 +1558,6 @@ darwin_nat_target::kill ()
signaled thus darwin_decode_message function knows that the kill
signal was sent by gdb and will take the appropriate action
(cancel signal and reply to the signal message). */
- darwin_inferior *priv = get_darwin_inferior (inf);
for (darwin_thread_t *thread : priv->threads)
thread->signaled = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment