Is there a plugin for Vim that would help me debugging like Visual Studio? - c++

The reason why I'm asking this, is because I'm coding in C++, in putty/ssh and I like the fact that I can code from pretty much everywhere without having to install anything.
So I'd like to have something that could help me debugging (viewing LIVE value of a variable, breakpoints, etc)
If you think that there's no such thing in this world, is there any good technique I could use to debug in command line?
Thanks

I've used gdb for command line debugging in the past with success:
http://www.gnu.org/software/gdb/
A decent tutorial can be found at:
http://www.cs.cmu.edu/~gilpin/tutorial/

vimgdb will give what you want. I've used it for about one year. The most interesting feature is:
Hightlight current line
List item
Can show disassembly code
Step into, Step over
inspect variables, memory address
Run all the underlying gdb command is possible
And, of course, set breakpoint, conditional breakpoint etc.
Highly customizable by vim key mapping and scripts.
Actually I use checkinstall to make an rpm for it, and installed it everywhere when I need to debug on the box.
I think it have the most important features I want from a visual debugger.

Have you tried gdb ? That's pretty much the command line debugger, but it's no vim plugin.

You have a script to do that: http://www.vim.org/scripts/script.php?script_id=1954
In my humble opinion, Vim is not designed to do such things and it is a bad idea to do so.

Related

Xcode project won't display std::string in debugger anymore

I have an Xcode project that will not display C++ std::strings when I am debugging. It's incredibly frustrating because I am having to resort to print statements or outputting each character one at a time in the LLDB console window, which is time consuming and hard to read.
Every other person using this same project is having the same problem, and other projects are not seeing this problem, so I would think that this is a project setting of some kind. I'm in debug and there are no optimizations turned on, so I've eliminated that as the issue. I've also compared project settings between working projects and the one with this problem and they appear identical in every way that they can be.
Here's a sample of the output I get, *_M_p in this example is correct, the first character of the string is a question mark:
And here's what I get in the debug console if I inspect the string one character at a time:
I've heard that switching back to GDB from LLVM might solve the problem, but GDB gave me other issues with debugging certain data types, so I'll just have new problems in that case.
My co-worker figured out the fix for this: Turn off the Guard Malloc option in the scheme settings.
Click the scheme that is exhibiting the problem
Click on Edit Scheme
Click on Diagnostics
Uncheck the 'Enable Guard Malloc' option.
Now std::strings should be showing up. We don't know why this is the case, it may be a bug in Xcode, but I would think it would've been spotted awhile ago. Also, this was tested on multiple projects and enabling Guard Malloc always causes std::strings to not show up properly in debugger.
Try this lldb command
exp -f s -- myString
You are telling the lldb to show the expression of your string with the format c String
This might not have caused the original poster's problem, but it caused mine: I was using Xcode 6.4 while most of the code had been built with 6.2. Switching to 6.2 made the values visible in the debugger.
Try this command
po string_name

Netbeans - copy highlighted regex search results

I made a simple regex search in Netbeans 7.3 on Windows (using Ctrl+F):
\{\{.*?\}\}
The results get highlighted correctly and the question is - how to extract highlighted text search results? Let it be copying to clipboard, saving as file or whatever else.
Is there any method doing this?
Maybe someone has any suggestion of alternative quick approach to such task in Netbeans? (or other editor)
What OS are you running? If OS X or Linux, read on!
I'm not sure about automatically copying the highlighted results to the clipboard, but I do workaround this quite a bit as well.
The easiest way to accomplish this for me without leaving NetBeans is to simply open a built in terminal window through Window>Output>Terminal (in 7.2.1) - I then navigate to my project, and run the RegEx that I built in the Find feature with my tool of choice. In fact, I use the built in terminal for this type of quick stuff in NetBeans quite a bit. If running Linux, using clipboard tools like xsel (http://linux.die.net/man/1/xsel) in combination with a built in terminal emulator can allow for devising some nice workflow shortcuts within IDEs if you are more comfortable working/coding at a terminal. Note that built in terminal emulators like the one in NetBeans is likely not going to play nicely with cut/copy/paste using the mouse, for various reasons that I won't get in to here.
As far as a built in/extension based solution for something like this, it would be helpful! I am not aware of one.
Hope this workaround helps in the meantime.

DBGP Implementation C/C++

Is there a Library that implements XDebug's DBGP in C/C++?
I'm interested in wrtting debugger and if such library exists will save me a lot!
I want to add the debugger to my editor coded in C++ Language but it is an editor for PHP Files.
None Exists. There was one from GSOC (App not a library) but I cannot take time to read and convert to my needs plus its written for wx2.8
So I will roll a class to Just glue up with my Editor
Edit
I ended using that one as I said.
Inside there is buggy libDBGp but I will fix it myself huh!
If you are interested its here (thanks to GitHub)
There are a few GDB based libraries that help debugger frontend writers like libgdb. DBGP is a very stupid and protocol with very small feature set - not enough for debugging C++.
For windows there is nothing like this. You can read the PDB database but it's pretty difficult. I spend a week to see how far i can get but wasn't very successfull. only the theory is easy. It might be better to write a frontend for the command line debugger windbg just like in the old days where you had to do this for GDB.

C.VIM not working

I have a simple question (that I don't seem to be able to answer),
I am a new VIM/Linux user, and since I do c++ development I decided to install the C.VIM plugin to speed up my development time. The problem is, it says in the plug-in (c++) menu that to do a switch statement I have to write \ss (for me the leader is ",", so it's ",ss") but when I do this it just puts me in insert mode and nothing happens. I know the plugin is well set up because when I open a new c++ file it generates a comment box where I can give the description of the program.
I would love it if I would be able to use the shortcuts, because using the menu just losses the point of using vim.
Oh and please, just keep in mind that I am new to vim, I still have hard time figuring out what means <c-r> + TAB (which is, if i'm not mistaking "ctrl-r <tab>"), so if you could just try to explain the solution clearly without to much jargon I would appreciate it. (while i'm here, does anyone know of a good vim tutorial where I could understands all of the vim jargon, thanks!)
I appreciate all the help.
I use this cheat sheet:
http://www.worldtimzone.com/res/vi.html
Please add the below line to .vimrc and
helptags ~/.vim/bundle/c.vim/doc
Note: I have pointed to my c.vim doc and I use bundle, it may differ for you :)

Getting GDB to display the entirety of multi-line statements

GDB, at least as it's configured by default on my Ubuntu 9.04 box, doesn't handle multi-line statements well. When I'm stepping through code, GDB only displays the last line of the current statement, even if that statement spans multiple lines.
I'm aware that I could use DDD or emacs as a frontend for GDB, but I'd prefer to solve this problem within GDB, if that's possible.
Does anyone know if there's a way to get GDB to do the right thing here?
How about running GDB with the text user interface?
gdb -tui
It makes a world of difference to the ease of use of GDB.
I'm afraid the answer is "no, there is no way to get gdb to do what you want".
The line info in the symbol tables associates each code instruction with a single
source line (not a source statement). gdb has no way of knowing that several
source lines are associated with the same source statement.