RE: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin
"Zhang, Sonic" <[email protected]> Mon, 28 Dec 2009 18:17:22 +0800
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.debugging.kgdb.bugs,gmane.linux.kernel.debugging |
|---|---|
| Message-ID | <[email protected]> |
A little update. GDB uses field BFIN_PC as the resume address from debugging mode. But, = field pc in struct pt_regs is where kernel resumes from an interrupt. S= o, BFIN_PC is actually retx when do kernel debugging. Sonic=20 --- trunk/arch/blackfin/kernel/kgdb.c 2009-12-28 09:27:27 UTC (rev 8085= ) +++ trunk/arch/blackfin/kernel/kgdb.c 2009-12-28 10:08:30 UTC (rev 8086= ) @@ -79,7 +79,7 @@ gdb_regs[BFIN_RETX] =3D regs->retx; gdb_regs[BFIN_RETN] =3D regs->retn; gdb_regs[BFIN_RETE] =3D regs->rete; - gdb_regs[BFIN_PC] =3D regs->pc; + gdb_regs[BFIN_PC] =3D regs->retx; gdb_regs[BFIN_CC] =3D 0; gdb_regs[BFIN_EXTRA1] =3D 0; gdb_regs[BFIN_EXTRA2] =3D 0; @@ -150,7 +150,7 @@ regs->retx =3D gdb_regs[BFIN_PC]; regs->retn =3D gdb_regs[BFIN_RETN]; regs->rete =3D gdb_regs[BFIN_RETE]; - regs->pc =3D gdb_regs[BFIN_PC]; + regs->pc =3D gdb_regs[BFIN_RETI]; =20 #if 0 /* can't change these */ regs->astat =3D gdb_regs[BFIN_ASTAT]; -----Original Message----- =46rom: Mike Frysinger [mailto:[email protected]]=20 Sent: Sunday, December 27, 2009 5:12 AM To: Jason Wessel Cc: [email protected]; [email protected];= [email protected]; [email protected]; Zhang, Sonic Subject: Re: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for b= lackfin On Wed, Dec 23, 2009 at 16:19, Jason Wessel wrote: > The new debug core api requires all architectures that use to debug=20 > core to implement a function to set the program counter. > > CC: Mike Frysinger <[email protected]> > Signed-off-by: Jason Wessel <[email protected]> > --- > =A0arch/blackfin/kernel/kgdb.c | =A0 =A05 +++++ > =A01 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.= c=20 > index f1036b6..5965188 100644 > --- a/arch/blackfin/kernel/kgdb.c > +++ b/arch/blackfin/kernel/kgdb.c > @@ -644,6 +644,11 @@ int kgdb_arch_remove_breakpoint(unsigned long=20 > addr, char *bundle) > =A0 =A0 =A0 =A0return bfin_probe_kernel_write((char *)addr, bundle,=20 > BREAK_INSTR_SIZE); > =A0} > > +void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) { > + =A0 =A0 =A0 regs->retx =3D ip; > +} > + > =A0int kgdb_arch_init(void) > =A0{ > =A0 =A0 =A0 =A0kgdb_single_step =3D 0; Sonic should be able to check this. our pc handling seems a little won= ky atm: arch/blackfin/kernel/kgdb.c: void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)= { ... gdb_regs[BFIN_RETI] =3D regs->pc; gdb_regs[BFIN_RETX] =3D regs->retx; gdb_regs[BFIN_PC] =3D regs->pc; =2E.. } =2E.. void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)= { ... regs->pc =3D gdb_regs[BFIN_PC]; regs->retx =3D gdb_regs[BFIN_PC]; /* nothing for BFIN_RETI */ =2E.. } -mike