This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [RFC] Setting breakpoint commands from the Python API
- From: Tom Tromey <tom at tromey dot com>
- To: Martin Galvan <omgalvan dot 86 at gmail dot com>
- Cc: gdb at sourceware dot org, tom at tromey dot com, Pedro Alves <palves at redhat dot com>, "dgutson ." <danielgutson at gmail dot com>
- Date: Mon, 19 Dec 2016 12:07:51 -0700
- Subject: Re: [RFC] Setting breakpoint commands from the Python API
- Authentication-results: sourceware.org; auth=none
- References: <CAN19L9E4D5xMZwEiEmG_57cdSiBM_VCg1eY1gyFcqzN24J_5zg@mail.gmail.com>
>>>>> "Martin" == Martin Galvan <omgalvan.86@gmail.com> writes:
Martin> Doing gdb.execute('commands 2 3 4\necho "Hello World"\nend')
Martin> doesn't work either.
Yes, IIRC multi-line commands can't be evaluated with gdb.execute.
It would be nice to lift this restriction.
Martin> In view of this I'm thinking of adding a new 'set_commands' method to
Martin> gdb.Breakpoint. For the implementation I was looking at
Martin> do_map_commands_command, which is called when issuing 'commands' from
Martin> the gdb CLI, but can also take an already parsed command (when
info-> control != NULL). However, before I went any further I wanted to
Martin> ask you guys if there's another way to do this that I'm missing, or if
Martin> there are any suggestions.
How about just allowing assignment of the .commands attribute? I think
that would be more in keeping with the other attributes of
gdb.Breakpoint.
thanks,
Tom