C++-ify parse_format_string
authorTom Tromey <tom@tromey.com>
Thu, 23 Nov 2017 03:17:28 +0000 (20:17 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 8 Dec 2017 17:23:43 +0000 (10:23 -0700)
commit8e481c3ba86e512b39b16b41de24e87a17f7d968
treebfad22d6b383d85c5b82aa4356af50c81e7bd959
parent10af2a65c8891435d0d63411a3e694cc74c9447c
C++-ify parse_format_string

This replaces parse_format_string with a class, removing some
constructors along the way.  While doing this, I found that one
argument to gen_printf is unused, so I removed it.

Also, I am not completely sure, but the use of `release' in
maint_agent_printf_command and parse_cmd_to_aexpr seems like it may
leak expressions.

Regression tested by the buildbot.

ChangeLog
2017-12-08  Tom Tromey  <tom@tromey.com>

* printcmd.c (ui_printf): Update.  Use std::vector.
* common/format.h (struct format_piece): Add constructor.
<string>: Now const.
(class format_pieces): New class.
(parse_format_string, free_format_pieces)
(free_format_pieces_cleanup): Remove.
* common/format.c (format_pieces::format_pieces): Rename from
parse_format_string.  Update.
(free_format_pieces, free_format_pieces_cleanup): Remove.
* breakpoint.c (parse_cmd_to_aexpr): Update.  Use std::vector.
* ax-gdb.h (gen_printf): Remove argument.
* ax-gdb.c (gen_printf): Remove "frags" argument.
(maint_agent_printf_command): Update.  Use std::vector.

gdbserver/ChangeLog
2017-12-08  Tom Tromey  <tom@tromey.com>

* ax.c (ax_printf): Update.
gdb/ChangeLog
gdb/ax-gdb.c
gdb/ax-gdb.h
gdb/breakpoint.c
gdb/common/format.c
gdb/common/format.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/ax.c
gdb/printcmd.c