Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Pedro Alves <palves@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] btrace: avoid tp != NULL assertion
Date: Tue, 03 Mar 2015 12:25:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B231E6EF176@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <54F5A12F.9000702@redhat.com>

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Tuesday, March 3, 2015 12:55 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] btrace: avoid tp != NULL assertion


> Frame #7 where we convert the ptid to something inf-ptrace.c understands.
> 
> The fix is just to stop losing information.  This also improves
> performance a tiny bit, as currently we fetch registers out of ptrace
> twice, once for {pid,lwp} in linux-nat.c, and another for {pid,0} in
> inf-ptrace/i386-linux-nat.c.  We'll now use a single regcache object
> everywhere.
> 
> Please try the patch below.

It works.  Thanks.  I'll drop my patch, then.


> Note that this in your patch:
> 
> +  lwp = ptid_get_lwp (ptid);
> +  if (lwp == 0)
> +    {
> +      int pid;
> +
> +      /* Not a threaded program.  Use the PID as LWP ID.  */
> +      pid = ptid_get_pid (ptid);
> +      ptid = ptid_build (pid, pid, 0);
> +    }
> +
> +  return find_thread_ptid (ptid);
> +}
> +
> 
> is wrong because when debugging a multi-threaded program, you'll
> have e.g. ({pid,lwp}) {1,1}, {1,2}, {1,3}, etc.  Your patch makes
> btrace look for {2,2}, {3,3}, etc. in the thread list, which just
> aren't there, and thus return NULL.  I assume that that's why you
> needed to downgrade the asserts to errors.

No, that wasn't the reason for replacing the assert.  There are no such
errors in the gdb.btrace suite (which is mostly single-threaded) with my
patch and I have not seen any such errors otherwise, either.  I just found
it safer and more user-friendly in case we run into further problems in
this area.

I see what you mean, though...

> -  /* Convert to something the lower layer understands.  */
> -  ptid = pid_to_ptid (ptid_get_lwp (lp->ptid));
> -  linux_ops->to_resume (linux_ops, ptid, step, signo);


Regards,
Markus.

Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


  reply	other threads:[~2015-03-03 12:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  9:25 Markus Metzger
2015-03-02 22:09 ` Pedro Alves
2015-03-03 10:49   ` Metzger, Markus T
2015-03-03 11:55     ` Pedro Alves
2015-03-03 12:25       ` Metzger, Markus T [this message]
2015-03-03 13:41         ` Pedro Alves
2015-03-03 13:55           ` Metzger, Markus T
2015-03-03 14:03             ` Pedro Alves
2015-03-03 14:45               ` Metzger, Markus T
2015-03-03 15:25                 ` Pedro Alves
2015-03-03 15:37                   ` Metzger, Markus T
2015-03-03 15:49                     ` Pedro Alves

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=A78C989F6D9628469189715575E55B231E6EF176@IRSMSX104.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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