Author Topic: Ubuntu native GDB has terminated prematurely  (Read 1690 times)

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Ubuntu native GDB has terminated prematurely
« on: December 05, 2021, 02:30:55 PM »
I'm a long time SE user, but I've never connected the gdb debug features before.  Now I am working on a project that runs on Ubuntu 20.4 and I want to use gdb from SE.  I followed the outline given in this post:
Quote
https://community.slickedit.com/index.php?topic=185.msg680#msg680
The build command correctly uses the cmake generated Makefile, but my attempts to launch the Debug command all end with
Code: [Select]
"Error starting debugger: GDB has terminated prematurely". 
I am using the Linux version of SlickEdit Pro 2021 (v26.0.0.6 64-bit Qt4).  I'm using g++ 9.3.0.  The project uses Qt 5 and hence autogenerates versions of all of the source files after cmake creates the makefile.

The debug command I see in the build window is like this:
Code: [Select]
/home/chuck/slickedit-pro2021/bin/vsdebugio -port 8001  -prog  "/home/chuck/controller-ui/package/controller-ui/build/controller-ui" --no_hardware --port="/dev/ttyUSB0"
The file specified by the -prog argument runs when I simply launch it, even in the build window.  Launching the program using the default command line gdb also works. 

Where else might I look to find out what is wrong?

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Ubuntu native GDB has terminated prematurely
« Reply #1 on: December 06, 2021, 01:11:07 PM »
Try this:

1) From the SlickEdit command line:  set-var def_debug_logging 1

2) Debug > Step Into

3) Debug > Stop

4) From the SlickEdit command line:  set-var def_debug_logging 0

5) In your configuration directory, under logs, there will be a debug.log, post that here.
    The contents of the log file usually reveals why GDB terminated.

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Re: Ubuntu native GDB has terminated prematurely
« Reply #2 on: December 06, 2021, 02:24:57 PM »
Thanks Dennis.  Here's the log:
Code: [Select]
chuck@cu20:~/.slickedit$ cat 26.0.0/logs/debug.log
debug[2021-12-06T08:17:24Z]Connected to 'vsdebugio' process on port 26
debug[2021-12-06T08:17:24Z]Connected to 'vsdebugio' process using tty /dev/pts/2
debug[2021-12-06T08:17:24Z]GDB starting gdb: /usr/bin/gdb
debug[2021-12-06T08:17:24Z]GDB startup arg[0]=/usr/bin/gdb
debug[2021-12-06T08:17:24Z]GDB startup arg[1]=-nx
debug[2021-12-06T08:17:24Z]GDB startup arg[2]=-interpreter=mi
debug[2021-12-06T08:17:24Z]GDB startup arg[3]=-quiet
debug[2021-12-06T08:17:24Z]GDB connect, pid=88947
debug[2021-12-06T08:17:24Z]GDB connect, alive=1
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-inferior-tty-set /dev/pts/2
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]GDB connect: could not open tty, status=-5702
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-list-features
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]GDB event parser: Reply did not begin with ^ :
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-gdb-set auto-load off
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-environment-path -r /home/chuck/controller-ui/package/controller-ui/build/ /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/chuck/slickedit-pro2021/bin/
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-environment-cd /home/chuck/4193-controller-ui/douglas/package/controller-ui/build
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]======================================
debug[2021-12-06T08:17:24Z]  GDB command_reply: command=-file-exec-and-symbols /home/chuck/controller-ui/package/controller-ui/build/controller-ui
debug[2021-12-06T08:17:24Z]  GDB command_reply: timeout=0
debug[2021-12-06T08:17:24Z]      GDB event: error reading next event -5702
debug[2021-12-06T08:17:24Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T08:17:24Z]stopping 'vsdebugio' process

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Ubuntu native GDB has terminated prematurely
« Reply #3 on: December 06, 2021, 04:51:51 PM »
Looks like /usr/bin/gdb is failing to start.

First thing to verify is if GDB is even installed:
Code: [Select]
sudo apt install gcc gdb -y

If that is copasetic but debugging still does not work, the next step would be to try the GDB which comes pre-built with SlickEdit.

Debug > Debugger Options... > Configurations

Select "SlickEdit GDB" from the list and check
  • Default native debugging configuration.


