From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23436 invoked by alias); 8 Feb 2015 14:49:12 -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 23425 invoked by uid 89); 8 Feb 2015 14:49:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f176.google.com Received: from mail-qc0-f176.google.com (HELO mail-qc0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 08 Feb 2015 14:49:10 +0000 Received: by mail-qc0-f176.google.com with SMTP id c9so19053572qcz.7 for ; Sun, 08 Feb 2015 06:49:08 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.140.106.72 with SMTP id d66mr24239711qgf.60.1423406948830; Sun, 08 Feb 2015 06:49:08 -0800 (PST) Received: by 10.96.146.234 with HTTP; Sun, 8 Feb 2015 06:49:08 -0800 (PST) In-Reply-To: References: Date: Sun, 08 Feb 2015 14:49:00 -0000 Message-ID: Subject: Re: how to create and hardware watchpoint from a commands list. From: Julien Chavanton To: Doug Evans , gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00015.txt.bz2 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 ------------------------------- 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