unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* stack overflow in regexp matcher with gdb
@ 2013-11-13 11:13 Maury, Olivier
  2013-11-13 19:06 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Maury, Olivier @ 2013-11-13 11:13 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hello,

I'm using emacs 23.4.1 + gdb 7.6 and when I stop in certain files (that are rather big : > 10MB and with large, generated, functions) I'm having that error:

error in process filter: gdb-stack-list-locals-handler: Stack overflow in regexp matcher
error in process filter: Stack overflow in regexp matcher

This is really really painful as I cannot enter a single command unless I do a  CTRL+C CTRL+C for every one of them (even for a print a to set a breakpoint).

I don't know where it comes from, I've been searching on the web and found a bug report was entered some years ago but it seems it ended here.

Is there any way to turn that thing off (whatever it is doing) so I can at least continue debugging in a normal way ?

BR,

Olivier


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: stack overflow in regexp matcher with gdb
  2013-11-13 11:13 stack overflow in regexp matcher with gdb Maury, Olivier
@ 2013-11-13 19:06 ` Stefan Monnier
  2013-11-14 12:10   ` Maury, Olivier
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-11-13 19:06 UTC (permalink / raw)
  To: help-gnu-emacs

> error in process filter: gdb-stack-list-locals-handler: Stack overflow in regexp matcher
> error in process filter: Stack overflow in regexp matcher

Please try to enable "Options => Enter Debugger on Error", and if that
fails to give you a backtrace, then try M-: (setq debug-on-signal t) RET
[ But note that this latter option will make your Emacs session
  "inconvenient" because the debugger will be triggered too often.  ]

That should hopefully give you a backtrace which can help fix the problem.
Of course, M-x report-emacs-bug is also a good idea.
In any case, you'll probably want to try Emacs-24.3 first, to see if
this bug hasn't been fixed already.

> I don't know where it comes from, I've been searching on the web and
> found a bug report was entered some years ago but it seems it ended here.

It means that the backtracking-based regexp-matcher recursed too deep
(probably because some "*" repetition matched many more times than
normally expected).  The best fix usually is to change the regexp so it
backtracks less (i.e. uses less stack space) or so the match fails
much earlier.

> Is there any way to turn that thing off (whatever it is doing) so I can at
> least continue debugging in a normal way ?

