This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Spurious SIGTRAP reported by GDB 6.8 when debugging embedded RTOS application


Antony KING wrote:

> you can see that GDB is reporting a "SIGTRAP" message after switching
> threads from "Thread 3" (the active thread) to "Thread 7" and then
> performing the step. GDB is expecting that on completion of the step the
> stopped thread reported by the target will be same as was selected by
> GDB before the step (e.g. "Thread 7"). This will not generally happen
> with our RTOS since it is not possible to change the currently running
> thread (as exhibited above).

Here's my understanding of this issue:  GDB does not actually care about
the "currently running" thread -- this is up the OS scheduler which GDB
cannot and does not attempt to influence.

GDB does cares about the following two properties of threads:

- Which threads are *runnable* (i.e. not stopped)

  GDB may -depending on the situation- want to tell the target to mark
  all threads runnable, no thread runnable, or just a single thread
  runnable.  (If it marks all threads runnable, it is of course up to
  the OS which threads it schedules in which order to actually *run*
  on any of the physical processors.)

- Which thread to run in hardware single-step mode

  On targets that support hardware single-step, GDB will want to decide
  *which* of the threads the single-step mode should be applied to.
  (GDB will only ever mark one thread for single-stepping.)


It seems that you're running into problems with the second point:
GDB has asked the target to hardware single-step thread 7, but your OS
actually enabled hardware single-stepping for thread 3.

If possible, you should fix this in your target implementation.  If
this is not possible for your RTOS, one simple way to solve the issue
might be to tell the GDB core that your target does not support hardware
single-stepping.  Then, GDB will fall back to software single-stepping,
where it cares for stepping the correct thread by itself.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]