From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29965 invoked by alias); 7 May 2013 04:43:28 -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 29933 invoked by uid 89); 7 May 2013 04:43:22 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-vc0-f170.google.com (HELO mail-vc0-f170.google.com) (209.85.220.170) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 04:43:21 +0000 Received: by mail-vc0-f170.google.com with SMTP id gf12so125098vcb.1 for ; Mon, 06 May 2013 21:43:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding :x-gm-message-state; bh=hOBnyIoEOIvevxg9RSlIMcM5V0iZqkiHdTblvp+akgI=; b=jCWuG2JqQdycb5GJw1f9aiTCbvNwTaBW0kY+W4+MqD0Agk3CyW8sBhLBI38ruo88ow /Vl++DEoGc2eGKFxQ/nurD6bGKNhn96yQ5B+1wLD3kg+HwdARwUYArHSYDJG5d61QYS/ 323rPro6o99ZnkC7LbdAQo2UcZ4JP1Sqd3Pw9CoTuCAfjlZrBW9BDRrWZpGaGD05i3EC e6MRBdzIqb4FULGZEUy/+UY5Hi8zGTCBpEkycZvFPnYGXtZ+yqPQgdShL68bSInZ/FCr NgW3119RiFonO5e271kQbWuU6RcnLloIBq2ks8Mf3dPnF2FmoabGCVSMbGrjqi36pJ7D emCA== MIME-Version: 1.0 X-Received: by 10.52.24.113 with SMTP id t17mr186912vdf.30.1367901799675; Mon, 06 May 2013 21:43:19 -0700 (PDT) Received: by 10.220.173.7 with HTTP; Mon, 6 May 2013 21:43:19 -0700 (PDT) In-Reply-To: References: Date: Tue, 07 May 2013 04:43:00 -0000 Message-ID: Subject: Re: Timer From: Doug Evans To: =?ISO-8859-1?Q?Marc_Br=FCnink?= Cc: gdb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkQQlpFI3ZZkMrKmPZOE8SwxCNylC8WY7mhbozecoH9A0nCXY75kjAt5gt3xDeiXg3hotJd7t2xmXRmS2aKE3Vj5+cp3LUH36x8m1Ws/xw1qyj4pVC1IAWd2aZddHXZKnsaOexsxcYq7qKO/8SZXXzPm1TzmkCcgTX1sJ+FYJxEy7J97QqSCBd/XI3l9JuZFlU6qHti X-SW-Source: 2013-05/txt/msg00029.txt.bz2 On Mon, May 6, 2013 at 2:52 AM, Marc Br=FCnink wrote: > I want to execute a piece of code at regular intervals. Actually I'm samp= ling $pc. > (let's not go into detail why I use gdb) > > My current solution just starts another process that sends a SIGTRAP to t= he debugged application. Using a simple script I can print the $pc. > > However, I just realised that this approach does not work too well. If gd= b is stopped due to a breakpoint it will interpret the received SIGTRAP as = another hit of the very same breakpoint. > > Reproduce: > 1. Attach to any program > 2. Create any breakpoint > 3. Wait until breakpoint is hit > 4. Send SIGTRAP to debugged application > 5. continue > > Actually, now that I think about it, I should have anticipated this behav= iour. > Is there a better way to execute a piece of code at regular intervals? bash$ man setitimer ?