logo       

Re: kgdb on arm for 2.6: msg#00092

linux.kernel.debugging.kgdb.bugs

Subject: Re: kgdb on arm for 2.6

arm processor doesn't contain hardware support for single step. gdb is aware
of this and uses breakpoints for this purpose. It sends an 's' packet, which
if failed tells gdb that stub doesn't support single stepping. Gdb uses
breakpoints after that.

-Amit

On Wednesday 11 Jan 2006 5:52 am, Tom Rini wrote:
> On Tue, Jan 10, 2006 at 04:01:38PM -0700, Lance Spaulding wrote:
> > George Anzinger wrote:
> > >Lance Spaulding wrote:
> > >>Thanks guys. Breakpoints are working now with these checks compiled
> > >>out. I'd still like to know if single-stepping is supposed to be
> > >>working or not. I added some code to print out the packets sent
> > >>between gdb and kgdb and it looks like gdb sends a 's' packet which
> > >>kgdb ignores and sends back an empty reply. gdb is hung after that.
> > >>Here's a cut-and-paste of the last few packets up to the hang:
> > >>
> > >>outgoing kgdb packet: [f0df2de9]
> > >>incoming kgdb packet: [m834e8,4]
> > >>outgoing kgdb packet: [04b04ce2]
> > >>incoming kgdb packet: [m834ec,4]
> > >>outgoing kgdb packet: [54d04de2]
> > >>incoming kgdb packet: [m834f0,4]
> > >>outgoing kgdb packet: [34000be5]
> > >>incoming kgdb packet: [m834f4,4]
> > >>outgoing kgdb packet: [38100be5]
> > >>incoming kgdb packet: [m834f8,4]
> > >>outgoing kgdb packet: [3c200be5]
> > >>incoming kgdb packet: [Hc1]
> > >>outgoing kgdb packet: [OK]
> > >>incoming kgdb packet: [s]
> > >>outgoing kgdb packet: []
> > >>
> > >>Should this work? In looking at the code, it appears that 's' isn't
> > >>supported but I assume others are single-stepping so what am I
> > >>missing? Do I need a specific version of gdb for this to work?
> > >>
> > >> case 's':
> > >>
> > >> if (kgdb_contthread && kgdb_contthread != current) {
> > >> /* Can't switch threads in kgdb */
> > >> error_packet(remcom_out_buffer, -EINVAL);
> > >> break;
> > >> }
> > >>
> > >> /* Followthrough to default processing */
> > >> default:
> > >
> > >You stopped a few lines short. I suspect that the default is to hand
> > >it off to the arch part of kgdb to do the actual step code. Once the
> > >"s" is sent, gdb expects the next reply to be notice of an exception,
> > >i.e. a breakpoint, single step completion, what ever.
> > >
> > >For what its worth, you can get these packets from the gdb side by
> > > doing: set debug remote 1
> > >
> > >(a lot easier than puting in printks...)
> > >
> > >George
> >
> > Sorry about that. I meant to include the rest but somehow forgot. The
> > 'default' section calls kgdb_arch_handle_exception() which doesn't
> > appear to handle the 's' command as shown below:
> >
> > int kgdb_arch_handle_exception(int exception_vector, int signo,
> > int err_code, char *remcom_in_buffer,
> > char *remcom_out_buffer,
> > struct pt_regs *linux_regs)
> > {
> > long addr;
> > char *ptr;
> >
> > switch (remcom_in_buffer[0]) {
> > case 'c':
> > kgdb_contthread = NULL;
> >
> > /*
> > * Try to read optional parameter, pc unchanged if no parm.
> > * If this was a compiled breakpoint, we need to move
> > * to the next instruction or we will just breakpoint
> > * over and over again.
> > */
> > ptr = &remcom_in_buffer[1];
> > if (kgdb_hex2long(&ptr, &addr)) {
> > linux_regs->ARM_pc = addr;
> > } else if (compiled_break == 1) {
> > linux_regs->ARM_pc += 4;
> > }
> > compiled_break = 0;
> >
> > return 0;
> > }
> >
> > return -1;
> > }
> >
> > Is single-stepping supposed to work on ARM platforms in the current
> > version of kgdb?
>
> I believe there's certain 'issues' with single-step on MMUfull ARM.
> Deepak, can you expand on this please (Lance is working on an MMU-less
> ARM board and trying to bring up KGDB) ?


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise