I've been using Xcode 5 for a while now and I can't figure out how to debug into the STL source headers. The option "Step Into" (F7) just skips over the statement I would like the debugger to step into, and I don't find a setting to change this behavior. I remember people complaining about previous versions of Xcode where stepping into the STL sources could not be turned off... it's frustrating.
There is a setting in lldb that controls this:
(lldb) settings show target.process.thread.step-avoid-regexp
target.process.thread.step-avoid-regexp (regex) = ^std::
As you see, by default it is set not to step into anything in the std namespace. Just make a file called .lldbinit in your home directory, and put in that:
settings set target.process.thread.step-avoid-regexp ""
and we will no longer skip over functions in std.
Related
I am using VSCode to debug a C++ project configured and built using CMake tools (extension in VScode).
I have to use below command to trigger the execution:
./cbs_ta -i ifile.yaml -o ofile.yaml
As you can see, there are two command line inputs (-i and file name for input file) (-o and file name for output file). I read that using "args" parameter in launch.json, we can pass command line arguments. So I modified "args" in launch.json as follows:
"args": ["-i", "ifile_1.yaml", "-o", "ofile_1.yaml"],
Unfortunately, I am getting error that
the option '--input' is required but missing
I used CMake Tools extension to configure and build the targets.
Please help.
Edit: I have identified that when I click "debug" menu option in CMake in VSCode, the debug session starts but it does not take into consideration launch.json. I identified it since I kept ```"stopAtEntry": true''' but it did not stop at entry point.
It sounds like you have encountered the confusing 'extra' debug button which the CMake Tools extension places on the toolbar. The C/C++ extension's main debugger, configured via 'launch.json', needs to be invoked using the 'debug' view in the left side panel
(as do other debug extensions such as cortex-debug).
Once a debug configuration has been selected, a debug launch button is added to the status bar. This means that users of the CMake Tools extension will then have two different debug buttons on the status bar, which is confusing to say the least. Presumably in part because of this confusion, the CMake Tools extension has options which can be placed in 'settings.json' to remove the buttons it adds to the status bar, either selectively or all together. This is also a useful way to recover quite a bit of status bar real estate, if you don't often need to use things like the toolchain selector.
To remove all buttons added by CMake Tools:
"cmake.statusbar.visibility": "hidden"
And to selectively remove the debug launch button:
"cmake.statusbar.advanced": {
"debug": {
"visibility": "hidden"
}
}
I would expect most users to prefer the selective option, as things like the build target selector are fairly essential to most use cases.
The underlying issue here is that for some reason the CMake Tools extension does not use the standard extension point for debugging functionality, but instead just places an extra button on the status bar to invoke debugging directly without a configuration entry in 'launch.json'. The CMake Tools extension docs describe this as a 'quick' debug function, which suggests that their reason for this design decision is related to different use cases, although personally I can't really see a clear use case for it. Debugging is by its nature an activity which is highly dependent on configuration, as everything from the choice of actual debug program on down needs to be specified in most cases.
Every now and then my VSCode IDE does not highlight errors in my C++ code anymore. Reloading the window, restarting VSCode or re-installing the extensions does not help.
Example:
void some_func() {
int some_num = 1;
some_nmn++; // should give error, since variablename contains typo. No error indicated.
}
In terms of C++, I am using the extensions only C/C++, however I also use a couple of other extensions that are helpful in the context, like CMake and Code Runner.
Apparently there were two things wrong with my setup: I had the wrong standard and I used the wrong Intellisense Engine.
Change the Intellisense Engine by doing Ctrl + Shift + P -> Preferences: Open Settings (UI) -> Enter C_Cpp: Intelli Sense Engine in the search bar. In the drop-down menu select Default.
After that I got a lot of unnecessary warnings regarding std, e.g. namespace std has no member optional (see post).
I fixed it by changing the standard in my workspace settings. Ctrl + Shift + P -> Open Workspace Settings (JSON). Add this line:
"C_Cpp.default.cppStandard": "c++17"
Be aware that the first setting is global and the second setting is only for your current workspace.
Something else must be wrong in your settings, or maybe some conflict.
Now as you uninstall VS Code it's possible that these settings are not erased, you can check the folders where the settings are kept and delete the them if necessary, the default locations for the settings are:
For Windows:
%APPDATA%\Code\User\settings.json
For macOS:
$HOME/Library/Application Support/Code/User/settings.json
For Linux:
$HOME/.config/Code/User/settings.json
I simply want to include a C++ header file in KDevelop by writing
#include <file.h>
However, KDevelop automatically corrects the above statement to
# include <file.h>
I have not been able to figure out where I can change this. I want the first version, such that my files are similar to the other files in the project I am working on.
The file is type set correctly as a C++ file. I think the reason for the extra space is that KDevelop wants to indent the line because it is inside a conditional, i.e. a include guard as given below:
#ifndef THIS_FILE_H
#define THIS_FILE_H
// THIS_FILE_H
#endif
KDevelop also wants to indent the #define THIS_FILE_H line.
I have tried created my own indentation style by going to the Settings -> Customize KDevelop menu item, and then clicking on Source Formatter on the left. When defining the formatting style, I have disabled the indentation of preprocessor directives, nevertheless, it has no effect on the indentation of the #include and #define inside the include guard.
I know this is quite old but here is my advice, for future reference.
Go to Settings -> Configure KDevelop -> Code Formatter.
There you'll be able to see a dropdown the language you want KDevelop to format (C, C++, C#, Java, and whatever), the formatter ("Artistic Style" or "Custom Script Formatter") and a list of possible predefined styles plus buttons to customise your own.
Check whether you have selected one suitable predefined and try a few ones to see what happens.
KDevelop should stop adding the extra space after # include after this.
Question: does your KDevelop also adds a space after a #define as well?
Same Problem. So, I uninstall kate, then remove all config files in home directory whose name contains kate. Then I opened kdevelop and found nothing change. At last, Kdevelop->Settings->Open/Save->Modes&Filetypes, select Sources/C++ and Sources/C, change it to None, restart kdevelop. OMG, finally, the world is peace.
To conclude, the Sources Modes&Filetypes occur the problem.
The automatic spaces appear to be caused by the indentation mode, which (in KDevelop 4.7.1) you can switch for the current file via Editor -> Tools -> Indentation. If indentation is set to C++/boost Style, you'll get those weird automatic spaces while typing; while in mode Normal you only get the usual indentation at beginning of line.
The default indentation mode can be set in Settings -> Configure Editor -> Open/Save -> Modes & Filetypes. For each Filetype (eg. Sources/C, Sources/C++, Sources/C++11, Sources/C++11/Qt4) the Indentation Mode can be set independently.
KDevelop appears to remember the setting for files you have opened once; so for these files the new configuration settings have no effect. I don't know how to make KDevelop forget these per-file settings.
I'm trying to set my project include to the path %OPENCV_246%\..\..\include
This resolves to the path F:\dev\opencv_246\build\include
However, when setting the project includes, that path will not resolve and as a result the included headers break.
I've tried both %OPENCV_246%\..\..\include and $(OPENCV_246)\..\..\include with no luck.
Using the path directly fixes my includes, but I'd like to have a better way of managing the path through environment variables.
In the screenshot I've added both for clarity, If anyone could point out the step I'm missing here I'd appreciate it.
EDIT: Variable OPENCV_246 contains value F:\dev\opencv_246\build\x86\vc11
Dev studio won't recognize any environment variables that have been changed since it was started, so if you change one, a restart is required (of Dev studio, not the computer).
https://superuser.com/questions/107521/why-are-changes-to-my-path-not-being-recognised
This sounded similar to my problem, which was getting VS2013 to acknowledge a change I made to my environment variable (in my case QTDIR). Even after a restart and a shutdown, it obstinately hung on to the old value !! (you can see the value if you go to edit a project setting, hit the "Macros" button, and scroll down the list to find e.g. "$(QTDIR)" )
Here it suggest VS2010 cahed values heavily, but 2013 seems even more keen !
After some FindInFiles for the old path, it seems that VS2013 caches environment variables in your .vcxproj.user file. I have no idea how it got in there in the first place.
So I deleted the entry, closed the solution, checked the file again in WordPad to make sure the entry hadn't been put back in. Then I re-opened the solution, but the old value was still there in the Macros list !
Closing VS seems to have done the trick. Now it seems to have the right path - although I'm sure I checked after I first opened the solution and QTDIR wasn't in the Macros list at all - maybe I'm confused...
Well, it all seems to be working now, and my project builds and links to my Qt libs without complaints :-)
And, the entry in the vcxproj.user file hasn't come back. So I still don't know how it got in there. Maybe I did something to cause it a while back in a previous version of VS...
I am using code::blocks.
I set up the MSVC compiler(downloaded the MSVC Express 2010 Compiler and then added SDK directories).
The project does compile, however when I try to debug it ingores the breakpoints I set.
If I go Settings->Compiler->Toolchain Executables, the chosen Compiler is GDB/CDB : Default.
I guess the problem is gdb cannot debug msvc code. But how do I add a ne debugger?
In Settings->Debugger there is only one option of GDB/CDB compiler and I cannot add new one.
I tried adding additional directories, but it doesn't help.
So how do I make it work?
thanks
It's in Settings/Debugger and not in in Settings/Compiler/Toolchain Executables.
Got the same problem... I set path for cdb in code::blocks, ensured that the compiler added debug info, did everything I found on google (set Symbol Path to some weird stuff as described here: http://forums.codeblocks.org/index.php/topic,8454.msg63355.html#msg63355 and here: http://msdn.microsoft.com/en-us/library/windows/hardware/hh439323%28v=vs.85%29.aspx) - and still nothing. I didnt have any errors in debuger log, but it still wouldn't work. Finally - EUREKA: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Path_with_spaces
Breakpoints could not work if the path/folder you've placed your
project contains spaces or other special characters. To be safe use
English letters, digits and '_'.
After changing " " to "_" in directory names - everything works fine. And I lost only 5 hours for that...