Re: [PATCH 3/3] gdb/mi: Add new commands -symbol-info-{functions,variables,types}

André Pönitz
2019-10-04T13:46:27Z

On Thu, Oct 03, 2019 at 11:01:12PM -0400, Simon Marchi wrote:
> On 2019-09-26 7:09 p.m., Andrew Burgess wrote:
> > Add new MI commands -symbol-info-functions, -symbol-info-variables,
> > and -symbol-info-types which correspond to the CLI commands 'info
> > functions', 'info variables', and 'info types' respectively.
>
> Hi Andrew,
>
> The first thing I tried was to run it on GDB itself and run "-symbol-info-functions"
> by itself. Apparently, it tries to list all functions in the program :). I think
> we need to be careful with that, as it would be really easy for a debug session to
> become unresponsive. Imagine an IDE that has a little box to search symbols by name.
> The user while debugging a big program, types "e<enter>", which generates this
> MI command:
>
> -symbol-info-functions --name "e"
>
> This would essentially hang the debug session while GDB expands all the symtabs with
> at least a function with "e" in its name. It would take a huge amount of time and
> memory. I don't know how easy it would be to implement, but for these cases, a
> "--max-results N" switch, which would stop the search early, might useful.

From an (one...) IDE's point of view, any such limit setting would be desirable,
and I'd personally would appreciate some limit on time, with the result record
indication on whether the result is complete or the timeout was hit.

> [...]
>
> Also, since this output is meant to be consumed by a front-end, it would be
> interesting to have the details of the symbols in separate fields. For example,
> for variables, have the type and name in separate fields. This gives front-ends
> more freedom on how to display them.

Indeed.

Andre'