From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12091 invoked by alias); 7 May 2013 10:51:30 -0000 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 Received: (qmail 12036 invoked by uid 89); 7 May 2013 10:51:30 -0000 X-Spam-SWARE-Status: No, score=-8.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 10:51:18 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r47ApBII009616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 May 2013 06:51:11 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r47Ap8Us027910; Tue, 7 May 2013 06:51:09 -0400 Message-ID: <5188DC9C.7080606@redhat.com> Date: Tue, 07 May 2013 10:51:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Marc_Br=FCnink?= CC: Doug Evans , gdb Subject: Re: Timer References: <52771B43-9617-412D-B9F8-5730757D6BAF@nus.edu.sg> <5188BFC1.8090607@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2013-05/txt/msg00037.txt.bz2 On 05/07/2013 11:18 AM, Marc Brünink wrote: >> You could also use another signal instead of SIGTRAP. > > Yes, this is probably the way to go. However, I remember having some issues with different signals. Esp if an applications depends on the delivery of a signal and I use it to implement the timer interrupt. But I suppose using SIGPROF or something similar should be fine. > >> >>>> bash$ man setitimer >>> >>> I suppose you are suggesting to modify either GDB or the application. This is exactly what I don't want. Any other way to accomplish this (using gdb)? >> >> You could use LD_PRELOAD to inject a library that uses setitimer into your program. > > Possible, but contradicts the gdb-only approach. Well, so does the "way to go" above. :-) >> I guess you could do it with gdb python scripting too. > > This would be nice but does not work. As far as I remember there is a sigsupend in linux-nat.c which will thwart using a simple threading.Timer. But I might be wrong here. Whatever the reason, it does not work. GDB's event loop supports timer events. I guess those could be hooked up to python gdb somehow. (you'd need to use "set target-async".) But that'd require changing gdb... -- Pedro Alves