Author Topic: "GDB has terminated prematurely" message when using "Step Into"  (Read 8024 times)

jaykay

  • Community Member
  • Posts: 17
  • Hero Points: 1
Hello,

when I step through my application using "Debug->Step Into" I get  the following message:
"Debugger stopped: GDB has terminated prematurely".

In that state my application continues to run. I also can attach the debugger to the running process again.

The error occurs when I step into a certain function from inside my shared library. The function that is being called delegates the call to a global c++ object which in turn delegates the call to an internal member object.

When I step through the application with gdb there is no problem.
It seems to be an (annoying) gdb integration problem of slickedit.

My Environment
- SlickEdit 11.0.2 for Linux
- Intel Celeron 400MHz, 256 MB

My application (c/c++ project)
- executable and a shared library
- shared library
- shared library uses pthreads

Please Help.

Regards

JayKay

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: "GDB has terminated prematurely" message when using "Step Into"
« Reply #1 on: May 01, 2007, 10:40:45 pm »
This is a very common error that people encounter, so let me take a few moments to address it.

First, the best thing about that error message is that it tells you exactly what happens, in a very polite way.  We don't just come straight out and say, yep, "GDB crashed, ... again".  We politely let you know that for whatever reason, GDB can't handle it's lunch and "terminated prematurely."  Because, that is exactly what happened.  This is not a problem with our integration.  This is an unfortunate problem with the stability of GDB.

In most cases, you can circumvent the problem by turning off the "Autos" tool window, which is one feature of our debugger integration that expects GDB to handle errors correctly, ..., without that whole crashing bit, because crashing is, at least in my opinion, a rather restrictive way to handle errors.

It probably sounds like I'm coming down on GDB pretty hard here, but even with it's pecularities, it is still the very best free debugger available for the world of Unix.  Our integration with GDB pushes it a little harder than some other GDB front ends, and unfortunately, in certain circumstances this exposes holes in GDB's overall stability.

You could argue that our debug Autos tool window should not send any invalid expressions to GDB, then GDB wouldn't have any problems.  The expressions are simply surfed from the lines of code in proximity to the execution pointer.  We are getting these from actual source code, which we can't really make a ton of assumptions about.  The most logical thing is to take them at face value and expect GDB to not crash if we give it an identifier it doesn't recognize.

Anyway, let's say you have turned off "Autos" and GDB is still giving you fits.  Here is what to do to further investigate the source of GDB's frustration.

1) Go to Macro > Set Variable ...
2) set def_debug_logging to 1
3) Start you debugging session and do whatever you do until GDB terminates.
4) set def_debug_logging back to 0
5) look in your configuration directory, there will be a file named "vs.log".  Jump to the bottom of the log file and find the last command that was submitted to GDB.  That's where GDB died, now you have a starting point to see if there is a newer version of GDB that fixes that bug, or maybe nag someone to fix GDB or maybe you can figure out that you can avoid that command by closing a tool window such as the threads, members, locals, or watches tool windows.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: "GDB has terminated prematurely" message when using "Step Into"
« Reply #2 on: May 02, 2007, 11:02:11 am »
I'm not sure (maybe I messed up my SE installation a bit), but another reason could be that some CYGWIN DLLs  needed by gdb are not found if the PATH doesn't cover the CYGWIN bin dir e.g. on Windows platform.

HS2

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: "GDB has terminated prematurely" message when using "Step Into"
« Reply #3 on: May 02, 2007, 02:49:15 pm »
The only DLL necessary is usually cygwin1.dll.  And if that is not available, there will be an immediate failure, since GDB will never even start.  We do not distribute cygwin1.dll because earlier versions of it were sensitive to there being multiple copies of cygwin1.dll in your path.

I recently looked again at using MINGW's version of GDB, in order to relax the dependency on cygwin1.dll, but their version of GDB lags far behind behind mainstream GDB (about 2 years behind).  However, I did find that the most recent MINGW GDB does work with SlickEdit.  An installation package for Windows can be downloaded from: 

http://www.mingw.org/download.shtml --  gdb-6.3-2.exe

Depending on what rev of the GCC tool chain you work with, that may be a very valid alternative for the anti-cygwin crowd out there.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: "GDB has terminated prematurely" message when using "Step Into"
« Reply #4 on: May 02, 2007, 03:06:23 pm »
Thanks for this information Dennis ! Unfortunately it's too old for my tasks, but it's a good hint for others.
One reason why I don't include the CYGWIN bin path to my default PATH is that I curr. have to use/maintain 2 CYGWINs...

HS2

BTW: Seems that the curr. v12 gdb also needs cygiconv-2.dll + cygncurses-8.dll (besides cygwin1.dll of course).

jaykay

  • Community Member
  • Posts: 17
  • Hero Points: 1
Re: "GDB has terminated prematurely" message when using "Step Into"
« Reply #5 on: May 09, 2007, 11:41:46 am »
Hello Dennis,

thanks for your detailed reponse :-) I already got help from SlickEdit support (1 week ago)  which told me the same. I'm sorry for not posting a reply but I had no time to look into this forum for the last view days.

When I hide the "Autos" (automatic variables) window, the problem disappears.


Thanks again for your efforts


Regards

JayKay