Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Subhashini Nagarajan Rao <subhashini.nagarajan@wipro.com>
Cc: gdb@sources.redhat.com
Subject: Re: Remote debugging of multithreaded programs using gdbserver
Date: Fri, 19 Apr 2002 09:16:00 -0000	[thread overview]
Message-ID: <20020419121639.B24030@nevyn.them.org> (raw)
In-Reply-To: <097c01c1e7a2$6f484510$68b17fc0@wipro.com>

On Fri, Apr 19, 2002 at 06:32:17PM +0530, Subhashini Nagarajan Rao wrote:
> Hi Daniel, 
> 
>   With reference to your comment on the PC-adjustment, we tried to avoid it and 
> the design for that is given below. I had also tested with this change and things
> are working fine. Requesting your valuable comments on this. 
> 
> In order to avoid the PC-adjustment for the threads other than the thread of 
> interest (thread_to_cont), we can remember the stop_event for the other threads.
> which may require the following, 
>  i) A boolean, has_pending, in the threadid_info structure to denote that that 
>    particular thread has got a trap event (due to hitting a breakpoint) pending. This 
>    should be initialised to 0. 
> 
> (Note - in the details that follow, thread_to_cont refers to the thread of interest, 
>                                                'tp' refers to a thread in the list of current threads in 
>                                                 the program maintained in 'threadid_list' )
> 
> The changes to be made are, 
>  i) In stop_all_threads(), if it is found that a thread has hit a breakpoint 
>     then set the boolean tp->has_pending. Remove the code corresponding 
>     to cancelling of breakpoints. 
> ii) Do not reset tp->status for the threads which has tp->has_pending set as 
>     it will have the trap event recorded. (This will be automatically taken care of
>     if the code corresponding to cancellation of breakpoints is removed). 

I reached the point in my implementation where I needed this code
yesterday.  I got it to work, but in the process gained a good
understanding for why it is done the other way in core GDB - because
otherwise, if a breakpoint is removed after two threads have hit it,
one of them will resume with the wrong PC and a bogus SIGTRAP.

You should be able to reproduce this with pthreads.c in the GDB
testsuite, by setting a breakpoint on common_function if hits >= 15,
continuing to it, disabling the breakpoint, and continuing again.  That
most likely requires SMP in order to see it; I highly recommend testing
all thread-debugging work on SMP.

I think that this approach is still valuable, because it simplifies the
arbitration logic, but backing off of breakpoints may still be
necessary.

> **************************Disclaimer************************************
> Information contained in this E-MAIL being proprietary to Wipro Limited
> is 'privileged' and 'confidential' and intended for use only by the
> individual or entity to which it is addressed. You are notified that any
> use, copying or dissemination of the information contained in the E-MAIL
> in any manner whatsoever is strictly prohibited.
> ********************************************************************

This form of disclaimer violates the accepted policy for most mailing
lists; the GCC lists page explicitly says:

|Please do not include or reference confidentiality notices, like:
|
|  The referring document contains privileged and confidential
|  information. If you are not the intended recipient you must not
|  disseminate, copy or take any action in reliance on it, and we request
|  that you notify companyname immediately.
|
|Such disclaimers are inappropriate for mail sent to public lists. If
|your company automatically adds something like this to outgoing mail,
|and you can't convince them to stop, you might consider using a free
|web-based e-mail account.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-04-19 16:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-19  5:56 Subhashini Nagarajan Rao
2002-04-19  9:16 ` Daniel Jacobowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-22 23:35 Subhashini Nagarajan Rao
2002-04-22 23:45 ` Daniel Jacobowitz
2002-04-18  6:20 Subhashini Nagarajan Rao
2002-04-18  7:56 ` Daniel Jacobowitz
2002-04-17 21:53 Subhashini Nagarajan Rao
2002-04-17 22:42 ` Daniel Jacobowitz

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=20020419121639.B24030@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=subhashini.nagarajan@wipro.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