From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6005 invoked by alias); 7 May 2013 10:18:24 -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 5993 invoked by uid 89); 7 May 2013 10:18:23 -0000 X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from smtp-out.nus.edu.sg (HELO imsva05.stf.nus.edu.sg) (137.132.14.13) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 10:18:22 +0000 Received: from imsva05.stf.nus.edu.sg (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F1C131006B for ; Tue, 7 May 2013 18:17:18 +0800 (SGT) Received: from smtp.nus.edu.sg (unknown [137.132.21.156]) by imsva05.stf.nus.edu.sg (Postfix) with ESMTP id CE8A010054 for ; Tue, 7 May 2013 18:17:18 +0800 (SGT) Received: from r-0-189-28-172.comp.nus.edu.sg ([172.28.189.0]) by smtp.nus.edu.sg over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 7 May 2013 18:18:18 +0800 Subject: Re: Timer Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: =?iso-8859-1?Q?Marc_Br=FCnink?= In-Reply-To: <5188BFC1.8090607@redhat.com> Date: Tue, 07 May 2013 10:18:00 -0000 Cc: Doug Evans , gdb Content-Transfer-Encoding: quoted-printable Message-Id: References: <52771B43-9617-412D-B9F8-5730757D6BAF@nus.edu.sg> <5188BFC1.8090607@redhat.com> To: Pedro Alves X-TM-AS-MML: No X-TMASE-Version: IMSVA-8.2.0.1679-7.0.1014-19848.005 X-TMASE-Result: 10--19.041100-5.000000 X-TMASE-MatchedRID: 10+ctCQpgSyDCdFIVzIzHdG8PmAR6RZOZCSBV6VCLjXx5KZMlKYS/VwK y6arPaSXyWCL+8tLbva/F+81OFeimlu6Z1oEHTPNwXXPTgEJfnvcx97ZZVZcMpRrnSy7UTtbFKl iqHKCaOnjsTquy0JRixIa2MQc6yOtzOS6Q+iV9UR/rSsXF5ra0UCm6s5f/83NYbs1SIHwCEqhSP 4ToSnton+0T1ghSvBizlGIBoceZ+ZLhzplgX2qrRwbLr57pI0SVJTV35UngiOQ+gWwzffozsnlJ e2gk8vIwDXS5PAVpG4ue4Vh9pZKpuFYM+IjwPfzjaPj0W1qn0SQZS2ujCtcuA== X-SW-Source: 2013-05/txt/msg00035.txt.bz2 On May 7, 2013, at 4:48 PM, Pedro Alves wrote: > On 05/07/2013 07:42 AM, Marc Br=FCnink wrote: >>=20 >> On May 7, 2013, at 12:43 PM, Doug Evans wrote: >>=20 >>> 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 s= ampling $pc. >>>> (let's not go into detail why I use gdb) >>>>=20 >>>> My current solution just starts another process that sends a SIGTRAP t= o the debugged application. Using a simple script I can print the $pc. >>>>=20 >>>> However, I just realised that this approach does not work too well. If= gdb is stopped due to a breakpoint it will interpret the received SIGTRAP = as another hit of the very same breakpoint. >>>>=20 >>>> Reproduce: >>>> 1. Attach to any program >>>> 2. Create any breakpoint >>>> 3. Wait until breakpoint is hit >>>> 4. Send SIGTRAP to debugged application >>>> 5. continue >>>>=20 >>>> Actually, now that I think about it, I should have anticipated this be= haviour. >>>> Is there a better way to execute a piece of code at regular intervals? >=20 > 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. >=20 >>> bash$ man setitimer >>=20 >> I suppose you are suggesting to modify either GDB or the application. Th= is is exactly what I don't want. Any other way to accomplish this (using gd= b)? >=20 > You could use LD_PRELOAD to inject a library that uses setitimer into you= r program. Possible, but contradicts the gdb-only approach.=20 > 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 sigsu= pend 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. Marc >From gdb-return-42109-listarch-gdb=sources.redhat.com@sourceware.org Tue May 07 10:19:00 2013 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 7725 invoked by alias); 7 May 2013 10:19:00 -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 Delivered-To: mailing list gdb@sourceware.org Received: (qmail 7714 invoked by uid 89); 7 May 2013 10:18:59 -0000 X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS,TW_NX autolearn=ham version=3.3.1 Received: from mail-da0-f43.google.com (HELO mail-da0-f43.google.com) (209.85.210.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 10:18:58 +0000 Received: by mail-da0-f43.google.com with SMTP id u7so253039dae.30 for ; Tue, 07 May 2013 03:18:57 -0700 (PDT) X-Received: by 10.66.8.69 with SMTP id p5mr1910944paa.57.1367917970512; Tue, 07 May 2013 02:12:50 -0700 (PDT) Received: from [192.168.0.104] ([112.233.222.117]) by mx.google.com with ESMTPSA id aa8sm29572136pad.14.2013.05.07.02.12.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 02:12:48 -0700 (PDT) Message-ID: <5188C586.6010201@gmail.com> Date: Tue, 07 May 2013 10:19:00 -0000 From: xunxun User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: John Martin CC: gdb@sourceware.org Subject: Re: Doubt with gdb References: <5188C0F5.2010306@larraioz.com> <5188C241.9000209@larraioz.com> <5188C2D9.2020503@gmail.com> <5188C421.3060102@larraioz.com> In-Reply-To: <5188C421.3060102@larraioz.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-05/txt/msg00036.txt.bz2 Content-length: 674 于 2013/5/7 星期二 17:06, John Martin 写道: > Hello, > > And, is it possible to extract only variables of a function? > > info variables return me all variables of program. > > info variables "function" ???? > > > El 07/05/13 11:01, xunxun escribió: >> 于 2013/5/7 星期二 16:58, John Martin 写道: >>> Hello, >>> is there any way to tell GDB that return all static variables of a >>> function? >>> best regards. >>> >>> >> |info variables | >> || >> >> -- >> Best Regards, >> xunxun > Maybe you need the local variables? info local > > -- -- Best Regards, xunxun