From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10231 invoked by alias); 8 Feb 2015 21:47:38 -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 10221 invoked by uid 89); 8 Feb 2015 21:47:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f170.google.com Received: from mail-we0-f170.google.com (HELO mail-we0-f170.google.com) (74.125.82.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 08 Feb 2015 21:47:36 +0000 Received: by mail-we0-f170.google.com with SMTP id q59so14558501wes.1 for ; Sun, 08 Feb 2015 13:47:33 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.73.40 with SMTP id i8mr28395127wiv.4.1423432053243; Sun, 08 Feb 2015 13:47:33 -0800 (PST) Received: by 10.27.20.5 with HTTP; Sun, 8 Feb 2015 13:47:33 -0800 (PST) In-Reply-To: References: Date: Sun, 08 Feb 2015 21:47:00 -0000 Message-ID: Subject: Re: how to create and hardware watchpoint from a commands list. From: Doug Evans To: Julien Chavanton Cc: gdb Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00016.txt.bz2 On Sun, Feb 8, 2015 at 6:49 AM, Julien Chavanton wrote: > Hi Doug, thank you for trying to help, I spent a few hours on this so > I am interested to solve this puzzle for next time. > > ---------------------------- > By doing it manually I mean, > > step-1) I type : > > printf "0x%x\n", &call->stream->session->ext.settings.mode > > and then : > > step-2) I type : > watch *(int *){result from step 1} > > ------------------------------- > This did not work for me : > > watch -location call->stream->session->ext.settings.mode > ------------------------------- Without more details it's hard to help. Can you provide a cut-n-paste of the gdb session that shows the problem? > > I can rerun the session and provide exact output or I could just try > an alternative "piping" the output of step-1 to step-2 from the GDB > "command line interpreter" not sure how it is called, this as to be > executed from a breakpoint command list ? > > > On Sun, Feb 8, 2015 at 5:26 AM, Doug Evans wrote: >> On Wed, Feb 4, 2015 at 2:14 AM, Julien Chavanton wrote: >>> Hi Folks, I would like to create and hardware watchpoint from a commands list. >>> >>> retrieve the addres of a variable and create a watch. >>> >>> watch *(int *) &call->stream->session->ext.settings.mode >>> >>> Manualy this is working fine, but I do not know the right syntax in GDB. >> >> What do you mean by this working manually but then not knowing the right syntax? >> >>> >>> I tried "watch -location call->stream->session->ext.settings.mode" >>> >>> And sereval other things, is there a way to pipe the output of one >>> command to another one ? >> >> You tried several things, but you need to be more specific about >> what problems you had. Complete unedited session logs are useful. >> >> There are various ways to "pipe" (for lack of a better term) the >> output of previous commands into subsequent commands. >> value history, convenience variables and/or eval or python come to mind. >> But do you need to? >> What about "watch -location ..." didn't work? >> >>> >>> watch *(int *) | printf "0x%x\n", &call->stream->session->ext.settings.mode >>> >>> >>> ---------------------------------------------------------- >>> >>> >>> define myhook >>> echo myhook \n >>> next >>> next >>> next >>> print call->stream->session->ext.settings.mode >>> print &call->stream->session->ext.settings.mode >>> printf "watch *(int *)0x%x\n", &call->stream->session->ext.settings.mode >>> end >>> >>> break set_settings >>> commands >>> myhook >>> end