kgdb(1) ... is it broken ?

Kostik Belousov kostikbel at gmail.com
Tue Feb 27 10:41:17 UTC 2007


On Mon, Feb 26, 2007 at 06:34:13PM -0500, John Baldwin wrote:
> > Try this patch, it shall allow to see useful backtrace in kgdb (I really
> > like to receive feedback on this one):
> > 
> > Index: gnu/usr.bin/gdb/kgdb/trgt_i386.c
> > ===================================================================
> > RCS file: /usr/local/arch/ncvs/src/gnu/usr.bin/gdb/kgdb/trgt_i386.c,v
> > retrieving revision 1.5
> > diff -u -r1.5 trgt_i386.c
> > --- gnu/usr.bin/gdb/kgdb/trgt_i386.c	11 Sep 2005 05:36:30 -0000	1.5
> > +++ gnu/usr.bin/gdb/kgdb/trgt_i386.c	23 Feb 2007 11:31:39 -0000
> > @@ -146,7 +146,7 @@
> >  	*realnump = -1;
> >  
> >  	ofs = (regnum >= I386_EAX_REGNUM && regnum <= I386_FS_REGNUM)
> > -	    ? kgdb_trgt_frame_offset[regnum] : -1;
> > +	    ? kgdb_trgt_frame_offset[regnum] + 4 : -1;
> >  	if (ofs == -1)
> >  		return;
> 
> You can make the patch by dependent on the kern.osreldate (__FreeBSD_version)
> which is accesible as the global var 'osreldate' in the kernel and use the
> old offset for kernels before Kip's change so it works for both old and new.

That was my intent (in fact, I would prefer to check instruction at calltrap
label directly).

I noted that kgdb machine-specific code pulls sys/proc.h,
machine/frame.h and machine/pcb.h. As result, kgdb have to be built from
the same tree as the kernel itself. Due to this, I do not see high need
for such check.

Anyway, I think that I implement it later this week.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20070227/6767e390/attachment.pgp


More information about the freebsd-current mailing list