Re: kgdb(1) ... is it broken ?

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Tue, 27 Feb 2007 12:40:52 +0200
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
> > _at__at_ -146,7 +146,7 _at__at_
> >  	*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.


Received on Tue Feb 27 2007 - 09:41:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:06 UTC