In QtCreator we can have a debug build and a release build configuration. And, for any build, we can modify the run time PATH environment variable to that it finds the necessary DLLs.
In the case of a debug build, we can start the application in debug mode. That seems not to read the PATH set for run time.
Or, putting it another way, the application doesn't seem to find the files one directory level above (../dir1) when debugging.
Where can I modify the PATH used while starting the app in debug mode?
Left panel: click Projects
This opens a sub-panel with Manage kits..., Active Project, Build&Run and Project Settings. Select Build&Run > (your kit) > Run.
This opens a Run Settings page. In Environment, unfold details. You can change env variables here or setup your own.
Related
My workspaces are located in my home directory.
I am currently trying to debug python code which loads a shared C++ library, using Eclipse Oxygen and PyDev. I can debug the Python files just fine.
I run the program (pytest unit test if that matters) with a breakpoint somewhere in the test before the shared library is called (but after it is loaded) and then run a C/C++ Attach to Application debug and attach to the paused python thread. I then set a breakpoint in my C++ code and resume python, and get this from the GDB console output:
No source file named /home/myname/.../models/sourcefile.cpp
Doing an ls /home/myname/.../models clearly shows that that file exists.
I'm not sure if this matters but my library was compiled with CMake where the source and build directory are siblings. E.g. workspace is ~/dev and source is in ~/dev/sourceFolder and build files are in ~/dev/buildFolder
Update:
I was able to attach to the running Python debug thread manually in the console using gdb python <thread_number>. This works and finds my source files just fine, allowing me to debug manually in the console. It would still be much faster and less cumbersome if I were able to get it to work in Eclipse.
Things I've tried in the C++ debug config settings:
In preferences, changing C/C++ -> Debug -> Source Lookup to have
absolute file path first, profile first, and relative file path
first
In CppDebug settings debugger tab, manually added build and source directory to shared libraries
In CppDebug settings source tab, manually added source directory in source lookup path
None of these seemed to do much.
For cmake projects:
The launch configuration can default to the wrong executable, so go to launch configuration => main and check the "C/C++ Application"
Change it from this: build/default/
to this: build/cmake.debug.linux.x86_64/
(you can do this with the "Search Project" button.
This will then pick up the correct debug version and all your source will be found when you debug.
I am trying to write a plugin for Notepad++ using Visual Studio Community 2013
The dll builds fine from the solution and if I copy it to the notepad++/plugins directory I can test out the functionality. However, I now want to debug it and I can't launch the debugger. I tried following a paint.net guide but I still get the error
Unable to start program .....dll
On my project properties under Configuration Properties - Debugging I have the following set:
Command = C:\tools\Notepad++\notepad++.exe
Working Directory = C:\tools\Notepad++
Configuration Properties - Build Events - Post-Build Event I have:
Command Line = copy "$(TargetPath)" "C:\tools\Notepad++\plugins"
NB: The path is outside Program Files to avoid UAC issues when copying.
What other options could be causing this issue?
Make sure you have a debug build of your DLL built with symbols enabled, and use the Debug -> Attach to Process menu command to attach to the notepad++ process once it's running.
It seems to be related to having multiple Configurations in the solution.
Deleting old and unused ones from the sln and vcxproj files cleaned things up. Then making sure that the configuration options were set to All Configurations fixed it.
I want to set debug=false while building a solution using msbuild in teamcity. Is there any parameter that I can pass so that while building in release mode it wont copy the debug symbols in bin directory. I tried using /p:debug=false but it didnt work. I don't want to use web config transformation.
Thanks
To not generate the pdbs then you need to pass /p:DebugSymbols=false;DebugType=None commandline
You can change the Advanced Build Settings in Visual Studio for Release build configuration.
Open project Properties, open Build tab. Press "Advanced..." button on bottom and change Debug info to "none".
I've got a makefile based project set up that builds my code on multiple platforms. On my Mac I want to use Xcode for debugging though. I've set up an Xcode as an External Build Project I can run the application from within Xcode. The output is shown in Xcode and if the app crashes it drops in to the debugger, but when running the debugger cannot locate the source files, so I just see assembly output. How can I tell Xcode where to locate the source?
I also cannot set breakpoints, but I think that this is all the same problem.
I was able to fix the issue of not stopping at breakpoints by setting a custom working directory for the executable.
Before this change I was able to build successfully using the external scons system from Xcode 4. My code would run when called from XCode but breakpoints would be ignored.
Then in XCode,
Go to Product -> Edit Scheme...
CHeck 'use custom working directory'
and I set this to the same directory as the executable.
Breakpoints then started working.
Ensure -g is included in the compiler options in the makefile.
Set a custom working directory in the scheme, set the executable if this hasn't already been set.
Ensure that the project isn't pulling in dylibs that haven't been compiled with -g. You might need a build step to run make install if the project builds dylibs as well as the main target.
Make sure that "strip" isn't being called. There are environment vars that xcode set that allow you to keep a working makefile when used outside xcode.
Just had this problem and this worked (Xcode 4.6) (got source debugging and working breakpoints)
In "Project Navigator" (the file-folder icon just below the "Run" button), right click and select "Add Files To your-project". Browse to the top level folder where you would normally run the external build, and click Add.
I have a Makefile that based on given target (all/debug) generates executable in release/debug directories on the project folder.
I have setup the Eclipse-CDT C/C++ build behavior mechanism to generate the right output depending on the active build configuration.
For example the "release" build configuration will call "make" with "all" as the behavior, that makes release/output file, "debug" configuration makes a debug version at debug/output
So far so good, but when I need to setup the "run configurations" I should enter the path for the binary (search project just does not show anything), Variable ${ConfigName} also does not expand there so I cannot use something like ${ConfigName}/output as binary to run/debug.
I also tried adding release and debug to the "Paths and symbols"/"Output location" and that not help either.
I can enter the relative/absolute path (for examle ./release/output) there and if I hit run, it runs the binary or if I hit debug it debugs it. However, because of the reliance on the path I have to have two launch configurations one for debug and one for release.
The problem is that run and debug configurations are basically the same only one has the option to customize gdb, which makes it very confusing. Regardless of whether it is debug or release active, one can run/debug any of the four combinations!
Is there anyway I can run/debug what actually is built? so if the debug build is active one can run/debug the debug build? I am not even constraining the debug build to be non-runnable or the release build to be non-debuggable, I guess that is asking too much. The problem is because of the two launch configurations, and I cannot find anyway to make it just one that depends on the build configuration.