Eclipse CDT Debugging and general workspace configuration - c++

I've been working on some code for some time now (bitcoin's source code), the building system is GNU Autotools.
I'm having some problems debugging the code. I'm working with eclipse on OSX Mavericks, building the project works great but when i go to debugging prospective i'm having some problems:
Many breakpoint cannot be installed
Some breakpoints that can be installed cause a source not found error
Cannot debug header files
A specific example is when i'm trying to debug step-by-step some of the unit tests, i can't seem to be able to step in functions.
I did: ./configure --with-miniupnpc --enable-upnp-default --with-qrencode --enable-debug so to include debugging flags.
Anyone care to share how he setup his workspace or how to resolve those problems ?
ANYONE ???

Related

Android Studio debugger doesn't work in C++ code

I don't have much prior experience in Android Studio. I'm trying to debug a problem in C++ code. Djinni and ninja are used in the product. I know that the same setup with zero additional tweaks is debuggable at another machine.
But on mine, the debugger doesn't want to stop at C++ breakpoints at all. Sometimes it shows "no executable code is associated with this line" message. Other times the breakpoints are just plain red without a check mark.
Debugger log says the debugger is attached.
I don't see the "app/.cxx/Debug" folder, only the "Release" one (the other machine also has only "Release"). Build.ninja files contain release flags for cpp code. Via the search in all files in the project directory, I did not find the set of debug flags that are used in CMakeLists anywhere among the build artefacts.
It seems like I tried everything that I found on SO:
checked for correct build variants
checked jni debuggable true, minify enabled false, empty proguard file
tried different debug types in Run/Debug config -> Debugger (however idk which symbol directories to add manually)
tried debugging in an emulator as well as on a real device
in the emulator, uninstalled the app and did cold boot
used the same Studio version as on that other machine
used the latest Studio version, and the newest preview
cleared caches, cleaned, refreshed linked C++ projects
made clean Studio reinstall with prior deep cleaning of all Gradle and Android files via Terminal
upgraded Gradle
use the same NDK version as in build.gradle
added NDK dir to local.properties manually
tried using "make module app" instead of simple "make" command
Nothing helped so far. Only once after a crash the execution stopped and showed an assembly line with a simple call stack, without details.

Eclipse debugging error with 64 bits libXL

When trying to debug this Eclipse CDT Project compiled with Mingw-w64 (build-info.txt) and clicked Debug as Local C/C++ Application, the following error is shown:
Reinstalling Mingw-w64 didn't fix the problem. A sample Hello World C++ Project compiles and debugs as expected but for any reason this Project doesn't. Maybe it has to do with the fact that it utilizes the libxl-3.6.2.0 dll from bin64 folder to read an excel file.
Eclipse configuration:
Eclipse Mars.1 (4.5.1)
C/C++ Development Tools 8.8.0.201509131935
C/C++ GDB Hardware Debugging 8.8.0.201509131935
C/C++ Library API Documentation Hover Help 4.1.0.201509161915
Debugging became possible just adding the 64 bits dll inside LibXl folder bin64 to the Debug folder (where the generated executable was created). This solution insight came from #smurff1975's comment in the following thread.

xcode 6.3.2 external build

I'm trying to compile an existing c++ project, originally developed on linux with gcc. The only external library is GSL (GNU Scientific Library). I have created an external build tool project to use xcode's debugger, but I currently have two issues.
1) When I try to build in xcode it fails with the error 'gsl/gsl_matrix.h' file not found. I have added /usr/local/include to the HEADER_SEARCH_PATHS and confirmed that there is a gsl folder in that location, which contains all of the header files (installed with brew). However, if I type make in the CL then the project compiles without any errors, so I know there isn't an issue with my GSL, the makefile or the switch from gcc to clang.
I've looked at Xcode 6.3.2 unable to build or run projects, and updated my xcode CL tools just in base, but I was already on the latest (2339).
2) While it would be nice to build from within xcode, it's not the end of the world if I have to build from the CL everytime. Once I've compiled everything I can run it from xcode, however, none of my breakpoints are hit. I have set the executable and the custom working directory in my debug scheme (as indicated by Run C program in Xcode 4 using makefile). I've also looked through Why aren't my breakpoints working? and haven't found anything that works.
I thought it might be operator error since I'm running the target with Product->Run, but I don't see any option to specifically start debug mode like intellij. I'm also able to pause the code and the debugger view comes up, but when I pause it just shows me the assembly instructions.
Well I've figured out both of my issues.
1) In the external build tool configuration I had to uncheck 'Pass build settings in environment'.
2) I'm a bit of an idiot here...I'd tried adding -g to my $(FLAGS) variable, but realized that was only applying to my executable. I modified the makefile to compile every single source file with -g and then breakpoints stopped on the source code (as opposed to disassembly).

using gtest with xcode

I'm trying to set up a c++ unit testing library on my computer and figured that google's gtest would be a good fit.
I am currently running mountain lion with the most recent release of xcode.
I have been attempting to follow the instructions found here but am running into an intresting problem.
I am opening the gtest project, building it, and even though xcode tells me that the build was successful, I cant seem to find the framework anywhere. any help on this subject would be highly appreciated!
Thank you!
This worked for me:
Get the code from https://github.com/dmonopoly/gtest-cmake-example
Run the cmake GUI in the usual way (I used version 3.0.0). Hit "Configure", one of the prompts allows you to choose XCode generation. Hit configure again, Enable the "test" config option, hit configure again (and maybe even once again), then hit "Generate".
You should now be able to find the XCode project in the build directory that you specified. Open that project, and you will find the gtest source code, some demo test code, as well as a target for running the tests.

Configuring Eclipse for MinGW

I am using Eclipse Juno with MinGW (latest version) on my Win7-Laptop.
My example code is successfully built within the IDE, but I can neither run nor debug it!
When I choose Run as=>Local C/C++-Application, I get
Launch failed. Binary not found.
However, there IS an exe-file as a result of the build process!
When I call cmd.exe, navigate to the source directory and call this built exe (a.out.exe), it works without problems!
I guess this is due to wrong/missing configuration of eclipse, but I couldn't find useful info on that so far.
This thread mentions environment variables. I added MinGW and Msys to my PATH variable (that's why I can compile) but I can't run my software in eclipse!
So, what can be done to enable debugging?
I have made a little tutorial.
how to set all for Eclipse have a look it's here https://stackoverflow.com/a/12169583/1322642
Hope it can help you a little bit.