Subject: Re: issues with KGDB and ARM
To: None <port-arm@netbsd.org>
From: Karl Janmar <karl@utopiafoundation.org>
List: port-arm
Date: 03/29/2005 09:29:58
Hi there,

To clarify my erlier post;

I had to patch arm/include/db_machdep.h to get KGDB working. Is anybody 
else using KGDB on a ARM target? If so, how can you get it running 
without this change?

I agree that this is not the right way to solve the problem, as it 
dictate the use if a GDB5 undefined instruction if KGDB is set...

Maybe this is fixed in the HEAD branch, I hadn't internet access when I 
did this, is somebody aware/informed about the status?
- Karl

Karl Janmar wrote:
> Hi there ARM hackers!
> 
> I have put some work in my GP32 port (which I talked about erlier in 
> this list). I had some issues when I was using KGDB with netbsd/arm.
> I use the 2.0 Release as my source base.
> 
>  I needed to do some modification to generate a valid KGDB undefined 
> instruction when single stepping, if I don't do this the kernel will 
> generate an unhandled undefined exception.
> 
> This happen when sys/ddb/db_run.c: db_set_single_step() calling machdep 
> stuff in db_machdep.c inserting a BKPT_INST.
> 
> 
> 
> RCS file: /cvsroot/src/sys/arch/arm/include/db_machdep.h,v
> retrieving revision 1.8
> diff -u -r1.8 db_machdep.h
> --- db_machdep.h        9 Jul 2003 20:14:15 -0000       1.8
> +++ db_machdep.h        28 Mar 2005 22:53:01 -0000
> @@ -58,7 +58,12 @@
>  #endif
> 
>  #define        BKPT_ADDR(addr) (addr)                  /* breakpoint 
> address */
> +#if defined(DDB)
>  #define        BKPT_INST       (KERNEL_BREAKPOINT)     /* breakpoint 
> instruction */
> +#else
> +/* breakpoint instruction if we use KGDB, this is used in 
> db_set_temp_breakpoint() */
> +#define        BKPT_INST       (GDB5_BREAKPOINT)
> +#endif
>  #define        BKPT_SIZE       (INSN_SIZE)             /* size of 
> breakpoint inst */
>  #define        BKPT_SET(inst)  (BKPT_INST)
> 
> This might not be the best place to put the logic, seperation ddb/kgdb.
> 
> 
> Too tired to write something else then nonsens now. bbl
> - Karl