GDB Eclipse not finding Source Files - eclipse

Recently I had a bug with my CDT eclipse application, so I downloaded GDB for debugging. It has brought me a lot of frustration. Finally, I have managed to properly install GDB, however when I try debugging my application, I get this error: No source file named /Desktop/workspace/TopVM/src/ShadowStack.h., as you can see there is an unnecessary . at the end of the path and it causes eclipse to freeze, so I have to force quit it. How would I go about fixing this?

as you can see there is an unnecessary . at the end of the path and it causes eclipse to freeze
This is not an unnecessary ., it is simply a full stop in the error message. It comes from GDB, probably this line:
throw_error (NOT_FOUND_ERROR, _("No source file named %s."), filename);
To fix the problem it would help if you identified if the problem is GDB or CDT, to do this, you can try running GDB without CDT and see if it freezes.
I assume you have found the following resources on setting up GDB on Mac (as I am guessing you are using?):
http://ntraft.com/installing-gdb-on-os-x-mavericks/

Related

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

Problem with lldb-mi and Eclipse on MacOs

I installed lldb-mi following the documentation. At the moment I have the executable in the directory "/usr/local/bin/lldb-mi", and when I launch it I get the following output.
I configured Eclipse for C++ to choose lldb-mi for the debugging. I have no errors, but debugging doesn't start. It just seems to build, how could I fix this?
Update: I launched the application from the terminal and when I start debugging it tells me: Unable to find full path for "/usr/local/bin/lldb". In fact lldb is located in the folder "/usr/bin/lldb. Is it possible to move the executable?
I copied the executable, but the dubugger still does not work....
Thanks in advance for the answers.

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.

All Eclipse C++ Programs Fail to Run, Hangs on "Launching Delegate"

A few days ago, Eclipse for C/C++ (Helios) stopped running my programs. They can be compiled with MinGW without displaying any errors. However, when the programs are run, Eclipse always get stuck at "Launching Delegate" at 70%. No matter how long I wait, the program never starts. The same happens when I try to run the program from the command line; no matter how simple the program, the command line just does nothing, as if it is waiting for the program to start.
I believed that this was just an issue with my Eclipse workspace, so I created a new workspace and tested a Hello World application, but it failed too. I reverted to an older version of Eclipse (Indigo), and a 32-bit version, but these had the same error. I even installed a different IDE, Netbeans, but it too never runs any programs. So, clearly, it's not just Eclipse. I tried reinstalling MinGW, but this also didn't help.
I have tried everything I can possibly think of. I could only find one other person with the same problem online, and theirs was never answered. Can anyone help me out with this strange issue?
I had the same problem. Always stuck at 70%. However, it turned out that somehow it can be fixed by disabling my anti-virus program, when I want to run a C/C++ program. Which I find to be quite strange.
I hope it helps.

Debugging QT project in Eclipse is very slow (Ubuntu)

I'm trying to debug a sample QT project in eclipse in Ubuntu. Launching debugger hangs at 93% for several minutes. Then every step of debugging is very slow.
I tried to debug a simple hello-world-program. Debugger flies. So, the problem is with QT.
Looks like gdb traces terminal prints a very very long PATH, can't see the beginning, ends with this:
...:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/lzo:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/raid6:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/raid6/test:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/reed_solomon:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/xz:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/zlib_inflate:/usr/src/linux-headers-3.0.0-13-generic-pae/lib/zlib_deflate:$cdir:$cwd
What can the problem be?
Apparently, the debugger is trying to load a lot of symbols for the said program (including Qt) and this may take quite a while (so, it's not Qt-specific.)