From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,950eeaaa6bea99b9 X-Google-Attributes: gidfee84,public X-Google-Thread: f66ab,1b038563c550e072,start X-Google-Attributes: gidf66ab,public X-Google-ArrivalTime: 1993-09-24 05:42:04 PST Xref: gmd.de comp.unix.osf.osf1:1084 comp.os.mach:2167 Path: gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!bloom-beacon.mit.edu!paperboy.osf.org!gr.osf.org!emcmanus From: emcmanus@gr.osf.org (�amonn McManus) Newsgroups: comp.unix.osf.osf1,comp.os.mach Subject: Re: Debugging server with gdb Date: 24 Sep 1993 12:26:42 GMT Organization: Open Software Foundation Research Institute, Grenoble Message-ID: References: <1993Sep23.184858.112@goofy.fi.upm.es> NNTP-Posting-Host: kaa.gr.osf.org [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 @ 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 for a thread created by cthreads but not currently running a cthread; _t for a thread created by cthreads that is currently running a cthread but has not been named; _K 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