* Debugging using GDB and gdbserver @ 2002-06-15 20:01 Justin Wojdacki 2002-06-15 20:14 ` Daniel Jacobowitz 0 siblings, 1 reply; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 20:01 UTC (permalink / raw) To: linux-mips How does GDB work under MIPS Linux? I'm trying to do a bring-up of an embedded device, and it looks like the kernel is missing the code needed to handle software breakpoints. Are there patches that need to be applied to the kernel? -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 20:01 Debugging using GDB and gdbserver Justin Wojdacki @ 2002-06-15 20:14 ` Daniel Jacobowitz 2002-06-15 20:29 ` Justin Wojdacki 0 siblings, 1 reply; 10+ messages in thread From: Daniel Jacobowitz @ 2002-06-15 20:14 UTC (permalink / raw) To: Justin Wojdacki; +Cc: linux-mips On Sat, Jun 15, 2002 at 01:01:24PM -0700, Justin Wojdacki wrote: > > How does GDB work under MIPS Linux? I'm trying to do a bring-up of an > embedded device, and it looks like the kernel is missing the code > needed to handle software breakpoints. Are there patches that need to > be applied to the kernel? No. If you use a current GDB (I recommend 5.2 or CVS) it should work just fine, if you are using a recent kernel (you didn't mention what version you were looking at). -- Daniel Jacobowitz Debian GNU/Linux Developer MontaVista Software Carnegie Mellon University ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 20:14 ` Daniel Jacobowitz @ 2002-06-15 20:29 ` Justin Wojdacki 2002-06-15 20:38 ` Daniel Jacobowitz 0 siblings, 1 reply; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 20:29 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: linux-mips Daniel Jacobowitz wrote: > > On Sat, Jun 15, 2002 at 01:01:24PM -0700, Justin Wojdacki wrote: > > > > How does GDB work under MIPS Linux? I'm trying to do a bring-up of an > > embedded device, and it looks like the kernel is missing the code > > needed to handle software breakpoints. Are there patches that need to > > be applied to the kernel? > > No. If you use a current GDB (I recommend 5.2 or CVS) it should work > just fine, if you are using a recent kernel (you didn't mention what > version you were looking at). > > -- > Daniel Jacobowitz Debian GNU/Linux Developer > MontaVista Software Carnegie Mellon University Sorry, I'm using the 2.4.10 kernel and GDB 5.2. What I see happening is the BREAK 5 instruction from a software breakpoint is hit, and the kernel loops continuously on that, as it appears to have no way to deal with that exception. I'm running gdbserver on the MIPS target and gdb as a cross-debugger on an x86 host (RedHat 7.1). To me, it looks like when the debugging breakpoint is hit, gdbserver should get scheduled to run and handle the breakpoint, but instead the child keep's getting scheduled. -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 20:29 ` Justin Wojdacki @ 2002-06-15 20:38 ` Daniel Jacobowitz 2002-06-15 20:45 ` Justin Wojdacki 2002-06-15 22:16 ` Justin Wojdacki 0 siblings, 2 replies; 10+ messages in thread From: Daniel Jacobowitz @ 2002-06-15 20:38 UTC (permalink / raw) To: Justin Wojdacki; +Cc: linux-mips On Sat, Jun 15, 2002 at 01:29:56PM -0700, Justin Wojdacki wrote: > Daniel Jacobowitz wrote: > > > > On Sat, Jun 15, 2002 at 01:01:24PM -0700, Justin Wojdacki wrote: > > > > > > How does GDB work under MIPS Linux? I'm trying to do a bring-up of an > > > embedded device, and it looks like the kernel is missing the code > > > needed to handle software breakpoints. Are there patches that need to > > > be applied to the kernel? > > > > No. If you use a current GDB (I recommend 5.2 or CVS) it should work > > just fine, if you are using a recent kernel (you didn't mention what > > version you were looking at). > > > > -- > > Daniel Jacobowitz Debian GNU/Linux Developer > > MontaVista Software Carnegie Mellon University > > Sorry, I'm using the 2.4.10 kernel and GDB 5.2. What I see happening > is the BREAK 5 instruction from a software breakpoint is hit, and the > kernel loops continuously on that, as it appears to have no way to > deal with that exception. I'm running gdbserver on the MIPS target and > gdb as a cross-debugger on an x86 host (RedHat 7.1). To me, it looks > like when the debugging breakpoint is hit, gdbserver should get > scheduled to run and handle the breakpoint, but instead the child > keep's getting scheduled. Software breakpoints have worked at least as far back as 2.4.2. This most likely means that the exception handling for your board is broken. -- Daniel Jacobowitz Debian GNU/Linux Developer MontaVista Software Carnegie Mellon University ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 20:38 ` Daniel Jacobowitz @ 2002-06-15 20:45 ` Justin Wojdacki 2002-06-15 22:16 ` Justin Wojdacki 1 sibling, 0 replies; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 20:45 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: linux-mips Daniel Jacobowitz wrote: > > Software breakpoints have worked at least as far back as 2.4.2. This > most likely means that the exception handling for your board is broken. > > -- > Daniel Jacobowitz Debian GNU/Linux Developer > MontaVista Software Carnegie Mellon University What exception handling is the board expected to provide? -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 20:38 ` Daniel Jacobowitz 2002-06-15 20:45 ` Justin Wojdacki @ 2002-06-15 22:16 ` Justin Wojdacki 2002-06-15 22:26 ` Daniel Jacobowitz 1 sibling, 1 reply; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 22:16 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: linux-mips Daniel Jacobowitz wrote: > > Software breakpoints have worked at least as far back as 2.4.2. This > most likely means that the exception handling for your board is broken. > Sorry, originally misinterpretted your use of "board" as referring to the board itself, and perhaps PMON (I've found a number of references online to GDB talking to PMON, but not much else). So what I've found by looking at other board-specific code revolves around GDB talking to an in-kernel stub via the serial port. As the board I'm working with has an unreliable serial port (and some incarnations don't even have that), what about ethernet-based debugging? Is that do-able, say via putDebugChar() (although I suspect this poses an initialization problem)? Thanks for the info so far. -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 22:16 ` Justin Wojdacki @ 2002-06-15 22:26 ` Daniel Jacobowitz 2002-06-15 22:40 ` Justin Wojdacki 0 siblings, 1 reply; 10+ messages in thread From: Daniel Jacobowitz @ 2002-06-15 22:26 UTC (permalink / raw) To: Justin Wojdacki; +Cc: linux-mips On Sat, Jun 15, 2002 at 03:16:05PM -0700, Justin Wojdacki wrote: > Daniel Jacobowitz wrote: > > > > Software breakpoints have worked at least as far back as 2.4.2. This > > most likely means that the exception handling for your board is broken. > > > > Sorry, originally misinterpretted your use of "board" as referring to > the board itself, and perhaps PMON (I've found a number of references > online to GDB talking to PMON, but not much else). > > So what I've found by looking at other board-specific code revolves > around GDB talking to an in-kernel stub via the serial port. As the > board I'm working with has an unreliable serial port (and some > incarnations don't even have that), what about ethernet-based > debugging? Is that do-able, say via putDebugChar() (although I suspect > this poses an initialization problem)? > > Thanks for the info so far. Wait, wait. What are you trying to do? Originally you were talking about userspace debugging via gdbserver. Now you're talking about kernel debugging via kgdb. They're separate (and coexisting can cause problems if you are not careful with your exception handlers; I do not remember when my patches to make that work went into the tree, or if someone else did it). gdbserver can just use TCP. -- Daniel Jacobowitz Debian GNU/Linux Developer MontaVista Software Carnegie Mellon University ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 22:26 ` Daniel Jacobowitz @ 2002-06-15 22:40 ` Justin Wojdacki 2002-06-15 23:03 ` Daniel Jacobowitz 0 siblings, 1 reply; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 22:40 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: linux-mips Daniel Jacobowitz wrote: > > Wait, wait. What are you trying to do? Originally you were talking > about userspace debugging via gdbserver. Now you're talking about > kernel debugging via kgdb. They're separate (and coexisting can cause > problems if you are not careful with your exception handlers; I do not > remember when my patches to make that work went into the tree, or if > someone else did it). > > gdbserver can just use TCP. > > -- > Daniel Jacobowitz Debian GNU/Linux Developer > MontaVista Software Carnegie Mellon University Sorry for the confusion. I've been discussing userspace debugging via gdbserver the entire time. However, I've noticed that gdbserver doesn't seem to be fully functional because the kernel doesn't seem to be handling the "BREAK 5" instruction correctly. You mentioned problems with board exception handling and I looked at the ddb series board support code. In there, I found handling for software breakpoints, and got the impression from the code that it was a general debugging interface, not just for kernel debugging. Again, sorry for the confusion. As it stands right now, when I get hit a "BREAK 5" instruction, gdbserver never get's a chance to handle it, as the kernel keeps scheduling the child process I'm trying to debug, and hitting the "BREAK 5" instruction over and over again. What I can't seem to find out is how gdbserver is supposed to get scheduled again. -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 22:40 ` Justin Wojdacki @ 2002-06-15 23:03 ` Daniel Jacobowitz 2002-06-15 23:05 ` Justin Wojdacki 0 siblings, 1 reply; 10+ messages in thread From: Daniel Jacobowitz @ 2002-06-15 23:03 UTC (permalink / raw) To: Justin Wojdacki; +Cc: linux-mips On Sat, Jun 15, 2002 at 03:40:08PM -0700, Justin Wojdacki wrote: > Daniel Jacobowitz wrote: > > > > Wait, wait. What are you trying to do? Originally you were talking > > about userspace debugging via gdbserver. Now you're talking about > > kernel debugging via kgdb. They're separate (and coexisting can cause > > problems if you are not careful with your exception handlers; I do not > > remember when my patches to make that work went into the tree, or if > > someone else did it). > > > > gdbserver can just use TCP. > > > > -- > > Daniel Jacobowitz Debian GNU/Linux Developer > > MontaVista Software Carnegie Mellon University > > Sorry for the confusion. I've been discussing userspace debugging via > gdbserver the entire time. However, I've noticed that gdbserver > doesn't seem to be fully functional because the kernel doesn't seem to > be handling the "BREAK 5" instruction correctly. You mentioned > problems with board exception handling and I looked at the ddb series > board support code. In there, I found handling for software > breakpoints, and got the impression from the code that it was a > general debugging interface, not just for kernel debugging. Again, > sorry for the confusion. > > As it stands right now, when I get hit a "BREAK 5" instruction, > gdbserver never get's a chance to handle it, as the kernel keeps > scheduling the child process I'm trying to debug, and hitting the > "BREAK 5" instruction over and over again. What I can't seem to find > out is how gdbserver is supposed to get scheduled again. What should happen is that the child receives a signal (SIGTRAP) after the exception. Then it is scheduled again, drops into do_signal, and the kernel notices that the traced bit is set and wakes the tracer. I'd guess your board needs to do something different to deliver the SIGTRAP properly, if that isn't happening. -- Daniel Jacobowitz Debian GNU/Linux Developer MontaVista Software Carnegie Mellon University ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Debugging using GDB and gdbserver 2002-06-15 23:03 ` Daniel Jacobowitz @ 2002-06-15 23:05 ` Justin Wojdacki 0 siblings, 0 replies; 10+ messages in thread From: Justin Wojdacki @ 2002-06-15 23:05 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: linux-mips Daniel Jacobowitz wrote: > > What should happen is that the child receives a signal (SIGTRAP) after > the exception. Then it is scheduled again, drops into do_signal, and > the kernel notices that the traced bit is set and wakes the tracer. I'd > guess your board needs to do something different to deliver the SIGTRAP > properly, if that isn't happening. > > -- > Daniel Jacobowitz Debian GNU/Linux Developer > MontaVista Software Carnegie Mellon University Okay, thanks for the clarification. :) -- ------------------------------------------------- Justin Wojdacki justin.wojdacki@analog.com (408) 350-5032 Communications Processors Group -- Analog Devices ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-06-15 23:03 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-06-15 20:01 Debugging using GDB and gdbserver Justin Wojdacki 2002-06-15 20:14 ` Daniel Jacobowitz 2002-06-15 20:29 ` Justin Wojdacki 2002-06-15 20:38 ` Daniel Jacobowitz 2002-06-15 20:45 ` Justin Wojdacki 2002-06-15 22:16 ` Justin Wojdacki 2002-06-15 22:26 ` Daniel Jacobowitz 2002-06-15 22:40 ` Justin Wojdacki 2002-06-15 23:03 ` Daniel Jacobowitz 2002-06-15 23:05 ` Justin Wojdacki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox