[PATCH 0/4] Fix crash in "set python" and small cleanups

Andrew Burgess andrew.burgess@embecosm.com
Tue May 18 13:44:18 GMT 2021


* Marco Barisione via Gdb-patches <gdb-patches@sourceware.org> [2021-05-18 12:07:36 +0100]:

> I noticed by chance that the "set python" command with no arguments
> causes a segfault.  This is due to a trivial mistake, the prefix command
> meant to be "show python" is added to the list of set commands, and the
> "set python" one is added to the list of show commands.
> 
> I didn't add a specific test because what's the chance of "set python"
> regressing?

Don't we know the answer to that is 100% - it's currently regressed,
right?

>              I tried writing a self test instead (like the ones in
> gdb/unittests/command-def-selftests.c), but I couldn't figure out how to
> detect this problem in a generic way.  Any idea?  Or it this patch
> OK without a test?

I don't have any suggestions for a self test, but writing a "normal"
test should be pretty easy, personally, I'd just do that.

Thanks,
Andrew

> 
> This patch series also includes some cleanups which came up from the
> work on the main fix.
> 
> Marco Barisione (4):
>   gdb: Add an overloaded ui_out::text accepting a const std::string &
>   gdb: Pass std::strings to ui_out::field_string () where convenient
>   gdb: Fix crash in cmd_show_list () if the prefix doesn't contain "show
>     "
>   gdb: Add "set|show python" commands to the correct list
> 
>  gdb/ada-lang.c          |  4 ++--
>  gdb/break-catch-sig.c   |  2 +-
>  gdb/break-catch-throw.c |  2 +-
>  gdb/cli/cli-setshow.c   | 32 ++++++++++++++++++++++++--------
>  gdb/disasm.c            |  2 +-
>  gdb/infcmd.c            |  2 +-
>  gdb/inferior.c          |  2 +-
>  gdb/linux-thread-db.c   |  2 +-
>  gdb/mi/mi-cmd-var.c     | 22 +++++++++++-----------
>  gdb/mi/mi-main.c        | 14 +++++++-------
>  gdb/osdata.c            |  3 +--
>  gdb/probe.c             |  5 ++---
>  gdb/python/python.c     |  4 ++--
>  gdb/source.c            |  2 +-
>  gdb/target-connection.c |  2 +-
>  gdb/thread.c            |  5 ++---
>  gdb/tracepoint.c        |  4 ++--
>  gdb/ui-out.c            | 11 +++++++++--
>  gdb/ui-out.h            |  4 +++-
>  19 files changed, 73 insertions(+), 51 deletions(-)
> 
> -- 
> 2.28.0
> 


More information about the Gdb-patches mailing list