This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
GDB internals: thread infos
- To: "GDB (E-mail)" <gdb at sourceware dot cygnus dot com>
- Subject: GDB internals: thread infos
- From: Fabrice Gautier <Fabrice_Gautier at sdesigns dot com>
- Date: Tue, 29 Aug 2000 15:36:35 -0700
Hi,
I'm trying to understand how gdb retrieve thread information, thread frame
and thread pc.
I started in the info_threads_command function.
So there in order to retrieve thread $pc it call the
functionswitch_to_thread which I presume do only a frame switch.
So here is this function:
static void
switch_to_thread (pid)
int pid;
{
if (pid == inferior_pid)
return;
inferior_pid = pid;
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc ();
select_frame (get_current_frame (), 0);
}
I assume that inferior_pid should contain the thread id of the current
selected thread.
Then I have a few questions:
What does the registers_changed() should do and where is it defined?
Which pc does the read_pc command should return? The one of the inferior_pid
thread ?
Then in the get_current_frame function, it ends up calling:
current_frame = create_new_frame (read_fp (), read_pc ());
What frame pointer should read_fp() return? I presume this is the one of the
thread we are switching too. right?
idem for read_pc(). But at what point is there an interaction with the
target to get effectively those values.
--
Fabrice Gautier
fabrice_gautier@sdesigns.com