From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32395 invoked by alias); 3 May 2012 18:42:18 -0000 Received: (qmail 32384 invoked by uid 22791); 3 May 2012 18:42:17 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qc0-f169.google.com (HELO mail-qc0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 May 2012 18:42:05 +0000 Received: by qcsd16 with SMTP id d16so1663519qcs.0 for ; Thu, 03 May 2012 11:42:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-system-of-record:x-gm-message-state; bh=eisGUZsbyjg26uwGMuCwDPo9R1h3u0+jweORKLU4k+k=; b=XpvzHjYRy4Q5Lnb2rgUxBlze55l/Dt7S0q+FXYUviIXKrD1KDWAj8Mi+M0rig+G0CC Bs7EnE0jqoOCdCCHeiNfAunmtvLeMJZY305hvea50uwbzP4c0YGfNG4OJn3jQRhF2bzc 1GmjlRhOFBCx0/z59tvbJrIBqN2Iq5KJ97tTf6g0WABKhDaeBHy3FulqPXDQWwy5eF20 XN5L4RK2b8PFMd4UODQWx0XQ0x0lfQ/6tur/Y2pYutK4R/oX8IlbcrAYe27s6940Jvcr yeBQCflUuPbed/g5OjJqZ16XXHDbRAtNR9iIeHw+4MHeqZqmqpzBBALCxiDBYBoThtvZ 2NgA== Received: by 10.229.106.34 with SMTP id v34mr1495751qco.57.1336070524141; Thu, 03 May 2012 11:42:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.106.34 with SMTP id v34mr1495745qco.57.1336070524012; Thu, 03 May 2012 11:42:04 -0700 (PDT) Received: by 10.224.215.132 with HTTP; Thu, 3 May 2012 11:42:04 -0700 (PDT) Date: Thu, 03 May 2012 18:42:00 -0000 Message-ID: Subject: Question about GDB event mechanism From: Siva Chandra To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQnokRd2Yq0nczZIolJAYxWmTALpfl2bdG4efQwlH+jX9rmddfP8cjKbwsl+qGbFxacNdoJ7k/2VK56ZK+fgMqOx9C7EKWvkuMPp6fdCbt/6zUSlSO5h9fNqNHKf7zfQN5dXX6en 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: 2012-05/txt/msg00010.txt.bz2 Hi all, I am trying to understand the event mechanism when used in Python code. For example, set a breakpoint at main and run 'tcmd' after sourcing the following Python script: import gdb def bp_handler(bp_event): print "Hello, BreakPoint!" gdb.events.stop.connect(bp_handler) class Cmd(gdb.Command): def __init__(self): super(Cmd, self).__init__("tcmd", gdb.COMMAND_OBSCURE) def invoke(self, arg, from_tty): gdb.execute("run", to_string=True) print "End of 'tcmd'" Cmd() I would expect "Hello, Breakpoint!" to be printed, but it is not being printed as 'run' is executed via 'execute_command_to_string' which will reset gdb_stdout only after 'execute_command' returns. The notification of the breakpoint event is sent via 'normal_stop' before 'execute_command' returns. Above was a simple example, but consider a case where a user is trying to execute commands like 'step' or 'up' as part of the stop event callback: For a long time, I didn't understand what was going when I did such things (I of course had a very different expectations). Hence, should the current behavior be documented or fixed? Thanks, Siva Chandra