CLion: how to build locally, copy binary to remote and debug it with - remote-debugging

Currently I run configuration "Build binary" in CLion, scp it to the remote machine, start gdbserver there for the binary, and then I switch to the "Debug binary" configuration and press the Debug button.
Is there any way to simplify/automate this in CLion? I can't even make the "Debug binary" call the "Build binary" configuration: since I'm pressing the "Debug" button, it will try to debug the "Build binary".

Related

CMakeListx.txt generated codeblocks project cannot stop in breakpoints

Ubuntu, I git clone https://github.com/NanoMichael/cLaTeXMath, and use below command to generate codeblocks project:
cmake .. -G"CodeBlocks - Unix Makefiles"
and the project created successfully, however, when I set breakpoints in the main function, and click Debug/Continue, the breakpoints cannot be stopped just like release version, the application can run very well, just cannot debug.
I checked some similar posts in stackoverflow like this, and check the project, there are totally five build targets (I cannot find where these 5 defined); when I open "Build Options", click one target(LaTeX), just cannot find "Compiler Settings".
Then I check "Settings"->"Global compiler settings"->GNU GCC Compiler"->Compiler settings, and check "Produce debugging symbols [-g]", and rebuild, but still cannot stop on breakpoints.
I am not familar with codeblocks, please help, thanks!

can't do remote-debugging with j-link in Clion IDE

I am trying to remote-debug a project in Clion but I can't seem to get a working debugging session. I think I've correctly launched my gdb server/client because my gdb client connects to the JLinkGDBServerCL.exe process
and they communicate.However, in clion, I can't break in the source code. The only thing that I get from clion is a disassembly of my program with no symbol at all which is odd because there is a symbol table in the .elf
that I am trying to debug. And one last detail, I can't "step in" the assembly code neither (but I can run commands in the gdb client in Clion).
Here is a picture of my debug configuration : debug config
And here is what I'm talking about when I say I can't get a proper debugging session : "debugging session"
Does anybody know what the problem is ?
System info:
OS: Windows 10
IDE: Clion 2018.1.6
GDB Server: JLinkGDBServerCL.exe
Target: TM4C129 (cortex M4) (no OS, just a firmware)
Program: USBMicroloader.elf (debug mode)
I'm having the same issue. I found that if I add the path to the elf file from the build directory into the "Symbol file" (in the run configuration where you set up the remote gdb connection), it fixes your issue. This seems a bit kludgey, but I haven't been able to find a better solution.
However, the next issue I run into is that I can only run that configuration a single time. When I stop debugging I get a message in the console that reads Remote doesn't know how to detach. Debugger disconnected. The clean and build menu options are greyed out until I restart CLion.

How to switch between debug and release Makefiles in Eclipse CDT?

For example I have 2 Makefiles: Makefile.Debug and Makefile.Release.
I can switch between them by setting different commands in:
C/C++ Build -> Builder Settings -> build command : make -f Makefile.Debug -j4 or make -f Makefile.Release -j4, but how can I switch between two makefiles in Eclipse GUI (Like in Visual Studio debug/release configurations)?
Create two Build configurations in Eclipse, each with a different make command.
Then, you can click the down arrow near the hammer in Eclipse's top bar to switch configuration.
Detailed steps:
Right click on Project, click Properties
Left sidebar, click C/C++ Build
Top right corner, "Manage Configurations..."
Add
Set "Name" and select "Existing configuration: xxxxx"
Ok
Ok
Switch between the configurations setting what's required (in your case, under the C/C++ Build section, in the "Builder Settings" tab, select "External builder" type in the "Builder type" combo, then deselect "Use default build command" and enter yours in the "Build command" field
Confirm with OK
Use the hammer
(I haven't a copy of Eclipse on this PC right now so I can't send screenshots, sorry.)

Trying to build Telegram (Desktop) from source

I'm trying to built the Telegram Desktop client from source using the instructions on Github. I'm up to this point:
Tools > Options > Build & Run > Kits tab > Desktop (default) > change
Qt version to Qt 5.4.0 (Qt-5.4.0) > Apply Open MetaStyle.pro,
configure project with paths
/home/user/TBuild/tdesktop/Linux/DebugIntermediateStyle and
/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateStyle and build
for Debug
I can open MetaStyle.pro, but I don't know what the instructions mean by "configure project with paths...".
Does it mean I have to add those directories to the INCLUDEPATH? The OBJECTS_DIR?
When you open a project file with Qt Creator, it first prompts you to configure the project. If it doesn't, select the "Projects" button at the left side of QtCreator and click the "Build & Run" tab.
Under the Build Settings header, choose which build configuration you want to change ("Edit build configuration: " Debug/Release).
For the Debug configuration, set the debug "Build Directory" as
/home/user/TBuild/tdesktop/Linux/DebugIntermediateStyle
If the field is grayed out, check the "Shadow Build" box.
For the Release configuration, set the release directory as
/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateStyle

Eclipse C++ MinGW - Can not Lauch Program <Terminated>

I'm a newbie in Eclipse.
I use Eclipse Indigo and MinGW to program C++. Create build a Hello word project is ok but i can run the program. It have been terminated when lanched !
This is the Build Log (Ctrl + B):
"
**** Build of configuration Debug for project Hl ****
**** Internal Builder is used for build ****
Nothing to build for Hl
"
This is what I get when press Ctrl + F11 to run :
"
"
anybody could tell me how to solve that problem ?
You need to make sure you include C:\MinGW\bin into the path environment
In addition, make sure that you don't include paths like this -> C:\MinGW\msys\1.0\bin
If you do so the built application will crash immediately!
The MinGW binaries must be in the %PATH%. I would not recommend to clutter the system's Path variable, unless mingw is your one and only tool chain. Instead, in Eclipse do the following:
open the run configuration of your executable (black arrow near the green one
run configurations ...
then select your exe
then go to the tab named "Environment"
press "New ..."
and add a variable named "PATH" with the content "%PATH%;C:\MinGW\bin" (or wherever your MinGW is installed to)
This worked for me on Eclipse Luna in 2016.