gdb: fix potentially uninitialised variable
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 27 Nov 2020 10:46:07 +0000 (10:46 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 27 Nov 2020 14:55:55 +0000 (14:55 +0000)
commit3df8c6afdd6d38a7622ff5f4b1a64aff80334ab9
tree9403b027352d60730723ddbd205b017c78aa382b
parentb1eea24024e2db6ba46c1a2838e69593e9314d0d
gdb: fix potentially uninitialised variable

In commit:

  commit 037d7135de575c9e0c20e9158c105979bfee339c
  Date:   Mon Nov 16 11:36:56 2020 +0000

      gdb: improve command completion for 'print', 'x', and 'display'

A potential use of an uninitialised variable was introduced.  This is
fixed in this commit.

Previously when analysing /FMT strings for tab completion we
considered two possibilities, either the user has typed '/', or the
user has typed '/' followed by an alpha-numeric character, as these
are the only valid FMT string characters.

This meant that if the user type, for example '/@' and then tried to
tab complete gdb would use an uninitialised variable.

Currently only the first character after the '/' is checked to see if
it is alpha-numeric, so if a user typed '/x@@' then gdb would be happy
to treat this as a FMT string.

Given the goal of this change was primarily to allow tab completion of
symbols later in the command when a /FMT was used then I decided to
just make the /FMT skipping less smart.  Now any characters after the
'/' up to the first white space, will be treated as a FMT string.

gdb/ChangeLog:

* printcmd.c (skip_over_slash_fmt): Reorder code to ensure in_fmt
is always initialized.
gdb/ChangeLog
gdb/printcmd.c
This page took 0.026639 seconds and 4 git commands to generate.