I am debuging a C++ program with gdb on windows using Mingw, But when I type layout command in gdb interactive command line:
(gdb) layout asm
Undefined command: "layout". Try "help".
the layout is not exists, how to fix that?
It seems that gdb TUI support was added to mingw in this pull request https://github.com/msys2/MINGW-packages/pull/1869. Try to update to a latest version of mingw or build gdb package yourself with patches applied from https://github.com/msys2/MINGW-packages/pull/1869/files.
Related
So I tried to check Mingw-w64 tools are correctly installed and gcc, g++ were correctly installed but gdb wasn't. I'm planning to usE Visual studio code in windows 10.
In the https://code.visualstudio.com/docs/cpp/config-mingw#_run-helloworldcpp, it said to match PATH entry but when I went to C:\msys64\mingw64\bin directory, the file was empty. Did I miss something or how do I know the correct path to put in the environment variable?
I tried C:\msys64\mingw64\bin as both user variable & system variable path but it won't work. and it said command not found.
This is what it said.
$ gdb --version
bash: gdb: command not found
Try installing GDB by running this in your Bash shell:
pacman -S $MINGW_PACKAGE_PREFIX-gdb
I installed Eclipse Oxygen CDT on Ubuntu 16.04. I am using the default gdb installed.
When I try to launch the debugger in eclipse, I get the following error:
Error with command: gdb -version
I suspected that this could be because eclipse was unable to find the gdb program, so i mentioned the whole path of the gdb program in the "Preferences =>C/C++ => GDB" options.
Still the error persists. Can anybody tell me how I can fix this error? Thanks in advance for your help.
check gdb version from c:\MINGW\bin\gdb32.exe "I have this version"
then got Eclips >> Preferences >> C/C++ >> GDB
then in GDB path "First block" click browse then insert the GDB path
Done ^-^
Whenever I try to debug any program (i.e. a welcome message), I get this prompt. Any ideas how to run the debugger for C++ program?
I am using Macbook Pro OS X El Capitan (10.11.3)
For Mac OSX 10.5 and above,
Install Homebrew (if you don't have it already)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install GDB
brew install gdb
Go to https://sourceware.org/gdb/wiki/BuildingOnDarwin and follow the instructions to code sign the gdb binary.
If you're on Sierra, run the following command in your terminal
echo "set startup-with-shell off" >> ~/.gdbinit
Finally, run the following comamnd in your terminal
which gdb
Copy the output path from that command, (mine was /usr/local/bin/gdb) into the Debugger Command box in Netbeans and start debugging!
On Linux systems derived from debian, you have to install gdb
sudo apt-get install gdb
Then in debbuger command type
/usr/bin/gdb
More information of gdb can be found in GDB: The GNU Project Debugger
Make sure gdb is installed in your machine. you can do this by following
C:\cygwin64>setup-x86_64.exe -q -P gdb
after this, select gdb as a debugger in netbeans
gdb location
Use Synaptic to install gdb. This debugger is required for Netbeans.
On a Mac, I installed HomeBrew first, then followed this exactly on the Sierra OS. Worked perfectly. After Homebrew is installed, you have to create then sign your gdb certificate. Then select it in your IDE debugger section.
The instructions show how to select gdb in Eclipse, but I got it working in NetBeans by pushing the debugger button and typing in the file path in the popup (as mentioned in this document).
https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html
I have a C++ project imported to Eclipse CDT. I can build and run the project using Makefile and argument settings. However, when I tried to add a debug point and run "debug as local c/c++ application", it throws me an error of "Launching projectName" has encountered a problem. Error with command gdb --version
By expanding the Details, it gives: Error with command: gdb --version
Cannot run program "gdb": Unknown reason
I installed the gdb by Macports before. If I enter command ggdb it returns the version info. If I type which ggdb, it gives /opt/local/bin/ggdb. I tried to add "PATH" to debug configuration -> environment variables and give the path value to it, but it did not work. How should I set the path and link the path please? And what should the variable name be.
The gdb version on my machine is GNU gdb (GDB) 7.7.1
Added: I looked up which ggdb and used the link James provided to change gdb debugger to browse to that path. But it did not work still.
Thanks.
It looks like Eclipse is using the default gdb that was on the system before you installed ggdb from macports. This link shows how to change the debugger settings, change it to ggdb which is the name Macport uses.
After installing ggdb from Macports you will have to sign it with a certificate so it will be allowed to control other processes, take a look at "Certifying GDB" here. After creating the certificate, make sure you select the correct name when signing:
$ codesign -s gdb-cert $(which ggdb) /// 'ggdb'
I'm writing a program that makes extensive use of vectors and am developing with Qt Creator 2.0.1 on Mac OS X 10.6.6 for the first time.
As I am debugging, I can see literals and arrays just fine in the Locals and Watchers window, but as soon as I go to expand a vector, in this case of type Student, I get this tree:
The other person I am working with on this is using the same version of Qt Creator on Ubuntu and can see the contents of the vectors just fine. What am I doing wrong?
This is his debugger:
QtCreator 2.6 has support for Mac FSF GDB (7.5) support. FSF GDB supports python which allows qtcreator to properly display QVector, QSet, QList, QString, etc. It can be download from macports.
Download and Install macports (download it from here http://www.macports.org/install.php)
To install FSF GDB 7.5:
sudo port install gdb
Give FSF GDB permission to debug applications:
sudo codesign -s gdb-cert /opt/local/bin/ggdb
If gdb-cert isn't found, create a gdb-cert by clicking on the link below, and follow the directions for "Creating a certificate":
http://sourceware.org/gdb/wiki/BuildingOnDarwin
If you don't give permission to ggdb, you'll get a:
Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
Change the kit debugger in QtCreator
Change the path from /usr/bin/gdb to /opt/local/bin/ggdb
By default FSF GDB fails to handle breakpoints correctly because mac clang++ doesn't export debug symbols. To export the debugging symbols, dsymutil needs to be run manually. Luckly, dysmutil command can be run automatically after link the program using qmake. Add the following lines in your .pro file:
macx {
CONFIG(debug, debug|release) {
QMAKE_POST_LINK = dsymutil \"MyApp.app/Contents/MacOS/MyApp\"
}
}
You need to build the debugging helper. Should be under Tools -> Options ...
Once the debugging helper is built, you can visualize std::string, QString and containers as well.
There should be a rebuild button in same the place as where you choose which version of Qt to use.
http://www.qtcentre.org/threads/31862-quot-No-valid-Qt-version-set.-Set-one-in-Tools-Options-quot-Windows-QtCreator
The two answers are sort of right: one cannot use the python based debugging helpers on mac, still there is a C++ version of it that works with Apple's gdb.