This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Debugging gdb with gdb


On Sun, Feb 03, 2002 at 04:18:45PM +0100, Joel Brobecker wrote:
> > So the question is:  How do I temporarily stop the target application in 
> > gdb---set a break point in the target---then continue?  This is useful in 
> > GUI applications as well.
> 
> FWIW, I debug GDB a bit differently: I start the inferior GDB in a
> terminal. I then run another GDB, and attach it to the inferior.
> The idea behind this is that I want to avoid mixing the I/O in the
> inferior with the commands I'm sending to GDB.
> 
> For the GUI lovers, GVD facilitates this, because it offers a
> File->Attach menu, which will then present you with a list of process.
> Click, click, click, and you're attached...

Happen to have a trick to get the inferior GDB to wait for the attaching GDB
to place breakpoints prior to the inferior setting up a remote debug session.
skdb starts the inferior gdb with a named pipe (see attached), I'm thinking 
about adding a loop to spin till a global variable is set by the attaching
gdb to indicate that the inferionr gdb can progress with setting up the 
remote connections and sent the 'g' packet.

------------------------------------------------------------------------------------
  3298  /* Read the remote registers into the block REGS.  */
  3299  /* Currently we just read all the registers, so we don't use regno.  */
  3300
  3301  remote_fetch_registers_blocked = 1;			<<-----
  3302
  3303  /* ARGSUSED */
  3304  static void
  3305  remote_fetch_registers (int regno)
  3306  {
  3307    char *buf = alloca (PBUFSIZ);
  3308    int i;
  3309    char *p;
  3310    char *regs = alloca (REGISTER_BYTES);
  3311
  3312    while(remote_fetch_registers_blocked) {		<<---
  3313          sleep(1);					<<---
  3314    }							<<---
  .
  .
  .
------------------------------------------------------------------------------------

-piet

Attachment: skdb.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]