Clion gdb not found, but working with netbeans - netbeans

I've seen some other stakoverflow question like this one:
CLion Installation: Cmake compilers not found, GDB not found
But it's not quite the same problem.
My problem is that only my gdb.exe is not found by Clion. I can compile and run programs without problem, but when i need to debug the program tell me that only the debbuger is incorrect.
The problem is that my gbd.exe is present in my cygwin/bin folder
and i have it also in my PATH (system variable)
What i've done so far:
delete, shutdown and reinstall cygwin from scratch.
Install Netbeans and try to run with cygwin config (and debugger) -> everthing is working and i can debug my program. I also try to select it manualy.
So the real question is why Clion think my gdb is not present?
An how can i make it work?
Thank you for your help

Try to install GDB version 7.10.1
My settings:

Short answer: check what versions of gcc, g++ and gdb you have installed. They should be of the same major version.
Long answer:
Try to launch gdb.exe from cygwin terminal. You will probably get something like this (I'm using mingw64 from msys2 so folder will be different):
$ gdb
C:/msys64/mingw64/bin/gdb.exe: error while loading shared libraries: libgcc_s_seh-1.dll:
cannot open shared object file: No such file or directory
But you have gcc installed so you will have this DLL inside C:/msys64/mingw64/bin (in your case folder is different). The problem is that your gdb and gcc are of different major versions. I got this problem when installed mingw-w64-x86_64-gcc-7.3.0-2 with mingw-w64-x86_64-gdb-8.2.1-1. That's why gdb was not able to launch and CLion was not able to check GDB version thus outputting "Not found" error.
If this is the case - remove gdb and install it again. Now with correct major version (same as gcc). Since you're using cygwin, launch cygwin setup again, search for gdb package (don't forget to change view to full) and change version to be the same as gcc. Or, alternatively, you can change gcc version to be the same as gdb (in my case this wasn't possible).

Related

VS Code not running C

I can't for the life of me get VSC to run C programs. The code in question runs correctly on Replit.
Extension installed
GCC installed
(GCC file path was added to the windows environment)
I tried uninstalling and re-installing. And...
It says I need a C extension.
Does anyone have any idea why this might be happening?
You still have to configure vscode well, as said in the doc.
If C\C++ extension is installed it will be asked to configure it for debugging or building, just follow the documentation.
But it is still not running, execute your program in the terminal with the gcc command: gcc filename+extension -o filenameExe

Gdb stops when viewing variables in Eclipse

When debugging a c++ app, and hitting a breakpoint, gdb terminates the debug session when I click on a variable to expand its content in the Variables panel.
The displayed message is: <terminated, exit value: 0>gdb (10.1.90.20210103)
Printing the variable from the Debugger Console works correctly.
Debugging was working OK some weeks ago. The major changes that happen recently was a debian upgrade from 10 to 11 (bullseye), and an upgrade of the Eclipse version.
Activating gdb traces following where can I find GDB traces, I could see the commands sent to GDB, but no particular error before GDB stopped.
Any idea of what could cause this issue?
Eclipse Version: 2021-12 (4.22.0), Build id: 20211202-1639 running on linux debian bullseye.
I answer my own question.
After checking related answers, I suspect that the problem is linked to stl pretty printing in Eclipse (which was working fine before). I tried different version of Eclipse and gdb, and finally managed to fix the issue by using a previous version of gdb (8.3 instead of 10.1).
Here is the procedure that I followed (I'm not sure all steps are mandatory).
Reinstalled eclipse from scratch
Deleted the .metadata directory and recreated the eclipse workspace
Downloaded version 8.3 of gdb sources, and compiled it with python support ('./configure --with-python'). Note that libgmp-dev and python2.7-dev debian packages must be installed.
Copied gdb-8.3 somewhere under /usr/local/
Updated eclipse preference settings : C-C++/Debug/GDB and change GDB Debugger to the pach where gdb 8.3 executable was located under /usr/local/.
Checked in Debugger Console that the right gdb version is displayed. If this is not the case, you may have to set gdb using Debug As.../Debug Configurations/Debugger/GDB Debugger

debugging rust on Eclipse Corrosion no longer works on fresh install

I change my Hard drive and so I made a fresh Eclipse Corrosion install but I kept my Rust projets. Problem is I get an error when I launch my prog in debug mode. It seems to work in run mode but I didn't test this that much.
Error is
An internal error occurred during: "Launching my_prog".
Cannot read the array length because "launchConfigEnv" is null
Important note : it seems to be link with the use of an input file (debug configuration/common/input file)
I try many things, many installs, new projects, many, many things but nothing works (and I cannot figure out what launchConfigEnv is).
Any help welcome...
Edit : I install 2019.12 Eclipse and it works fine. I will work a little with this version and try out more configuration to shrink the problem.
As a workaround, add a single environment variable to the launch configuration, as follows:
Once that is done, re-launch it and it should work.
Note that in order to get rust debugging working in Eclipse I installed MSYS2 and the following MSYS2 packages.
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S man
I followed some instructions in the Rust Corrosion Trouble Shooting guide to get a working GDB.
Reference: https://github.com/eclipse/corrosion/blob/master/documentation/Troubleshooting.md#debugging-on-windows
The Rust debugger command needs to be changed to rust-dbg.cmd, as follows:
However, the PATH environment wasn't working for me, so in the rust-gdb.cmd script I added this near the top:
SET PATH=%PATH%;F:\msys64\mingw64\bin;F:\Data\.cargo\bin
(Adjust as-per your installation of MSYS2 and Cargo/Rustup)
After which Eclipse was able to start a debug session and stop at a breakpoint.

Re-locate GDB debugger on MacOS high Sierra / eclipse

In brief: How do I change the path to gdb to point to the right location?
Details
I know this topic is a quite common one, but I am desperate. I installed eclipse CDT on my MacOS High Sierra. Then after some time of searching I found out how to install the GDB debugger including code-signing. So I installed gdb 8.1 at /usr/local/bin (forgot which method I exactly used). It all seemed fine (gdb --version in console etc.) but then I found out that gdb 8.1 does not work under MacOS.
The way out of my dilemma seemed this post: https://stackoverflow.com/a/49104154/1552080
which created a parallel installation of gdb at /usr/local/Cellar/gdb/8.0.1/bin.
I did all the code signing stuff and entered the path to gdb 8.0.1. Furthermore I entered the new path in the eclipse debugger settings and modified my .bash_profile to point to the 8.0.1 location.
Nevertheless, eclipse seemed to point to the gdb 8.1 location /usr/local/bin. That's why I deleted the 8.1 gdb executable. Since then I always get an error message:
"Error with command: /usr/local/bin/gdb --version Cannot run program
"/usr/local/bin/gdb": Unknown reason"
Obviously, eclipse still looks in the wrong place for a debugger.
Maybe it is important to mention that when installing gdb 8.1 I did some trick in the save mode (see point 14 of https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d)
any help appreciated
2018-05-13, Update: the error above still persists after I copied the gdb 8.0.1 executable to the location /usr/local/bin

gdb not showing code within emacs on Windows

I asked a question just yesterday which caused this new issue. gdb within emacs on Windows
Basically I was installing a QT sdk which asked me to uninstall MSYS which I did & I hosed my emacs/gdb interaction.
Here is the gdb_init file that I'm using. Before the uninstall of MSYS this worked fine. Now after it, the breakpoints are working but I am not getting my code in another window with the little red dot on the left margin for a breakpoint.
file ~/../sandbox/trunk/current-win32/debug-bin/sm.exe
dir ~/../sandbox/trunk/src/mgr/view
dir ~/../sandbox/trunk/src/mgr/view/appstatus
dir ~/../sandbox/trunk/src/mgr/controller
break widget.cpp:176
break book.cpp:72
break TcpClient.cpp:660
break mainwidget.cpp:1474
The steps I'm running in emacs
M-x gdb
source ~/gdb_init
run
(It will break but not give me the code along with the breakpoint)
Any ideas what I'm doing wrong?
It turns out I was using the Cygwin version of gdb and had that in my system PATH. For some reason that didn't work out and I was getting errors in gdb within Emacs. Once I installed MSYS(mingw) & the gdb install on their download page and put that in my system PATH then I was back up and running.
I had the exact same problem: windows emacs, cygwin gdb, and the source buffer did not update with the "=>" pointer to show the code location. Downloaded mingw gdb.exe from here: http://sourceforge.net/projects/mingw/files/OldFiles/and selected that gdb with M-x gdb and it worked perfectly.