[review v2] gdb/mi: Add new commands -symbol-info-{functions,variables,types}

Andrew Burgess (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Fri Nov 1 01:36:00 GMT 2019


Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/266
......................................................................


Patch Set 2:

(1 comment)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/266/1/gdb/mi/mi-symbol-cmds.c 
File gdb/mi/mi-symbol-cmds.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/266/1/gdb/mi/mi-symbol-cmds.c@117 
PS1, Line 117: 
102 | mi_symbol_info (enum search_domain kind, const char *regexp,
    | ...
112 |   ui_out_emit_tuple all_matching_symbols (uiout, "symbols");
113 | 
114 |   /* The order of these optional emitters is critical as they will be
115 |      deleted in reverse order, which is important as these are popped from
116 |      the uiout stack as they are destroyed.  */
117 >   gdb::optional<ui_out_emit_list> debug_func_emitter_outer;
118 >   gdb::optional<ui_out_emit_tuple> debug_func_emitter_symtab;
119 >   gdb::optional<ui_out_emit_list> debug_func_emitter_symbols;
120 >   gdb::optional<ui_out_emit_list> nondebug_func_emitter;
121 | 
122 |   const symtab *last_symtab = nullptr;
123 | 
124 |   for (const symbol_search &p : symbols)
125 |     {

> I wonder if there's a better way.  It's ok if not, this is just […]

I don't know of any other way to get the structured MI output without creating and destroying all of these different ui_out_emit_* objects, however, I've tried harder to hide the complexity.  I'm not completely convinced that the new way is better - I'd be interested to hear your thoughts.

If you prefer this then there's a later patch in this series that could get the same treatment.  I've not done that yet because, like I said, I'm not completely convinced the new code is that much better.



-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic2fc6a6750bbce91cdde2344791014e5ef45642d
Gerrit-Change-Number: 266
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Fri, 01 Nov 2019 01:36:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list