Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>, Kevin Buettner <kevinb@redhat.com>
Cc: gdb@sources.redhat.com
Subject: Re: What to do with threads?
Date: Mon, 03 Mar 2003 23:40:00 -0000	[thread overview]
Message-ID: <3E63E7D8.2030401@redhat.com> (raw)
In-Reply-To: <3E3D87B5.9080306@redhat.com>

Kevin, to change threads on you (er, sorry, groan)

I wrote:

> Hello,
> 
> To put it simply, how can one fix this:
> 
> static CORE_ADDR
> d10v_read_pc (ptid_t ptid)
> {
>   ....
>   read_register (PC_REGNUM);
>   ....
> }
> 
> There are problems at many levels.  Off the top of my head:
> 
> - ptid can identify a thread and/or a LWP
> - there sometimes isn't even a thread and/or a LWP
> - the selected and current thread both fight over the same global data structures
> - long long term, an objective is to have gdb debug multiple processes /  ISAs
> - so long term that it is probably funny, an objective is to have gdb debugging multiple targets
> 
> I think we've fought the frame battle and won (the casualties will take ages to recover mind :-), the thread battle, I think, is next.

We wrote:

> On Mar 2,  3:25pm, Andrew Cagney wrote:
> 
> 
>> Following on from my recent post to add an unwind_dummy_id() method, 
>> this code adds architecture specific methods to handle the edge case of 
>> unwinding the sentinel frame's PC/ID.
>> 
>> While I'm pretty sure that the methods are needed, I'm not 100% certain 
>> of their interfaces.  The attached has:
>> 
>> 	unwind_sentinel_id(arch, regcache, unwind_cache)
>> 
>> I'm wondering if, instead it should use something like:
>> 
>> 	unwind_sentinel_id(arch, tpid, unwind_cache)
>> 
>> where a new method:
>> 
>> 	tpid_regcache (tpid)
>> 
>> could be used to obtain the tpid's register cache.  I'm thinking this 
>> since, for the case of the i386, it may need the thread's state in 
>> addition to registers when determing the `pc'.
> 
> 
> s/tpid/ptid/ in the above.
> 
> ptid_regcache() does sound useful.

(I get the feeling that this frame code is currently running head-long 
into the limitiations of the thread code)

Since GDB's frames have a very short life time (flushed the moment there 
is even the faintest wiff of a changed target) it may be possible to 
instead use `struct thread_info':

	struct thread_info *get_frame_thread (frame)

and

	get_thread_regcache (thread_info);

For this to work, though, there would need to be a function that was 
guarenteed to always return a thread_info object.  Such a 
get_selected_thread() or find_thread_by_tpid(?inferior_tpid?) would need 
to return a thread object when there were no threads ...

Andrew



  parent reply	other threads:[~2003-03-03 23:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-02 21:04 Andrew Cagney
2003-02-03 16:58 ` Quality Quorum
2003-03-03 23:40 ` Andrew Cagney [this message]
2003-03-04  2:59   ` Daniel Jacobowitz
2003-03-04 14:35     ` Andrew Cagney

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=3E63E7D8.2030401@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=kevinb@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