From: Antony KING <antony.king@st.com>
To: gdb@sourceware.org
Subject: Spurious SIGTRAP reported by GDB 6.8 when debugging embedded RTOS application
Date: Sat, 16 Aug 2008 15:12:00 -0000 [thread overview]
Message-ID: <48A5E69D.9050901@st.com> (raw)
Hi,
I have just upgraded our variant of GDB to version 6.8 (from 6.7.1) and
have noticed a new behaviour which I would like to "fix". Using the
following debug session snapshot:
> (gdb) tbreak mytaskfunc
> Breakpoint 1 at <location>
> (gdb) continue
> Hello from root; before task_create
> Hello from root; after task_create
> [New Thread 3]
> [Switching to Thread 3]
> mytaskfunc (p=0x0) at test.c:40
> 40 int i = (int)p;
> (gdb) info thread
> [New Thread 1]
> [New Thread 2]
> [New Thread 4]
> [New Thread 5]
> [New Thread 6]
> [New Thread 7]
> 7 Thread 7 ("My Task") <location>
> 6 Thread 6 ("My Task") <location>
> 5 Thread 5 ("My Task") <location>
> 4 Thread 4 ("My Task") <location>
> 3 Thread 2 ("Idle Task") <location>
> 2 Thread 1 ("Root Task") <location>
> * 1 Thread 3 ("My Task") <location>
> (gdb) thread 7
> [Switching to thread 7 (Thread 7)]#0 <location>
> 1690 {
> (gdb) step
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> [Switching to Thread 3]
> 0x880017a4 in mytaskfunc (p=0x0) at /vob/shbri-src-testsuites/regression-tests/gdb/INSbl23029.c:40
> 40 int i = (int)p;
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).
This report of "SIGTRAP" by GDB (and also the premature termination of
the step) is not desirable as this tends to agitate our users :-). Is
there a way I can modify our implementation of the target interface in
GDB that will prevent this from occurring ?
After examining the sources it looks like this situation is caused by
the call to context_switch() (in infrun.c), which is resetting the
global flag step_range_end (among others) and this is consequentially
preventing handle_inferior_event() from recognising that a step is in
progress. Is there a way avoiding this ? Alternative is it possible to
undo the effect of the "thread 7" command so that GDB has the correct
"current thread" context when resuming the target ?
Cheers,
Antony.
[Note that our version of GDB is used to support the debugging of
embedded SH-4 applications using our own RTOS with our own host/target
interface hardware.]
next reply other threads:[~2008-08-15 20:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 15:12 Antony KING [this message]
2008-08-16 15:33 ` Ulrich Weigand
2008-08-18 18:16 ` Antony KING
2008-08-18 18:30 ` Daniel Jacobowitz
2008-08-18 18:36 ` Pedro Alves
2008-08-20 1:31 ` Antony KING
2008-08-18 18:47 ` Antony KING
2008-08-19 0:33 ` Ulrich Weigand
2008-08-20 14:30 ` Antony KING
2008-08-20 14:37 ` Pedro Alves
2008-08-21 3:24 ` Antony KING
2008-08-22 14:58 ` Ulrich Weigand
2008-08-27 21:38 ` Antony KING
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48A5E69D.9050901@st.com \
--to=antony.king@st.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox