From: Martin Galvan <omgalvan.86@gmail.com>
To: gdb@sourceware.org, tom@tromey.com,
Pedro Alves <palves@redhat.com>,
"dgutson ." <danielgutson@gmail.com>
Subject: [RFC] Setting breakpoint commands from the Python API
Date: Mon, 19 Dec 2016 18:51:00 -0000 [thread overview]
Message-ID: <CAN19L9E4D5xMZwEiEmG_57cdSiBM_VCg1eY1gyFcqzN24J_5zg@mail.gmail.com> (raw)
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!
next reply other threads:[~2016-12-19 18:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 18:51 Martin Galvan [this message]
2016-12-19 19:08 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN19L9E4D5xMZwEiEmG_57cdSiBM_VCg1eY1gyFcqzN24J_5zg@mail.gmail.com \
--to=omgalvan.86@gmail.com \
--cc=danielgutson@gmail.com \
--cc=gdb@sourceware.org \
--cc=palves@redhat.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox