[PATCH] inferior without argument prints detail of current inferior

Simon Marchi simon.marchi@polymtl.ca
Thu Dec 17 14:24:19 GMT 2020


On 2020-12-17 7:47 a.m., Lancelot SIX via Gdb-patches wrote:
> This patch makes the inferior command display information about the
> current inferior when called with no argument. This behavior is similar
> to the one of the thread command.
> 
> This contribution is inspired by an intem in

intem -> item

> https://sourceware.org/gdb/wiki/ProjectIdeas
> 
> Before patch:
> 
>     (gdb) info inferior
>       Num  Description       Connection           Executable
>     * 1    process 19221     1 (native)           /home/lsix/tmp/a.out
>       2    process 19239     1 (native)           /home/lsix/tmp/a.out
>     (gdb) inferior 2
>     [Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)]
>     [Switching to thread 2.1 (process 19239)]
>     #0  0x0000000000401146 in main ()
>     (gdb) inferior
>     Argument required (expression to compute).
> 
> After patch:
> 
>     (gdb) info inferior
>       Num  Description       Connection           Executable
>     * 1    process 18699     1 (native)           /home/lsix/tmp/a.out
>       2    process 18705     1 (native)           /home/lsix/tmp/a.out
>     (gdb) inferior 2
>     [Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)]
>     [Switching to thread 2.1 (process 18705)]
>     #0  0x0000000000401146 in main ()
>     (gdb) inferior
>     [Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)]
> 
> I do not have yet signed a copyright assignment but I would be happy to
> do so if necessary.

Yes, this patch is leaning towards the "not trivial" side, so I'd suggest
you get one.  It will make it easier if you want to make more contributions.

Fill this form and follow the included instructions, and notify us when
that's done (it can take a bit of time as this process is volunteer-based
at the FSF):

https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

You can still send patches in the mean time.

The patch looks ok to me.  It would probably need a small update to the doc,
where the "inferior" command is described, to talk about the new behavior.

And a test would be nice too.  I don't immediately see an existing test where
it would be relevant to just add a test for this command, so I would create
a new one in testsuite/gdb.base.  You can copy gdb.base/template.exp to get
started.

Simon


More information about the Gdb-patches mailing list