How do I use Kdevelop to debug embedded code? - gdb

I have a project for Xilinx Zynq (Cortex A9). I want to be able to step-by-step debug the application in KDevelop. I know that xilinx has XSCT but I don't understand how can I get KDevelop to work in step-by-step code debugging mode for my processor?

I can advise you to learn how to do this from the terminal first and deal with the work of gdb-server. And also get a suitable make/cmake file.

Related

VSCode c++ configuring for vc toolchain

I'm trying to start a work in vscode , latest C++ plugin version supports ms debugger, so as I'm mostly working under windows it was a signal to try this.
c++ tools plugin from MS and cmake tools were installed.
my test project was however not built . the problem is clear , but I need an advice from experienced vscode users how to solve this right.
cmake doesn't see vc compiler.
(after using QtCreator) I expected that vscode could detect vc installation... however that's not so. ok, I have a two ways:
fill environment variables INCLUDE/LIB/PATH with a headers, libs and binaries
just run vcvarsall.bat x64
Second way is a simple and reliable. so final question is:
how to run .bat at the begining of vscode start?
(I don't mean write another bat/cmd, prepare the environment and run vscode inside the same script after that)
Although the question is fairly old, I'll try to give a useful answer, in case others stumble across, just like I did.
I believe what you are trying to achieve is not possible. Code inherits the environment it was started with. If you did not launch it from a developer command prompt, you will not be able build and debug. (Building might be possible if every task first starts the vcvarsall.bat, but that slows things down by a lot. Debugging I think will still not work.)
If you are willing to, you can check out vector-of-bools CMake Tools extension which does build automation as well as automatic MSVC detection. It builds using CMake (thus you need to write your build scripts using CMake), but it will take care of building just by pressing F7, like what most VS users are familiar with.

How to burn a program in flash in IAR Workbench?

I am using IAR Embedded Workbench IDE to develop an embedded solution for the Renesas RL78/G13. I am able to compile and run the project in debug mode. Now I would like to burn the program to flash in release mode. Can someone tell me how to do this?
Maybe the answer is a little bit late, but another option straight from IAR is to go to Make [F7 key] the project and the go to Menu Project -> Download -> Download active application.
Be carefull that the Reset line of the microncontroller is free so nothing sets it to OV, which will stop the microcontroller from running
IAR version for RL78 1.40.1
Certainly, you can use the Renesas Flash Programmer for downloading the hex file into the microcontroller. The Renesas flash Programmer install package, you can get from the website from supplier.

Can I use Eclipse CDT to debug a prebuilt C++ executable?

On Linux, I have some C++ programs built with my own makefiles, and I'm looking for some GUI debuggers to debug them at source level.
Previously I use KDbg(2.5.2) on openSUSE(12.3). It works but with some very annoying limitation, e.g., I cannot set a breakpoint when the debugged program is not trapped by Kdbg -- I mean, in order to set a new breakpoint, I have to set it before the program is launched or the program pauses on hitting an already set breakpoint.
Now I try to use Eclipse CDT. I got eclipse-cpp-juno-SR2-linux-gtk.tar.gz but find that I don't know how to load my executable so to start debugging.
I googled with words like 『eclipse debug pre-built C binary』, but few seems to care about this feature.
Can Eclipse CDT really do that? If Eclipse CDT can't, is there any better alternatives to KDbg? Please help.
According to hint from this answer, https://stackoverflow.com/a/248119/151453 , I finally figure out how to do it.
The key point is: In the Eclipse CDT project, create/edit a Launch Configuration so to tell the debugger what executable to load.
Now I have to admit, Eclipse CDT does quite well in C++ code debugging far better than KDbg.
Some screen shot below, on openSUSE 12.3 .
Now we can Run -> Debug (F11)
Debugger automatically pauses the program at main()'s first statement.
The Stand-alone Debugger is an Eclipse application which packages the Eclipse plug-ins from the CDT (C/C++ Development Tools) project into an application that can be started from a command-line script:
bash /path/scripts/cdtdebug.sh -e executable [args]

Netbeans MPI c++ how to start?

Hello everyone I just staring developing c++ under netbeans/ubuntu(x64) and now I am staring with MPI. How can I compile, test,run mpi applications under. Thanks a lot.
Till now, I've found only this IDE for MPI on Linux: Geany (a tutorial is here.)
But I keep searching...
If anyone find better IDE, please share under this question...
There is an Eclipse plug-in for parallel programming, including MPI: http://www.eclipse.org/ptp/
To build, change the C++ compiler in NetBeans's C/C++ options to be /path/to/mpicc.
As for running, MPI applications are usually invoked with mpirun. This is done either via the command line (on your PC) or via a batch description file (on a cluster with OpenPBS, LoadLeveler, or similar scheduler). I've never tried to run MPI via an IDE, though NetBeans does have an option for the debugger command, so you might be able to try that and see what happens.

Debugging on Linux for Windows Developer

Primarily I've done basic (novice level) software development on a Windows machine, but I've always had MS Visual Studio to help me step through the process of debugging.
Now, however, it looks like I will be on Linux, so in order to get ready for the jump I want to make sure I have a tool/tools lined up to help me step through the code and debug.
Unfortunately when I've verbally asked folks how they go about debugging on Linux, I typically get the following answer, "Oh, I just put a bunch of print statements." OMG! No way you say, but yes that is their answer.
Since it is on Linux, and will be working with C++ code on the CentOS 32-bit OS, I am hoping here is a preferred OpenSource solution. So, I guess I asking for the preferred OpenSource IDE for C++ code on CentOS Linux.
Thanks for any insight and suggestions.
Good question, of course, but its been
done before:
https://stackoverflow.com/questions/408418/what-editor-ide-do-you-use-for-c-programming-on-linux-and-why-closed
https://stackoverflow.com/questions/86676/is-there-a-good-and-free-ide-for-c-c-in-linux
https://stackoverflow.com/questions/149321/what-ide-would-be-good-for-linux-kernel-driver-development
Lightweight IDE for Linux
Simple GUI IDE?
(from: https://stackoverflow.com/questions/579219/best-unix-linux-c-debuger-ide-closed)
A few years ago I made the move from VS to an emacs/make type environment and I have never looked back.
The idea is to use a makefile to handle the project management side of an IDE and I use emacs+gdb for editing and debugging. It will take you a while to get used to emacs but if you stick at it it's well worth the effort. Once you've started emacs, press "Ctrl+H" followed by "t" and this will bring you to the tutorial page.
After you've mastered the basics, you can debug a program in a similar way to any IDE/debugger interface. I must admit that even after all this time, I still use a set of VS key mappings that I setup when I first moved to emacs!
(global-set-key [f7] 'compile) ;; Run the compile command
(global-set-key [f4] 'next-error) ;; The next compile error
(global-set-key [S-f4] 'previous-error) ;; The previous compile error
(global-set-key [f5] 'gdb) ;; Start the debugger
The following sets the "VS" key mappings to the different GDB commands which you might use:
(add-hook 'gud-mode-hook
'(lambda ()
(define-key (current-local-map)
[f10]
'gud-next)
(define-key (current-local-map)
[f11]
'gud-step)
(define-key (current-local-map)
[\S-f11]
'gud-finish)
(define-key (current-local-map)
[f5]
'gud-cont)
))
With the above keymappings, I press 'f5' which prompts me to run gdb (and to this command I add the binary I wish to debug). Once gdb is loaded, you press 'f5' to continue, 'f10' to step-over, 'f11' to step-into and 'shirt+f11' to step-out.
Finally, every time you start 'gdb', it will read a file called '.gdbinit' in your home directory. A different StackOverflow question had this answer which brought stl-views to my attention. stl-views is a set of helper functions for gdb that show you the contents of the different types of STL containers. The instructions for how to use it can be found at the top of the link.
I would suggest using Eclipse
Eclipse is a mature IDE with plenty of support available.
There is also Code::Blocks if you want to try something different
Eclipse
NetBeans
KDevelop
There is always GDB. XCode for OSX uses GDB internally for debugging.
Valgrind, its your friend and may save you from having to suffer though GDB.
Mostly, for an IDE similar (?) to VS - use Eclipse.
See moving Microsoft VS projects to Eclipse C/C++ Development Toolkit - a brief step-by-step procedure for migrating Microsoft Visual Studio C/C++ (MSVC) projects to Eclipse. It compares and contrasts the benefits of MSVC and Eclipse CDT.
Anjuta is a really great IDE for GNOME. For debugging it uses GDB internally.
If you just want a good debugger, check out DDD.
I use a combination of gdb and cscope when debugging on linux.