From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13118 invoked by alias); 21 Jan 2009 16:05:35 -0000 Received: (qmail 13109 invoked by uid 22791); 21 Jan 2009 16:05:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.184) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Jan 2009 16:05:30 +0000 Received: by ti-out-0910.google.com with SMTP id d10so2980080tib.12 for ; Wed, 21 Jan 2009 08:05:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.110.49.6 with SMTP id w6mr12001990tiw.39.1232553927726; Wed, 21 Jan 2009 08:05:27 -0800 (PST) In-Reply-To: References: Date: Wed, 21 Jan 2009 16:05:00 -0000 Message-ID: Subject: Re: single-step SIGALRM issue From: teawater To: Laszlo Benedek Cc: gdb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2009-01/txt/msg00144.txt.bz2 This is because GDB think SIGALRM is a random signal. Maybe command "handle SIGALRM stop print nopass" can deal with it. On Wed, Jan 21, 2009 at 16:22, Laszlo Benedek wrote: > No, we don't use RSP, we simply start our program with gdb. Did you > mean that by linking together? > I know why the SIGALRM signals come, my original question was why gdb > fails to single step our program when the SIGALRM signals come instead > of the SIGTRAP. > > Best regards, > Laszlo Benedek > > On Wed, Jan 21, 2009 at 8:31 AM, teawater wrote: >> How do your simulator work with GDB? Link together or connect with RSP? >> >> I think maybe "It uses the SIGALRM signal to simulate interrupts." >> this is the reason you got SIGALRM. >> >> On Wed, Jan 21, 2009 at 15:16, Laszlo Benedek wrote: >>> I am afraid I don't understand your question. What do you mean by >>> returning a SIGTRAP? >>> GDB receives the signals from the OS, not my program sends them. >>> >>> On Wed, Jan 21, 2009 at 7:17 AM, teawater wrote: >>>> "it is expecting a SIGTRAP signal but sometimes it receives a SIGALRM >>>> instead." >>>> >>>> Why you can't aways return SIGTRAP? >>>> >>>> On Tue, Jan 20, 2009 at 01:50, Laszlo Benedek wrote: >>>>> Hi, >>>>> >>>>> I am part of a team developing a simulator and we have problems >>>>> debugging the simulator with gdb. >>>>> The simulator is an application written for x86-linux and it was >>>>> written in c/c++. >>>>> It uses the SIGALRM signal to simulate interrupts. >>>>> >>>>> The test that fails: >>>>> I start the simulator in gdb and insert a breakpoint at a certain function call. >>>>> When the program reaches the breakpoint it correctly stops, then I try >>>>> to use single stepping. >>>>> At this point something wierd happens, sometimes it works fine and I >>>>> can use the step command >>>>> but sometimes the program starts to run and then hangs. >>>>> >>>>> I tried to find the reason of this and here is what I've found. When >>>>> gdb starts single stepping >>>>> it is expecting a SIGTRAP signal but sometimes it receives a SIGALRM >>>>> instead. In this case it >>>>> decides to switch the inferior in 'continue' mode, inserts a >>>>> breakpoint and waits. In this case our >>>>> program continues to run from the original breakpoint and eventually >>>>> it reaches a point where it calls sigsuspend >>>>> and it waits for signals but it does not receive any signals anymore. >>>>> It seems that gdb is blocking them somehow >>>>> when this single-step => continue switch happens. I read the comment >>>>> in the gdb source and it says that gdb expects >>>>> that the program's signal handler will be called and it will stop at >>>>> the return of the signal handler because gdb just >>>>> inserted a breakpoint there. For some reason the signal handler of our >>>>> program is not called at all after it gets into this 'continue' mode. >>>>> >>>>> I'd like to fix this or at least decide if this is an error in gdb or >>>>> in the simulator (or both?), but I don't really know how to continue. >>>>> Has anyone experienced anything like this before ? >>>>> Any comment, idea would be appreciated. >>>>> >>>>> Thanks for your help in advance! >>>>> >>>>> Best regards, >>>>> Laszlo Benedek >>>>> >>>> >>> >> >