From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54583 invoked by alias); 19 Dec 2016 18:51:30 -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 54565 invoked by uid 89); 19 Dec 2016 18:51:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=issuing, interactive, H*Ad:U*tom, H*r:sk:gdb@sou X-HELO: mail-yb0-f182.google.com Received: from mail-yb0-f182.google.com (HELO mail-yb0-f182.google.com) (209.85.213.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Dec 2016 18:51:27 +0000 Received: by mail-yb0-f182.google.com with SMTP id v78so59752552ybe.3 for ; Mon, 19 Dec 2016 10:51:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=PK4N2AWXnMMAix66gMN7ebX0OtN9xkThUrOtLcDlUBI=; b=S5X6+HpmGJDn/1WbSdnIofwobTI0L6CG5GrDEinqYW5tmFstiXRidYkPPkVI/rTxpu +oxDdhTsDucRJ9bKzGndbqVUCwQQrcKI/phg9anQHAyyx7iOyoDjcXFHf2ZMeVxV0tNa Lp8tsdXZcyKU1TfeBKeBRcu7DABZALORNKwdOX7+AhW6fomOvU3b5KArO8Yf6cdZz3nM 4gRvZ/gH8taKA5n5qPIEi2QP6nIRMtiT1S6PFw0TV8yj/15ISDgC8aT9ZOUdLugt3HEp zTH+GPTdmDWPU05ZeQf/bhtbxqEYj507xHDtXlxcVTjqr4LDnN3Ak1NDDUfL6thdHzW5 vD9g== X-Gm-Message-State: AIkVDXJrX6QgJOnIXOpDS21dE1kZrOYAhNHSOiF6ijIXI7J8vAFpRxXqGipexMtXnoTKKo79MXT/LhWqJVNlkw== X-Received: by 10.37.221.135 with SMTP id u129mr886898ybg.36.1482173486230; Mon, 19 Dec 2016 10:51:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.13.213.214 with HTTP; Mon, 19 Dec 2016 10:51:05 -0800 (PST) From: Martin Galvan Date: Mon, 19 Dec 2016 18:51:00 -0000 Message-ID: Subject: [RFC] Setting breakpoint commands from the Python API To: gdb@sourceware.org, tom@tromey.com, Pedro Alves , "dgutson ." Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-12/txt/msg00028.txt.bz2 Hi everyone, I'm working on a Python script to implement a new gdb command that takes a 'source' breakpoint and applies its commands to a list of 'destination' breakpoints. Something like: (gdb) commands 1 echo "Hello World" end (gdb) copycmd 1, 2 3 4 I'm having a bit of trouble setting the commands from the Python side. >From what I saw, a gdb.Breakpoint's 'commands' attribute is read-only, which leaves me with the option of using gdb.execute() to set the commands manually. However, doing gdb.execute('commands') shows me the usual "commands" prompt for entering the commands as if I was on an interactive session (even though from_tty is False). Doing gdb.execute('commands 2 3 4\necho "Hello World"\nend') doesn't work either. In view of this I'm thinking of adding a new 'set_commands' method to gdb.Breakpoint. For the implementation I was looking at do_map_commands_command, which is called when issuing 'commands' from the gdb CLI, but can also take an already parsed command (when info->control != NULL). However, before I went any further I wanted to ask you guys if there's another way to do this that I'm missing, or if there are any suggestions. Thanks!