If that still does not do the trick, the next step would be to check if you can use the command line GDB debugger (/usr/bin/gdb) from a Terminal (outside of SlickEdit), then also see if <slickedit>/bin/gdb will run from a Terminal (outside of SlickEdit). 

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Re: Ubuntu native GDB has terminated prematurely
« Reply #4 on: December 06, 2021, 05:09:51 PM »
Thank you.  Indeed, I've tried all of these. 
gdb is installed. 
I can run the program using /usr/bin/gdb from the build window or from a shell outside of SE.  Commanding "start" goes where I expect in the program.
I tried using the SE version of gdb.  It has the same result.  Here's the log.
Code: [Select]
chuck@cu20:~/.slickedit$ cat 26.0.0/logs/debug.log
debug[2021-12-06T11:02:10Z]Connected to 'vsdebugio' process on port 26
debug[2021-12-06T11:02:10Z]Connected to 'vsdebugio' process using tty /dev/pts/2
debug[2021-12-06T11:02:10Z]GDB starting gdb: /home/chuck/slickedit-pro2021/bin/gdb
debug[2021-12-06T11:02:10Z]GDB startup arg[0]=/home/chuck/slickedit-pro2021/bin/gdb
debug[2021-12-06T11:02:10Z]GDB startup arg[1]=-nx
debug[2021-12-06T11:02:10Z]GDB startup arg[2]=-interpreter=mi
debug[2021-12-06T11:02:10Z]GDB startup arg[3]=-quiet
debug[2021-12-06T11:02:10Z]GDB startup arg[4]=-data-directory=/home/chuck/slickedit-pro2021/toolconfig/vsdebug/
debug[2021-12-06T11:02:10Z]GDB connect, pid=89308
debug[2021-12-06T11:02:10Z]GDB connect, alive=1
debug[2021-12-06T11:02:10Z]GDB setting PYTHONHOME: /home/chuck/slickedit-pro2021/bin/python2.7
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-inferior-tty-set /dev/pts/2
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]GDB connect: could not open tty, status=-5702
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-list-features
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]GDB event parser: Reply did not begin with ^ :
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-gdb-set auto-load off
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-environment-path -r /home/chuck/4193-controller-ui/douglas/package/controller-ui/build/ /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /home/chuck/slickedit-pro2021/bin/
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-environment-cd /home/chuck/4193-controller-ui/douglas/package/controller-ui/build
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]======================================
debug[2021-12-06T11:02:10Z]  GDB command_reply: command=-file-exec-and-symbols /home/chuck/4193-controller-ui/douglas/package/controller-ui/build/controller-ui
debug[2021-12-06T11:02:10Z]  GDB command_reply: timeout=0
debug[2021-12-06T11:02:10Z]      GDB event: error reading next event -5702
debug[2021-12-06T11:02:10Z]GDB command_reply: error reading events, status=-5702
debug[2021-12-06T11:02:10Z]stopping 'vsdebugio' process

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Ubuntu native GDB has terminated prematurely
« Reply #5 on: December 06, 2021, 05:45:19 PM »
Try launching SlickEdit with a default configuration:

Code: [Select]
<slickedit>bin/vs -sc /tmp/defcon5

Then open the Sample GNU C++ workspace.   Project > All Workspaces > Sample Workspaces > cpp.vpw

And see if you can build, run, and debug the sample workspace.

I will try out my Ubuntu Virtual Machine and see if I can reproduce the problem you are having.

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Re: Ubuntu native GDB has terminated prematurely
« Reply #6 on: December 06, 2021, 10:34:53 PM »
Yes, that works.  The debugger opens the sample project.
If I then simply load my project I find that the build configurations aren't carried over and my project doesn't build.  SE generated a Makefile.  But this is a cmake project.  I want it just to use the cmake generated makefile.

It appears that some part of the configuration doesn't match.  Maybe I should try that cmake generator?

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Ubuntu native GDB has terminated prematurely
« Reply #7 on: December 07, 2021, 02:28:59 PM »
Instead of "Debug > Start" with your project, try "Debug > Attach Debugger > Debug Executable... (gdb)"  This will factor out the project build entirely.

Depending on the nature of the target you are debugging, you could also start the application outside of the editor and do a "Debug > Attach Debugger > Attach to Running Process... (gdb)"  This would factor out any shared library path issues.

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Re: Ubuntu native GDB has terminated prematurely
« Reply #8 on: December 08, 2021, 01:56:56 PM »
From a clean project I can start the debugger on my program.  I can set a breakpoint on a function in main.cpp and go to there.  Step into however doesn't find the source of the next function and the program just runs.  In any case, this is promising.  Next I'll try to set up a project somewhat differently to find out what matters.

ChuckInDodgeville

  • Community Member
  • Posts: 33
  • Hero Points: 1
Re: Ubuntu native GDB has terminated prematurely
« Reply #9 on: May 02, 2022, 01:03:05 PM »
I thought I'd close this out.  I gave up.  I think the issue is that my project is built with cmake.  I see the cmake patch, but my project is using a newer version of cmake and the barriers just seemed too high.  I get the feeling that C-Lion integrates more closely with cmake.  It would be nice if this part of slick could improve.  Specifically, show a way to debug a big application built from an existing cmake script.

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Ubuntu native GDB has terminated prematurely
« Reply #10 on: May 02, 2022, 01:08:59 PM »
For 26.0.2, I updated the GDB version shipped with the editor.  This could help you.  If you have not already downloaded and installed 26.0.2, give it a spin.