Not sure:  using M-x gud-gdb RET instead of M-x gdb would be a way, but
that requires re-starting the GDB session (and it gives you a much more
barebones UI, tho that's what I use personally).


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: stack overflow in regexp matcher with gdb
  2013-11-13 19:06 ` Stefan Monnier
@ 2013-11-14 12:10   ` Maury, Olivier
  2013-11-14 19:31     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Maury, Olivier @ 2013-11-14 12:10 UTC (permalink / raw)
  To: Stefan Monnier, help-gnu-emacs@gnu.org

Hello,

Thanks for the tips.

I tried with the 24.3 version of emacs and the gdb -i=mi interface. It seems it works a little bit better (doesn't fail with that kind of error). However when I do a "next" the first one is ok but the second "next" is very slow and then it's ok again and then it's very slow again, etc... and from time to time the gdb prompt is no longer printed even though I can still enter gdb commands... 
Using gud-gdb with the 24.3 version of emacs seems even more weird as it doesn't show the source files I've stop in... it's like if I was using gdb in a terminal. And if I use gdb --annotate=3 it's not better.

Here is what I got with the 23.4 version of emacs:
Debugger entered--Lisp error: (error "Stack overflow in regexp matcher")
  looking-at(",value=\\(\".*\"\\).*?}")
  gdb-stack-list-locals-handler()
  gdb-prompt("")
  gud-gdba-marker-filter("e=\"double\",value=\"0\"},{name=\"sD2901\",type=\"double\",value=\"0\"},{name=\"sD2902\",type=\"double\",value=\"0\"},{name=\"sD2903\",type=\"double\",value=\"0\"},{name=\"sD2904\",type=\"double\",value=\"0\"},{name=\"sD2905\",type=\"double\",value=\"0\"},{name=\"sD2906\",type=\"double\",value=\"0\"},{name=\"sD2907\",type=\"double\",value=\"0\"},{name=\"sD2908\",type=\"double\",value=\"0\"},{name=\"sD2909\",type=\"double\",value=\"0\"},{name=\"sD2910\",type=\"double\",value=\"0\"},{name=\"sD2911\",type=\"double\",value=\"0\"},{name=\"sD2912\",type=\"double\",value=\"0\"},{name=\"sD2913\",type=\"double\",value=\"0\"},{name=\"sD2914\",type=\"double\",value=\"0\"},{name=\"sD2915\",type=\"double\",value=\"0\"},{name=\"sD2916\",type=\"double\",value=\"0\"},{name=\"sD2917\",type=\"double\",value=\"0\"},{name=\"sD2918\",type=\"double\",value=\"0\"},{name=\"sD2919\",type=\"double\",value=\"0\"},{name=\"sD2920\",type=\"double\",value=\"0\"},{name=\"sD2921\",type=\"double\",value=\"0\"},{name=\"sD2922\",type=\"double\",value=\"0\"},{name=\"sD2923\",type=\"double\",value=\"0\"},{name=\"sD2924\",type=\"double\",value=\"0\"},{name=\"sD2953\",type=\"double\",value=\"0\"},{name=\"sD2954\",type=\"double\",value=\"0\"},{name=\"sD2955\",type=\"double\",value=\"0\"},{name=\"sD2956\",type=\"double\",value=\"0\"},{name=\"sD2957\",type=\"double\",value=\"0\"},{name=\"sD2958\",type=\"double\",value=\"0\"},{name=\"sD2959\",type=\"double\",value=\"0\"},{name=\"sD2960\",type=\"double\",value=\"0\"},{name=\"sD2961\",type=\"double\",value=\"0\"},{name=\"sD2962\",type=\"double\",value=\"0\"},{name=\"sD2963\",type=\"double\",value=\"0\"},{name=\"sD2964\",type=\"double\",value=\"0\"},{name=\"sD2965\",type=\"double\",value=\"0\"},{name=\"sD2966\",type=\"double\",value=\"0\"},{name=\"sD2967\",type=\"double\",value=\"0\"},{name=\"sD2968\",type=\"double\",value=\"0\"},{name=\"sD2969\",type=\"double\",value=\"0\"},{name=\"sD2970\",type=\"double\",value=\"0\"},{name=\"sD2971\",type=\"double\",value=\"0\"},{name=\"sD2972\",type=\"double\",value=\"0\"},{name=\"sD2973\",type=\"double\",value=\"0\"},{name=\"sD2974\",type=\"double\",value=\"0\"},{name=\"sD2975\",type=\"double\",value=\"0\"},{name=\"sD2976\",type=\"double\",value=\"0\"},{name=\"sD2977\",type=\"double\",value=\"0\"},{name=\"sD2978\",type=\"double\",value=\"0\"},{name=\"sD2979\",type=\"double\",value=\"0\"},{name=\"sD2980\",type=\"double\",value=\"0\"},{name=\"sD2981\",type=\"double\",value=\"0\"},{name=\"sD2982\",type=\"double\",value=\"0\"},{name=\"sD2983\",type=\"double\",value=\"0\"},{name=\"sD2984\",type=\"double\",value=\"0\"},{name=\"sD2985\",type=\"double\",value=\"0\"},{name=\"sD2986\",type=\"double\",value=\"0\"},{name=\"sD2987\",type=\"double\",value=\"0\"},{name=\"sD2988\",type=\"double\",value=\"0\"},{name=\"sD2989\",type=\"double\",value=\"0\"},{name=\"sD2990\",type=\"double\",value=\"0\"}]\n\n\x1a\x1apre-prompt\n(gdb) \n\x1a\x1aprompt\n")
  apply(gud-gdba-marker-filter "e=\"double\",value=\"0\"},{name=\"sD2901\",type=\"double\",value=\"0\"},{name=\"sD2902\",type=\"double\",value=\"0\"},{name=\"sD2903\",type=\"double\",value=\"0\"},{name=\"sD2904\",type=\"double\",value=\"0\"},{name=\"sD2905\",type=\"double\",value=\"0\"},{name=\"sD2906\",type=\"double\",value=\"0\"},{name=\"sD2907\",type=\"double\",value=\"0\"},{name=\"sD2908\",type=\"double\",value=\"0\"},{name=\"sD2909\",type=\"double\",value=\"0\"},{name=\"sD2910\",type=\"double\",value=\"0\"},{name=\"sD2911\",type=\"double\",value=\"0\"},{name=\"sD2912\",type=\"double\",value=\"0\"},{name=\"sD2913\",type=\"double\",value=\"0\"},{name=\"sD2914\",type=\"double\",value=\"0\"},{name=\"sD2915\",type=\"double\",value=\"0\"},{name=\"sD2916\",type=\"double\",value=\"0\"},{name=\"sD2917\",type=\"double\",value=\"0\"},{name=\"sD2918\",type=\"double\",value=\"0\"},{name=\"sD2919\",type=\"double\",value=\"0\"},{name=\"sD2920\",type=\"double\",value=\"0\"},{name=\"sD2921\",type=\"double\",value=\"0\"},{name=\"sD2922\",type=\"double\",value=\"0\"},{name=\"sD2923\",type=\"double\",value=\"0\"},{name=\"sD2924\",type=\"double\",value=\"0\"},{name=\"sD2953\",type=\"double\",value=\"0\"},{name=\"sD2954\",type=\"double\",value=\"0\"},{name=\"sD2955\",type=\"double\",value=\"0\"},{name=\"sD2956\",type=\"double\",value=\"0\"},{name=\"sD2957\",type=\"double\",value=\"0\"},{name=\"sD2958\",type=\"double\",value=\"0\"},{name=\"sD2959\",type=\"double\",value=\"0\"},{name=\"sD2960\",type=\"double\",value=\"0\"},{name=\"sD2961\",type=\"double\",value=\"0\"},{name=\"sD2962\",type=\"double\",value=\"0\"},{name=\"sD2963\",type=\"double\",value=\"0\"},{name=\"sD2964\",type=\"double\",value=\"0\"},{name=\"sD2965\",type=\"double\",value=\"0\"},{name=\"sD2966\",type=\"double\",value=\"0\"},{name=\"sD2967\",type=\"double\",value=\"0\"},{name=\"sD2968\",type=\"double\",value=\"0\"},{name=\"sD2969\",type=\"double\",value=\"0\"},{name=\"sD2970\",type=\"double\",value=\"0\"},{name=\"sD2971\",type=\"double\",value=\"0\"},{name=\"sD2972\",type=\"double\",value=\"0\"},{name=\"sD2973\",type=\"double\",value=\"0\"},{name=\"sD2974\",type=\"double\",value=\"0\"},{name=\"sD2975\",type=\"double\",value=\"0\"},{name=\"sD2976\",type=\"double\",value=\"0\"},{name=\"sD2977\",type=\"double\",value=\"0\"},{name=\"sD2978\",type=\"double\",value=\"0\"},{name=\"sD2979\",type=\"double\",value=\"0\"},{name=\"sD2980\",type=\"double\",value=\"0\"},{name=\"sD2981\",type=\"double\",value=\"0\"},{name=\"sD2982\",type=\"double\",value=\"0\"},{name=\"sD2983\",type=\"double\",value=\"0\"},{name=\"sD2984\",type=\"double\",value=\"0\"},{name=\"sD2985\",type=\"double\",value=\"0\"},{name=\"sD2986\",type=\"double\",value=\"0\"},{name=\"sD2987\",type=\"double\",value=\"0\"},{name=\"sD2988\",type=\"double\",value=\"0\"},{name=\"sD2989\",type=\"double\",value=\"0\"},{name=\"sD2990\",type=\"double\",value=\"0\"}]\n\n\x1a\x1apre-prompt\n(gdb) \n\x1a\x1aprompt\n")
  gud-marker-filter("e=\"double\",value=\"0\"},{name=\"sD2901\",type=\"double\",value=\"0\"},{name=\"sD2902\",type=\"double\",value=\"0\"},{name=\"sD2903\",type=\"double\",value=\"0\"},{name=\"sD2904\",type=\"double\",value=\"0\"},{name=\"sD2905\",type=\"double\",value=\"0\"},{name=\"sD2906\",type=\"double\",value=\"0\"},{name=\"sD2907\",type=\"double\",value=\"0\"},{name=\"sD2908\",type=\"double\",value=\"0\"},{name=\"sD2909\",type=\"double\",value=\"0\"},{name=\"sD2910\",type=\"double\",value=\"0\"},{name=\"sD2911\",type=\"double\",value=\"0\"},{name=\"sD2912\",type=\"double\",value=\"0\"},{name=\"sD2913\",type=\"double\",value=\"0\"},{name=\"sD2914\",type=\"double\",value=\"0\"},{name=\"sD2915\",type=\"double\",value=\"0\"},{name=\"sD2916\",type=\"double\",value=\"0\"},{name=\"sD2917\",type=\"double\",value=\"0\"},{name=\"sD2918\",type=\"double\",value=\"0\"},{name=\"sD2919\",type=\"double\",value=\"0\"},{name=\"sD2920\",type=\"double\",value=\"0\"},{name=\"sD2921\",type=\"double\",value=\"0\"},{name=\"sD2922\",type=\"double\",value=\"0\"},{name=\"sD2923\",type=\"double\",value=\"0\"},{name=\"sD2924\",type=\"double\",value=\"0\"},{name=\"sD2953\",type=\"double\",value=\"0\"},{name=\"sD2954\",type=\"double\",value=\"0\"},{name=\"sD2955\",type=\"double\",value=\"0\"},{name=\"sD2956\",type=\"double\",value=\"0\"},{name=\"sD2957\",type=\"double\",value=\"0\"},{name=\"sD2958\",type=\"double\",value=\"0\"},{name=\"sD2959\",type=\"double\",value=\"0\"},{name=\"sD2960\",type=\"double\",value=\"0\"},{name=\"sD2961\",type=\"double\",value=\"0\"},{name=\"sD2962\",type=\"double\",value=\"0\"},{name=\"sD2963\",type=\"double\",value=\"0\"},{name=\"sD2964\",type=\"double\",value=\"0\"},{name=\"sD2965\",type=\"double\",value=\"0\"},{name=\"sD2966\",type=\"double\",value=\"0\"},{name=\"sD2967\",type=\"double\",value=\"0\"},{name=\"sD2968\",type=\"double\",value=\"0\"},{name=\"sD2969\",type=\"double\",value=\"0\"},{name=\"sD2970\",type=\"double\",value=\"0\"},{name=\"sD2971\",type=\"double\",value=\"0\"},{name=\"sD2972\",type=\"double\",value=\"0\"},{name=\"sD2973\",type=\"double\",value=\"0\"},{name=\"sD2974\",type=\"double\",value=\"0\"},{name=\"sD2975\",type=\"double\",value=\"0\"},{name=\"sD2976\",type=\"double\",value=\"0\"},{name=\"sD2977\",type=\"double\",value=\"0\"},{name=\"sD2978\",type=\"double\",value=\"0\"},{name=\"sD2979\",type=\"double\",value=\"0\"},{name=\"sD2980\",type=\"double\",value=\"0\"},{name=\"sD2981\",type=\"double\",value=\"0\"},{name=\"sD2982\",type=\"double\",value=\"0\"},{name=\"sD2983\",type=\"double\",value=\"0\"},{name=\"sD2984\",type=\"double\",value=\"0\"},{name=\"sD2985\",type=\"double\",value=\"0\"},{name=\"sD2986\",type=\"double\",value=\"0\"},{name=\"sD2987\",type=\"double\",value=\"0\"},{name=\"sD2988\",type=\"double\",value=\"0\"},{name=\"sD2989\",type=\"double\",value=\"0\"},{name=\"sD2990\",type=\"double\",value=\"0\"}]\n\n\x1a\x1apre-prompt\n(gdb) \n\x1a\x1aprompt\n")
  gud-filter(#<process gud-my_exe_64.exe> "e=\"double\",value=\"0\"},{name=\"sD2901\",type=\"double\",value=\"0\"},{name=\"sD2902\",type=\"double\",value=\"0\"},{name=\"sD2903\",type=\"double\",value=\"0\"},{name=\"sD2904\",type=\"double\",value=\"0\"},{name=\"sD2905\",type=\"double\",value=\"0\"},{name=\"sD2906\",type=\"double\",value=\"0\"},{name=\"sD2907\",type=\"double\",value=\"0\"},{name=\"sD2908\",type=\"double\",value=\"0\"},{name=\"sD2909\",type=\"double\",value=\"0\"},{name=\"sD2910\",type=\"double\",value=\"0\"},{name=\"sD2911\",type=\"double\",value=\"0\"},{name=\"sD2912\",type=\"double\",value=\"0\"},{name=\"sD2913\",type=\"double\",value=\"0\"},{name=\"sD2914\",type=\"double\",value=\"0\"},{name=\"sD2915\",type=\"double\",value=\"0\"},{name=\"sD2916\",type=\"double\",value=\"0\"},{name=\"sD2917\",type=\"double\",value=\"0\"},{name=\"sD2918\",type=\"double\",value=\"0\"},{name=\"sD2919\",type=\"double\",value=\"0\"},{name=\"sD2920\",type=\"double\",value=\"0\"},{name=\"sD2921\",type=\"double\",value=\"0\"},{name=\"sD2922\",type=\"double\",value=\"0\"},{name=\"sD2923\",type=\"double\",value=\"0\"},{name=\"sD2924\",type=\"double\",value=\"0\"},{name=\"sD2953\",type=\"double\",value=\"0\"},{name=\"sD2954\",type=\"double\",value=\"0\"},{name=\"sD2955\",type=\"double\",value=\"0\"},{name=\"sD2956\",type=\"double\",value=\"0\"},{name=\"sD2957\",type=\"double\",value=\"0\"},{name=\"sD2958\",type=\"double\",value=\"0\"},{name=\"sD2959\",type=\"double\",value=\"0\"},{name=\"sD2960\",type=\"double\",value=\"0\"},{name=\"sD2961\",type=\"double\",value=\"0\"},{name=\"sD2962\",type=\"double\",value=\"0\"},{name=\"sD2963\",type=\"double\",value=\"0\"},{name=\"sD2964\",type=\"double\",value=\"0\"},{name=\"sD2965\",type=\"double\",value=\"0\"},{name=\"sD2966\",type=\"double\",value=\"0\"},{name=\"sD2967\",type=\"double\",value=\"0\"},{name=\"sD2968\",type=\"double\",value=\"0\"},{name=\"sD2969\",type=\"double\",value=\"0\"},{name=\"sD2970\",type=\"double\",value=\"0\"},{name=\"sD2971\",type=\"double\",value=\"0\"},{name=\"sD2972\",type=\"double\",value=\"0\"},{name=\"sD2973\",type=\"double\",value=\"0\"},{name=\"sD2974\",type=\"double\",value=\"0\"},{name=\"sD2975\",type=\"double\",value=\"0\"},{name=\"sD2976\",type=\"double\",value=\"0\"},{name=\"sD2977\",type=\"double\",value=\"0\"},{name=\"sD2978\",type=\"double\",value=\"0\"},{name=\"sD2979\",type=\"double\",value=\"0\"},{name=\"sD2980\",type=\"double\",value=\"0\"},{name=\"sD2981\",type=\"double\",value=\"0\"},{name=\"sD2982\",type=\"double\",value=\"0\"},{name=\"sD2983\",type=\"double\",value=\"0\"},{name=\"sD2984\",type=\"double\",value=\"0\"},{name=\"sD2985\",type=\"double\",value=\"0\"},{name=\"sD2986\",type=\"double\",value=\"0\"},{name=\"sD2987\",type=\"double\",value=\"0\"},{name=\"sD2988\",type=\"double\",value=\"0\"},{name=\"sD2989\",type=\"double\",value=\"0\"},{name=\"sD2990\",type=\"double\",value=\"0\"}]\n\n\x1a\x1apre-prompt\n(gdb) \n\x1a\x1aprompt\n")

Olivier

-----Original Message-----
From: help-gnu-emacs-bounces+olivier_maury=mentor.com@gnu.org [mailto:help-gnu-emacs-bounces+olivier_maury=mentor.com@gnu.org] On Behalf Of Stefan Monnier
Sent: Wednesday, November 13, 2013 20:06
To: help-gnu-emacs@gnu.org
Subject: Re: stack overflow in regexp matcher with gdb

> error in process filter: gdb-stack-list-locals-handler: Stack overflow 
> in regexp matcher error in process filter: Stack overflow in regexp 
> matcher

Please try to enable "Options => Enter Debugger on Error", and if that fails to give you a backtrace, then try M-: (setq debug-on-signal t) RET [ But note that this latter option will make your Emacs session
  "inconvenient" because the debugger will be triggered too often.  ]

That should hopefully give you a backtrace which can help fix the problem.
Of course, M-x report-emacs-bug is also a good idea.
In any case, you'll probably want to try Emacs-24.3 first, to see if this bug hasn't been fixed already.

> I don't know where it comes from, I've been searching on the web and 
> found a bug report was entered some years ago but it seems it ended here.

It means that the backtracking-based regexp-matcher recursed too deep (probably because some "*" repetition matched many more times than normally expected).  The best fix usually is to change the regexp so it backtracks less (i.e. uses less stack space) or so the match fails much earlier.

> Is there any way to turn that thing off (whatever it is doing) so I 
> can at least continue debugging in a normal way ?

Not sure:  using M-x gud-gdb RET instead of M-x gdb would be a way, but that requires re-starting the GDB session (and it gives you a much more barebones UI, tho that's what I use personally).


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: stack overflow in regexp matcher with gdb
  2013-11-14 12:10   ` Maury, Olivier
@ 2013-11-14 19:31     ` Stefan Monnier
  2013-11-15 13:19       ` Maury, Olivier
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-11-14 19:31 UTC (permalink / raw)
  To: Maury, Olivier; +Cc: help-gnu-emacs@gnu.org

> I tried with the 24.3 version of emacs and the gdb -i=mi interface. It seems
> it works a little bit better (doesn't fail with that kind of error). However
> when I do a "next" the first one is ok but the second "next" is very slow
> and then it's ok again and then it's very slow again, etc... and from time
> to time the gdb prompt is no longer printed even though I can still enter
> gdb commands... 

Hmm... performance bugs can be even worse to track down :-(

> Using gud-gdb with the 24.3 version of emacs seems even more weird as it
> doesn't show the source files I've stop in...

That's odd as well: for me it does jump to the source.  `gud-gdb' should
be the "safe fallback", so please report a bug about this, providing as
much details as you can.

>   looking-at(",value=\\(\".*\"\\).*?}")

Indeed, this regexp is problematic.  Do you have some idea what the text
can be between the quotes?
IOW can we use (looking-at ",value=\\(\"[^\"]*\"\\).*?}") instead
(which would eliminate the backtracking), or is the a risk of the value
containing a " somewhere (and if so, how is it quoted?)?

The 24.3 code is pretty different, but I see the same kind of regexp, so
the same problem is probably present as well.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: stack overflow in regexp matcher with gdb
  2013-11-14 19:31     ` Stefan Monnier
@ 2013-11-15 13:19       ` Maury, Olivier
  2013-11-15 14:18         ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Maury, Olivier @ 2013-11-15 13:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs@gnu.org

Well I'm not fluent in Lisp so it's difficult for me to really understand what it's doing. But, based on the trace I got and what I can guess from the gdb-ui.el file, I suppose that function is here to get the value of each local parameter of the function and to print that into the "Locals" frame buffer. 
So when, as it is the case here, you have a very very large number of local variables (something around 2500 variables with some of them that are double arrays on the stack and with significantly long names)... it seems it fails.
I wish I knew more about Lisp in order to propose a fix... Assuming my guess is correct, if we could, for example, parameterize the number of variables that we can monitor in the "Locals" buffer then we could just process only a part of that huge list and maybe it wouldn't fail or take ages to refresh ?

Olivier

-----Original Message-----
From: Stefan Monnier [mailto:monnier@iro.umontreal.ca] 
Sent: Thursday, November 14, 2013 20:31
To: Maury, Olivier
Cc: help-gnu-emacs@gnu.org
Subject: Re: stack overflow in regexp matcher with gdb

> I tried with the 24.3 version of emacs and the gdb -i=mi interface. It 
> seems it works a little bit better (doesn't fail with that kind of 
> error). However when I do a "next" the first one is ok but the second 
> "next" is very slow and then it's ok again and then it's very slow 
> again, etc... and from time to time the gdb prompt is no longer 
> printed even though I can still enter gdb commands...

Hmm... performance bugs can be even worse to track down :-(

> Using gud-gdb with the 24.3 version of emacs seems even more weird as 
> it doesn't show the source files I've stop in...

That's odd as well: for me it does jump to the source.  `gud-gdb' should be the "safe fallback", so please report a bug about this, providing as much details as you can.

>   looking-at(",value=\\(\".*\"\\).*?}")

Indeed, this regexp is problematic.  Do you have some idea what the text can be between the quotes?
IOW can we use (looking-at ",value=\\(\"[^\"]*\"\\).*?}") instead (which would eliminate the backtracking), or is the a risk of the value containing a " somewhere (and if so, how is it quoted?)?

The 24.3 code is pretty different, but I see the same kind of regexp, so the same problem is probably present as well.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: stack overflow in regexp matcher with gdb
  2013-11-15 13:19       ` Maury, Olivier
@ 2013-11-15 14:18         ` Stefan Monnier
  2013-11-15 14:48           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2013-11-15 14:18 UTC (permalink / raw)
  To: help-gnu-emacs

> Well I'm not fluent in Lisp so it's difficult for me to really understand
> what it's doing.

My question was about GDB's behavior, regardless of what Emacs/Elisp might
do: in GDB's output can a " appear inside the ... of value="..." ?
If so, how is it quoted?

> I wish I knew more about Lisp in order to propose a fix...

I did propose a fix, which is to replace (looking-at ",value=\\(\".*\"\\).*?}")
with (looking-at ",value=\\(\"[^\"]*\"\\).*?}")


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: stack overflow in regexp matcher with gdb
  2013-11-15 14:18         ` Stefan Monnier
@ 2013-11-15 14:48           ` Eli Zaretskii
  2013-11-17 22:50             ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2013-11-15 14:48 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 15 Nov 2013 09:18:50 -0500
> 
> > Well I'm not fluent in Lisp so it's difficult for me to really understand
> > what it's doing.
> 
> My question was about GDB's behavior, regardless of what Emacs/Elisp might
> do: in GDB's output can a " appear inside the ... of value="..." ?

Yes.

> If so, how is it quoted?

With a backslash.  In general, the THING in 'value="THING"' is a C
string.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: stack overflow in regexp matcher with gdb
  2013-11-15 14:48           ` Eli Zaretskii
@ 2013-11-17 22:50             ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-11-17 22:50 UTC (permalink / raw)
  To: help-gnu-emacs

> With a backslash.  In general, the THING in 'value="THING"' is a C
> string.

Thanks, makes sense,


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-17 22:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 11:13 stack overflow in regexp matcher with gdb Maury, Olivier
2013-11-13 19:06 ` Stefan Monnier
2013-11-14 12:10   ` Maury, Olivier
2013-11-14 19:31     ` Stefan Monnier
2013-11-15 13:19       ` Maury, Olivier
2013-11-15 14:18         ` Stefan Monnier
2013-11-15 14:48           ` Eli Zaretskii
2013-11-17 22:50             ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).