Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Paul Koning" <Paul_Koning@Dell.com>
To: "Pedro Alves" <pedro@codesourcery.com>,	<gdb-patches@sourceware.org>
Subject: RE: [PING] [RFC] Thread debug support for NetBSD 5
Date: Mon, 03 May 2010 13:51:00 -0000	[thread overview]
Message-ID: <D8CEBB6AE9D43848BD2220619A43F3265BCE2A@M31.equallogic.com> (raw)
In-Reply-To: <201004291638.50078.pedro@codesourcery.com>

> > +static int pending_sigs;
> 
> I'm not sure whether this global can get stale between
> debug sessions or not, but it looked like it.  Say, if you
> kill a process while you have pending sigs, the next
> debug session will trip on it being != 0? 

Probably true, I'll fix that.

> It also points
> out that you should probably do something to the pending
> signals when you go about detaching from a process, so
> they don't get lost.

No, this variable is for reporting signals to gdb, so on a detach it
can/should be cleared.
 
> > +  if (catch_syscall_enabled () > 0)
> > +    request = PT_SYSCALL;
> > +  else
> > +    request = PT_CONTINUE;
> 
> I think this will be dead code, since you don't
> support inserting catch syscalls.

I copied that code out of inf-ptrace.c which is the common target code
for targets that use ptrace.  NetBSD was using that before. 
 
> > +  /* An address of (PTRACE_TYPE_ARG3)1 tells ptrace to continue
from
> > +     where it was.  If GDB wanted it to start some other way, we
> have
> > +     already written a new program counter value to the child.  */
> > +  errno = 0;
> 
> If this clearing of errno is needed, then it should move to just
> before the `ptrace' calls.  You have several function calls between
> this and the `ptrace' calls (at least when debugging is enable),
> and any of those could clobber `errno'.  (That's the reason
> for `save_errno' in your patch somewhere else, BTW.)

Right, I missed that when I added the debug messages.  Thanks.
 
> > +      /* If nothing found in the no wait case, report that.  */
> > +      if (options == WNOHANG && pid == 0)
> > +	return pid_to_ptid (-1);
> 
> Use minus_one_ptid, here and everywhere else.
> 
> 
> > +static char *
> > +nbsd_thread_pid_to_str (struct target_ops *ops, ptid_t ptid)
> > +{
> > +  if (TIDGET (ptid) == 0)
> > +    {
> > +      struct target_ops *beneath = find_target_beneath (ops);
> > +
> > +      return beneath->to_pid_to_str (beneath, ptid);
> > +    }
> > +  return xstrprintf (_("Thread %ld"), TIDGET (ptid));
> 
> This leaks.  Nothing ever releases the return of
> target_pid_to_str calls; that's why all implementations
> return a pointer to a static buffer.

Oops.  I copied that from dec-thread.c.
 
	paul


  reply	other threads:[~2010-05-03 13:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 15:49 Paul Koning
2010-04-22 15:36 ` Paul Koning
2010-04-29 14:49   ` [PING] " Paul Koning
2010-04-29 15:39     ` Pedro Alves
2010-05-03 13:51       ` Paul Koning [this message]
2010-04-30 12:44     ` Nick Hudson
2010-05-02 13:29     ` Mark Kettenis
2010-05-03  0:58       ` Paul Koning
2010-05-03 10:50         ` Paul Koning
2010-05-03 11:58         ` Mark Kettenis
2010-05-03 13:39           ` Paul Koning
2010-05-03 20:33     ` Paul Koning
2010-06-10 17:30       ` Tom Tromey
2010-06-11 14:02         ` Pedro Alves
2010-06-11 14:40           ` Paul Koning
2010-06-22 17:37           ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D8CEBB6AE9D43848BD2220619A43F3265BCE2A@M31.equallogic.com \
    --to=paul_koning@dell.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox