GNU bug report logs - #34769
Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match

Previous Next

Package: emacs;

Reported by: Tobias Zawada <i_inbox <at> tn-home.de>

Date: Wed, 6 Mar 2019 15:59:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Zawada <i_inbox <at> tn-home.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Bug in emacs 26.1 gdb-send match-string applied after non-matching
 string-match
Date: Wed, 6 Mar 2019 12:27:03 +0100 (CET)
Dear Emacs maintainers,

At the end of gdb-send one finds the following lines:

  (let* ((control-command-p (string-match gdb-control-commands-regexp string))
         (command-arg (match-string 3 string))

It is wrong to call (match-string 3 string) if (string-match gdb-control-commands-regexp string) returned nil.
The doc of match-string says:
"Return string of text matched by last search."
That means match-string only returns sensible results if the last match was successful.

Possible correction:

  (let* ((control-command-p (string-match gdb-control-commands-regexp string))
         (command-arg (and control-command-p (match-string 3 string)))


System info:
GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29

Best regards,
Tobias




This bug report was last modified 6 years and 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.