Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: emcmanus@gr.osf.org (�amonn McManus)
Subject: Re: Debugging server with gdb
Date: 24 Sep 1993 12:26:42 GMT	[thread overview]
Message-ID: <tread@kaa.gr.osf.org> (raw)
In-Reply-To: 1993Sep23.184858.112@goofy.fi.upm.es

[Crossposted to comp.os.mach, since this is perhaps of general
interest to people debugging OS servers under Mach3.0.]

mliebana@laurel.datsi.fi.upm.es (Miguel Angel Liebana Presa) writes:
>         We are using the modified version gdb4.6 to debug OSF/1 Release
> 1.0.4 MK 4.1. This version of gdb uses Mach IPC to attach to a running
> process.
> 	During server debugging We would like to change the selected thread, 
> using the "thread suspend" command on the current selected thread, 
> and then using "thread select" to activate another thread. The problem is
> that the "continue" command tries to execute instructions from the
> suspended thread, and not the selected thread.

First of all, in case there is any confusion, it's worth noting that
the continue command continues all threads, not just the current one.
"thread select" is just used to set the context for examining
variables and stack frames and for single-stepping; otherwise it has
no effect on which threads are run.

The problem is that when gdb has hit a breakpoint, it wants to execute
the instruction "under" the breakpoint, i.e., the instruction whose
first byte was replaced with the breakpoint instruction.  When you
continue, this is the first thing gdb does; but if the thread in
question is suspended it won't get anywhere.  What will probably work
for you is to single-step the breakpointed instruction with the "si"
command before doing any "thread suspend" or "continue" commands.
Then gdb no longer needs to do anything special on continue.

> 	As I have no documentation of this special version of gdb, I don't 
> know what is a "selected thread", and what on earth I am doing when I perform
> a "thread select" command. I also don't know the meaning of fields displayed
> responding to "thread list" command.

I'm not aware of any detailed document with the Mach extensions.  I
explained "thread select" above.  The "thread list" command produces
(in a slightly more recent version) fields like these:
@    MID  Name                  KState CState   Where
28    66  2nd cons read         S1     R  wired <second_read+14>

@      is gdb's internal name for this thread.  You can refer to "@28"
       in commands like "thread select".
MID    is the thread id given by machid, as shown in the ms command.
       You can also say "thread select 66".  A * is appended if this is
       the currently-selected thread.
Name   is the cthread name as set by cthread_set_name(), or if there is
       none it is a name generated as follows:
       _C<number> for a thread created by cthreads but not currently
         running a cthread;
       _t<number> for a thread created by cthreads that is currently
         running a cthread but has not been named;
       _K<number> for a thread not created by cthreads.
KState is the kernel state of the thread, made up of the following
       codes:
       * E for a non-cthreads thread that is running in the emulator;
       * A letter corresponding to the thread_basic_info.run_state:
         R for TH_STATE_RUNNING (you don't usually see this because
           gdb stops the task before prompting for commands);
         S for TH_STATE_STOPPED;
         W for TH_STATE_WAITING;
         U for TH_STATE_UNINTERRUPTIBLE;
         H for TH_STATE_HALTED;
       * The suspend count for the thread.
CState is the cthreads state of the thread:
       R if it is runnable;
       S if it is switching contexts;
       B if it is blocked (typically in condition_wait or mutex_lock)
         and not wired;
       C or CS if it is blocked in condition_wait and (typically)
         wired.
       The word "wired" appears if the cthread is wired to a kernel
       thread.
Where  is the address of the next instruction to be executed by the
       thread.

> 	Is there any document explaining the special features of the
> gdb4.6 supplied with OSF/1?. 

There's not much more than what appears in the MACH3-README file in
the sources.  This message already contains far more documentation on
the extensions than the world has ever seen.

,
Eamonn


      reply	other threads:[~1993-09-24 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-23 16:48 Debugging server with gdb Miguel Angel Liebana Presa
1993-09-24 12:26 ` �amonn McManus [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox