From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5007 invoked by alias); 15 Aug 2008 23:28:22 -0000 Received: (qmail 30503 invoked by uid 22791); 15 Aug 2008 23:16:49 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Aug 2008 23:16:06 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7FNFfaX464036 for ; Fri, 15 Aug 2008 23:15:41 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7FNFfZH221356 for ; Sat, 16 Aug 2008 01:15:41 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7FNFekl025881 for ; Sat, 16 Aug 2008 01:15:40 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id m7FNFeMU025871; Sat, 16 Aug 2008 01:15:40 +0200 Message-Id: <200808152315.m7FNFeMU025871@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sat, 16 Aug 2008 01:15:40 +0200 Subject: Re: Spurious SIGTRAP reported by GDB 6.8 when debugging embedded RTOS application To: antony.king@st.com (Antony KING) Date: Sat, 16 Aug 2008 15:33:00 -0000 From: "Ulrich Weigand" Cc: gdb@sourceware.org In-Reply-To: <48A5E69D.9050901@st.com> from "Antony KING" at Aug 15, 2008 09:27:09 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00196.txt.bz2 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