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.
Related
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
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
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).
I'm having difficulties with gdb under emacs 24.
I compiled my c code with the -g switch, and the symbol table loads in gdb.
The problem I'm having is that no source code is shown when I load my application, no breakpoints are visible. I guess there appears to be no connection between the source code buffer and gdb buffer.
I have used gdb under emacs before (emacs 22, and 23) and it worked well and now it doesn't.
I also tried it under emacs -q so no plugins are loaded in case my .emacs was at fault, no joy.
Just to recap (so I don't get "compile with -g" answers):
I compiled with -g I loaded emacs with no plugins
I used annotate=3with gud-gdb
I even tried gdb-mi (doesn't work at all, didn't pursue
this road any further)
Gdb ain't working with source code showing (with breakpoints).
What can I do to fix it, or at least how can I find out what's wrong?
M-x gud-gdb is not for use with annotate=3 but with --fullname (aka --annotate=1, IIRC).
Try M-x gdb with -i=mi instead of --annotate=3.
Then it worked for me, but it's damn slow in my case :/
When did you build Emacs 24? There's been a lot of churn in the gdb/gud area from emacs-devel. If you repro problems in the latest (i.e. today's) build, report bugs ASAP. The pretest is coming to an end very soon.
I'm running Emacs 22.3 in Windows. Earlier today I had gdb working within Emacs just fine. I was installing QT4 and during the installation it asked me to uninstall MSYS which I quickly clicked through not thinking about things. I think I had gdb installed with the MSYS package and Emacs was using that, but I'm not completely sure. Now when I run the following I get an error in the mini-buffer.
M-x gdb
"Searching for program: no such file or directory, gdb"
I tried to add the path "C:\cygwin\bin" to the Emacs load-path with this code but I still get the same error.
(message "Adding cygwin/bin to load path.")
(add-to-list 'load-path "c:/cygwin/bin")
Could someone tell me what I'm doing wrong?
Thanks.
probably adjust your system path to point it where you have gdb installed.
Try using /cygdrv/c/cygwin/bin