From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24926 invoked by alias); 2 Aug 2011 02:44:40 -0000 Received: (qmail 24914 invoked by uid 22791); 2 Aug 2011 02:44:39 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yi0-f41.google.com (HELO mail-yi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 02:44:24 +0000 Received: by yia13 with SMTP id 13so4551686yia.0 for ; Mon, 01 Aug 2011 19:44:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.251.41 with SMTP id y41mr1325038ybh.36.1312253063372; Mon, 01 Aug 2011 19:44:23 -0700 (PDT) Received: by 10.146.150.2 with HTTP; Mon, 1 Aug 2011 19:44:23 -0700 (PDT) Date: Tue, 02 Aug 2011 02:44:00 -0000 Message-ID: Subject: behavior of hook-stop command From: "Amker.Cheng" To: gdb@sourceware.org Cc: hellogcc@freelists.org Content-Type: text/plain; charset=ISO-8859-1 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: 2011-08/txt/msg00001.txt.bz2 Hi, In gdb document, it is said hook-stop makes the associated commands execute every time execution stops in your program. while for cases where continue command included in hook-stop, it's not true. for example: define hook-stop p /x $pc continue end User defined hook-stop command is executed by codes: void execute_cmd_pre_hook (struct cmd_list_element *c) { if ((c->hook_pre) && (!c->hook_in)) { struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, c); c->hook_in = 1; /* Prevent recursive hooking. */ execute_user_command (c->hook_pre, (char *) 0); do_cleanups (cleanups); } } Since hook_in is set to 1, the (!c->hook_in) is false next time breakpoint is hit, resulting in hook-stop will be executed at the first breakpoint. I understand hook_in is essential to prevent gdb from possible recursion and seems hard to change the behavior within current infrastructure. Is this a bug? Should we state this in GDB document? Any suggestion? Thanks. -- Best Regards.