Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* [RFC] Setting breakpoint commands from the Python API
@ 2016-12-19 18:51 Martin Galvan
  2016-12-19 19:08 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Galvan @ 2016-12-19 18:51 UTC (permalink / raw)
  To: gdb, tom, Pedro Alves, dgutson .

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!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-19 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 18:51 [RFC] Setting breakpoint commands from the Python API Martin Galvan
2016-12-19 19:08 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox