bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-mat


From: Tobias Zawada
Subject: bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match
Date: Wed, 6 Mar 2019 21:10:54 +0100 (CET)

Dear Eli,
thanks for looking into this.

> > It is wrong to call (match-string 3 string) if (string-match 
> > gdb-control-commands-regexp string) returned nil.
> ...
> That is true, and a cleanup is a good idea. But please note that the
> undefined results are not used if control-command-p is nil, so the
> issue is not that serious.

The match data is that one of the previous successful matching operation.
One gets an args-out-of-range signal if the indexes in the match data are 
larger than the width of the string argument to match-string. That is how I 
discovered the error.

A reconstruction with gdb-send is too involved.
Instead I demonstrate the effect with the following orgmode source code block 
inclusive results:

#+BEGIN_SRC emacs-lisp
(string-match "\\(1\\) *\\(2\\)" "1          2")
(string-match "\\(3 \\(4\\)\\)" "1 2")
(append
 (match-data)
 (condition-case err
     (match-string 2 "1 2")
     (error (list err))))
#+END_SRC

#+RESULTS:
| 0 | 12 | 0 | 1 | 11 | 12 | (args-out-of-range 1 2 11 12) |

Best regards,
Tobias





reply via email to

[Prev in Thread] Current Thread [Next in Thread]