Re: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin
Sonic Zhang <[email protected]> Thu, 31 Dec 2009 10:45:43 +0800
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.debugging.kgdb.bugs,gmane.linux.kernel.debugging |
|---|---|
| Message-ID | <[email protected]> |
I have to recall my last wrong patch. In blackfin, kgdb is running in delayed exception IRQ5 other than in exception IRQ3 directly. Register reti other than retx in pt_regs is the kgdb return address. So, don't put PC in gdb_regs into retx. Sonic Zhang Index: arch/blackfin/kernel/kgdb.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D --- arch/blackfin/kernel/kgdb.c (revision 8105) +++ arch/blackfin/kernel/kgdb.c (revision 8106) @@ -147,7 +147,7 @@ regs->lb1 =3D gdb_regs[BFIN_LB1]; regs->usp =3D gdb_regs[BFIN_USP]; regs->syscfg =3D gdb_regs[BFIN_SYSCFG]; - regs->retx =3D gdb_regs[BFIN_PC]; + regs->retx =3D gdb_regs[BFIN_RETX]; regs->retn =3D gdb_regs[BFIN_RETN]; regs->rete =3D gdb_regs[BFIN_RETE]; regs->pc =3D gdb_regs[BFIN_PC]; On Mon, Dec 28, 2009 at 6:17 PM, Zhang, Sonic <[email protected]> = wrote: > 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.= So, BFIN_PC is actually retx when do kernel debugging. > > > Sonic > > > --- trunk/arch/blackfin/kernel/kgdb.c =A0 2009-12-28 09:27:27 UTC (re= v 8085) > +++ trunk/arch/blackfin/kernel/kgdb.c =A0 2009-12-28 10:08:30 UTC (re= v 8086) > @@ -79,7 +79,7 @@ > =A0 =A0 =A0 =A0gdb_regs[BFIN_RETX] =3D regs->retx; > =A0 =A0 =A0 =A0gdb_regs[BFIN_RETN] =3D regs->retn; > =A0 =A0 =A0 =A0gdb_regs[BFIN_RETE] =3D regs->rete; > - =A0 =A0 =A0 gdb_regs[BFIN_PC] =3D regs->pc; > + =A0 =A0 =A0 gdb_regs[BFIN_PC] =3D regs->retx; > =A0 =A0 =A0 =A0gdb_regs[BFIN_CC] =3D 0; > =A0 =A0 =A0 =A0gdb_regs[BFIN_EXTRA1] =3D 0; > =A0 =A0 =A0 =A0gdb_regs[BFIN_EXTRA2] =3D 0; > @@ -150,7 +150,7 @@ > =A0 =A0 =A0 =A0regs->retx =3D gdb_regs[BFIN_PC]; > =A0 =A0 =A0 =A0regs->retn =3D gdb_regs[BFIN_RETN]; > =A0 =A0 =A0 =A0regs->rete =3D gdb_regs[BFIN_RETE]; > - =A0 =A0 =A0 regs->pc =3D gdb_regs[BFIN_PC]; > + =A0 =A0 =A0 regs->pc =3D gdb_regs[BFIN_RETI]; > > =A0#if 0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* can't = change these */ > =A0 =A0 =A0 =A0regs->astat =3D gdb_regs[BFIN_ASTAT]; > > > > > -----Original Message----- > From: Mike Frysinger [mailto:[email protected]] > Sent: Sunday, December 27, 2009 5:12 AM > To: Jason Wessel > Cc: [email protected]; [email protected]= t; [email protected]; [email protected]; Zhang, Sonic > Subject: Re: [PATCH 09/37] kgdb,blackfin: Add in kgdb_arch_set_pc for= blackfin > > On Wed, Dec 23, 2009 at 16:19, Jason Wessel wrote: >> The new debug core api requires all architectures that use to debug >> 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= =2Ec >> 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 >> addr, char *bundle) >> =A0 =A0 =A0 =A0return bfin_probe_kernel_write((char *)addr, bundle, >> 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. =A0our pc handling seems a little= wonky atm: > > arch/blackfin/kernel/kgdb.c: > void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *reg= s) { ... > =A0 =A0gdb_regs[BFIN_RETI] =3D regs->pc; > =A0 =A0gdb_regs[BFIN_RETX] =3D regs->retx; > =A0 =A0gdb_regs[BFIN_PC] =3D regs->pc; > ... > } > ... > void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *reg= s) { ... > =A0 =A0regs->pc =3D gdb_regs[BFIN_PC]; > =A0 =A0regs->retx =3D gdb_regs[BFIN_PC]; > =A0 =A0/* nothing for BFIN_RETI */ > ... > } > -mike > -- > To unsubscribe from this list: send the line "unsubscribe linux-kerne= l" in > the body of a message to [email protected] > More majordomo info at =A0http://vger.kernel.org/majordomo-info.html > Please read the FAQ at =A0http://www.tux.org/lkml/ >