From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3338 invoked by alias); 2 Aug 2010 08:16:47 -0000 Received: (qmail 3327 invoked by uid 22791); 2 Aug 2010 08:16:44 -0000 X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from n3-vm0.bullet.mail.gq1.yahoo.com (HELO n3-vm0.bullet.mail.gq1.yahoo.com) (67.195.23.156) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 02 Aug 2010 08:16:38 +0000 Received: from [67.195.9.83] by n3.bullet.mail.gq1.yahoo.com with NNFMP; 02 Aug 2010 08:16:36 -0000 Received: from [98.137.27.211] by t3.bullet.mail.gq1.yahoo.com with NNFMP; 02 Aug 2010 08:16:36 -0000 Received: from [127.0.0.1] by omp121.mail.gq1.yahoo.com with NNFMP; 02 Aug 2010 08:16:36 -0000 Received: (qmail 7144 invoked by uid 60001); 2 Aug 2010 08:16:36 -0000 Message-ID: <542990.6716.qm@web112520.mail.gq1.yahoo.com> Received: from [72.163.183.45] by web112520.mail.gq1.yahoo.com via HTTP; Mon, 02 Aug 2010 01:16:36 PDT References: <20100802065802.GA12049@host1.dyn.jankratochvil.net> Date: Mon, 02 Aug 2010 08:16:00 -0000 From: paawan oza Subject: Re: GDB hardware watchpoint information on i386 To: Shrikanth Kamath , Jan Kratochvil Cc: gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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 X-SW-Source: 2010-08/txt/msg00007.txt.bz2 Hi, If you look at functions 'bpstat_stop_status' and 'bpstat_do_actions', they find out why the process was stooped and how to execute the associated command. Regards, Oza. ----- Original Message ---- From: Shrikanth Kamath To: Jan Kratochvil Cc: gdb@sourceware.org Sent: Mon, August 2, 2010 1:25:02 PM Subject: Re: GDB hardware watchpoint information on i386 Decent enough Jan. Okay, from internals perspective, say I have written the "commands" to be executed when the watchpoint is hit, which function inside GDB maps this action(s) to the watchpoint trap? I mean there would be foo_service_watchpoint() { /* map actions to this watchpoint */ } which is this function? -- Shrikanth R K On Mon, Aug 2, 2010 at 12:28 PM, Jan Kratochvil wrote: > On Mon, 02 Aug 2010 06:10:31 +0200, Shrikanth Kamath wrote: >> I am specifically looking for information about "hooking" my own handler to >> service the watchpoint interrupt rather than needing to invoke a GDB session >> and press 'c'. > > Besides GDB hacking isn't it enough for you to use `commands' with `continue' > and associate arbitrary commands (`backtrace' here) in the GDB CLI interface? > > Regards, > Jan > > > (gdb) watch v > Hardware watchpoint 1: v > (gdb) commands > Type commands for when breakpoint 1 is hit, one per line. > End with a line saying just "end". >>backtrace >>continue >>end > (gdb) run > Starting program: var > Hardware watchpoint 1: v > > Old value = 0 > New value = 1 > f () at var.c:7 > 7 } > #0 f () at var.c:7 > #1 0x00000000004004a7 in main () at var.c:20 > Hardware watchpoint 1: v > > Old value = 1 > New value = 0 > g () at var.c:13 > 13 } > #0 g () at var.c:13 > #1 0x00000000004004ac in main () at var.c:21 > Hardware watchpoint 1: v > > Old value = 0 > New value = 1 > f () at var.c:7 > 7 } > #0 f () at var.c:7 > #1 0x00000000004004a7 in main () at var.c:20 > Hardware watchpoint 1: v > > [...] >