Re: [Kgdb-bugreport] [PATCH][3/3] Update CVS KGDB's wrt connect / detach

From: Amit S. Kale
Date: Mon Mar 01 2004 - 03:14:46 EST


On Thursday 26 Feb 2004 9:35 pm, Daniel Jacobowitz wrote:
> On Thu, Feb 26, 2004 at 07:41:55AM -0700, Tom Rini wrote:
> > On Thu, Feb 26, 2004 at 01:44:49PM +0530, Amit S. Kale wrote:
> > > On Thursday 26 Feb 2004 3:23 am, Tom Rini wrote:
> > > > The following patch fixes a number of little issues here and there,
> > > > and ends up making things more robust.
> > > > - We don't need kgdb_might_be_resumed or kgdb_killed_or_detached.
> > > > GDB attaching is GDB attaching, we haven't preserved any of the
> > > > previous context anyhow.
> > >
> > > If gdb is restarted, kgdb has to remove all breakpoints. Present kgdb
> > > does that in the code this patch removes:
> > >
> > > - if (remcom_in_buffer[0] == 'H' && remcom_in_buffer[1] == 'c') {
> > > - remove_all_break();
> > > - atomic_set(&kgdb_killed_or_detached, 0);
> > > - ok_packet(remcom_out_buffer);
> > >
> > > If we don't remove breakpoints, they stay in kgdb without gdb not
> > > knowing it and causes consistency problems.
> >
> > Er, what do you mean 'restarted' ? If gdb somehow disconnects 'detach'
> > or ^D^D, remove_all_break() gets called. Is there another way for gdb
> > to somehow disconnect that I don't know of?
>
> Yes. See the disconnect command in recent GDB versions.
>
> > > > - Don't try and look for a connection in put_packet, after we've
> > > > tried to put a packet. Instead, when we receive a packet, GDB has
> > > > connected.
> > >
> > > We have to check for gdb connection in putpacket or else following
> > > problem occurs.
> > >
> > > 1. kgdb console messages are to be put.
> > > 2. gdb dies
> >
> > As in doesn't cleanly remove itself?
>
> Seg faults, for instance.

That's something easily recognizable. There are worse situations where gdb has
to be killed.

GDB sometimes goes into an infinite loop of stub communications, doesn't
respond to Ctrl+C and has to be killed. It's rare, though.

-Amit

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/