Sending GDB commands into CLion - c++

I'm experiencing the Heisenbug on my program and this post suggested me to execute the command set disable-randomization off into GDB. However, I have no idea how to execute a GDB command in CLion and when I should do so. The GDB tab in the debugging remain uneditable when I try to copy paste my command.
How can I execute my command? Do I need to debug without CLion?

In debug mode, you can enter LLDB (presumably also GDB) commands using the following interface

Related

How to set breakpoint on all functions in a C++ file using VS Code

We can use following gdb command to set breakpoint in all functions in a file:
(gdb) rbreak file.cpp:.*
Is there a way to achieve the same feature when debugging from VSCode?
I am assuming that you are debugging in VS Code using the GDB debugger (and not the Visual Studio Windows Debugger).
GDB, LLDB, and LLDB-MI Commands (GDB/LLDB) For the C++ (GDB/LLDB) debugging environment, you can execute GDB, LLDB and LLDB-MI commands
directly through the debug console with the -exec command, but be
careful, executing commands directly in the debug console is untested
and might crash VS Code in some cases
quoted from https://code.visualstudio.com/docs/cpp/cpp-debug
as Alan Birtles said in a comment to you question, you should be able to enter the gdb command here

stepping through stl code in gdb

I'm working on a relatively old Centos system where I am restricted in the packages I can install. I needed a newer version of gdb, so I built that successfully from source in my home dir. This gdb steps through my code fine, but I am looking for trouble that is manifesting in the C++ allocator (mt_allocator.cc) and this new version of gdb can't step through that code. I can break successfully on a function there:
break '__gnu_cxx::__pool<true>::_M_initialize()'
but when that breakpoint hits and I try to step through the code, gdb tells me:
Single stepping until exit from function _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv,
which has no line number information.
I tried using the dir command within gdb to add the path to where mt_allocator.cc is, but that had no effect.
What do I need to tell gdb so it can find those files?
Ah, found it. The Centos package manager put the debug files for the STL code at /usr/lib/debug. So:
set debug-file-directory /usr/lib/debug
within gdb gets it done.

eclipse-cdt: how to suppress some GDB commands?

I have a remote GDB stub to which my GDB debugger connects over TCP/IP under the control of Eclipse-CDT. The debugger doesn't support set auto-solib-add command. So when I start the application Eclipse (among other commands) sends: -gdb-set auto-solib-add on command to the debugger and it responds with ^error,msg="No symbol \"auto\" in current context." That causes launch to fail.
I tryed to reset Load shared library symbols automatically flag under Run->Debug Configurations...->C/C++ Remote Application->Debugger->Shared libraries. But despite my expectations instead of ommiting the command it sent -gdb-set auto-solib-add off and it didn't work, too.
I need to find a way to influence Eclipse and make it suppress (or in general to gain the full control of Eclipse's behaviour) this command.
Or maybe it is possible to make GDB debugger reply with a warning instead of the error to this command?
Eclipse-CDT: Juno, 4.1.2
GDB debugger: arm-elf-gdb, 6.1
I checked CDT source and apparently there is no way to do it short of implementing custom GDB connector (or forking CDT).
This command is issued as a part of the "final launch sequence" - see org.eclipse.cdt.dsf.gdb.launching.FinalLaunchSequence:370. The reason it still sends the command when you uncheck the launch configuration box is to override whatever you may have in gdbinit.

Eclipse debug: "Error in final sequence - Failed to execute MI command"

I'm running Eclipse on win7. I want to make console applications that can run on either windows or linux. I followed the guide here on how to setup the compiler
I'm trying to compile and run a simple hello world program. It compiles fine, but when I try to debug I get the following error:
'launching test' has encountered a problem.
Error in final launch sequence.
Clicking details reveals the following information.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run. Try "help target".
Don't know how to run. Try "help target".
My gdb debugger path is C:\codesourcery\bin\arm-none-eabi-gdb.exe
I'm not exactly sure how to proceed.
If you're creating a windows console then I would think you would need gdb found in c:\minGW or wherever you have your Windows 7 gcc toolchain.
To change your debugger on Eclipse Kepler go to:
Run->Debug Configurations. Select Debugger tab and in the "GDB debugger:" field, enter the path of your Windows gdb.exe file (c:\MinGW\bin\gdb.exe if you're using minGW)
I realize this is an old question, but hoping it will help someone. In my case, there was a breakpoint set with only a memory address (no file name associated with it). Not sure how I got into this situation... Once I removed the breakpoint, I was able to launch my program with debugger. Note, I am using Eclipse Luna CDT (SR2)

How to run ndk-gdb after breakpoints attached

Ok i have put breakpoints in my native code and now i need to run, problem is i am having problems specifying target i guess. I have a Droid X on which i want to run app and use gdb to debug going thru breakpoints
type
(gdb) run ????? don't know what to type with run, saw target options but can't understand how to attach to device
Ok i figured myself,
Install and run the app on device
Under project go do a ndk-gdb
if everything is ok, and you get a gdb prompt, enter your breakpoints
and type c to continue, i forgot to see ndk gdb doc, it's simple really