The purpose of writing this article is to help those who write programs but also necessary to use Visual Studio to develop and debug embedded Linux program hardy programmers!
First, install WinGDB, download location http://www.wingdb.com/, the connection is http://www.wingdb.com/WinGDB-latest_trial.msi 30-day trial version after 30 days uninstall it, delete all gdb relevant registry, and then re-installed, and can be used for 30 days, the installation process as shown below:
1, agree to the license agreement
2, if you machine is equipped with a sufficient number of VS version, you have the choice, mainly to see you use that version of VS
3, if you make only a remote Linux developers, then select the first item, if you do embedded system development, the second choice, if you want to be all, the third option, of course, is where we select the third a.
Next, create WinGDB project
1, the new WinGDB project, select Multiplatform executable
2, select the first item, we have to conduct remote development, source code in the build on a remote server, debugging is also on the remote host to access the machine via TCP / IP connection and using the SSH protocol.
3, the second choice, gdb and cross-compiler environment on a single server, remote debugging on another machine, this machine can be arm linux may be other support gdbserver machines.
4. Fill in gdb and compiler environment ssh address and user name and password for the user name and password gdbserver where the IP address.
5. Browse to choose our thinking about precompiled gdb debugger, which is compiled to run on that server gdb environment, to control the gdbserver, gdb and gdbserver must be corresponding.
6, select the local source and remote source synchronous manner, according to this situation to choose, if you are sharing, select the first option, if you want to synchronize, then choose the second, if not synchronized, the third election items, as shown:
7, select Remote file path and the local file path:
8, set the compile command, and build directories, directory on the server to compile these directories are listed when you click the browse
9, select the destination directory for remote debugging
10, select additional and additional source files and libraries, skip this step, if you need to, you can then set here.
11, set up debugging boot parameters at the same time, it is recommended to remove Stop in main, so to avoid each time you start the program, should be in the main function where to stop.
12, the configuration is complete
My configuration as follows:
Project build command: make
Project rebuild command: make clean; make
Project clean command: make clean
Project deploy command:
Build working directory: / root / ct / src /
Build environment variables: BUILD_CONFIGURATION = "Debug"
Build before start debugging: Build project
Deploy before start debugging: yes
Deploy action: Transfer file to target
Deploy only if file changed: yes
Files to deploy: / root / ct / src // EMRCV4
Deploy target directory: / mnt / EMRCV4 / BIN
Core file path:
Working directory: / mnt / EMRCV4 / BIN
Stop in main (): no
Server mode: Launch executable
Executable on target: / mnt / EMRCV4 / BIN / EMRCV4
Launch GDB server automatically: yes
Launch server from sysroot: no
Path to gdbserver: / usr / bin / gdbserver
Server port: 2345
Server port is forwarded: no
Forwarded server port: 0
Executable path: / root / ct / src // EMRCV4
Byte order: Little endian
Additional source directories:
Debug info directory:
Sysroot on host:
Sysroot on target:
Shared library directories:
Load sources from build host: no
Disable hang reporter: no
Debugger path: / usr / bin / arm-unknown-linux-gnueabi-gdb
Build toolchain paths:
Intercept standard IDE commands: yes
Target type: Linux indirect debugging (SSH + remote target)
Debug host login: firstname.lastname@example.org: 22
Build host login: email@example.com: 22
Debug target login: firstname.lastname@example.org: 22
Debug and compile the project is now complete configuration
The third section of code mapping configuration
Then the output window will output the following:
-------------------------------------------------- ------------------------------ Transfer to remote host (s) ------------- -------------------------------------------------- -----------------
Errors were encountered during preparation: No files could be copied.
Could not map the path: D:. \ Works \ RHY \ Toll \ Trunk \ src \ FunctionAssembly \ Lane \ EMRCV4 \ EMRCV4.vcxproj to remote filesystem Use 'Map source directories' option to setup a mapping.
If present, the code mapped window open
Then add the following a Login, and then choose to add a map
Here is the effect of compile-time error because the compiler level reason, the first compilation have a lot of fault, the second compilation error disappears
When debugging, it will pop up when you start the following window, point to determine, it does not matter
Here is the case of the debugging process, you can view the local variables and runtime mouse below the current process variable value, the same as with the VS, can also single-step execution.
Step four: Include a reference to the image above you can see a lot of constants and functions have red, because VS can not find the corresponding header file, and therefore need to continue to do some settings.
Open Project Properties, select Configuration Properties, select the VC ++ directory, then in the directory containing added cross compiler environment in header files, such as:
D: \ Works \ Linux \ toolchain_R2_EABI \ usr \ arm-unknown-linux-gnueabi \ sysroot \ usr \ include
Then you need to put your entire list of all the header files to add here, if the header file directory is more, it is more strenuous.
After setting, you'll see that VS is parsing the header files, after setting the effect is as follows
Finally, if there is a problem or wizard settings are not saved, it may be the reason because it is not administrator privileges, so you might want to check under your configuration
General Settings debug host and the same build host
Environment set up the debugger path
Debugging options, to choose a good production of executable files and applications working directory on the target machine
The next step is critical, is the project build settings, build directory path must be the path has been mapped, otherwise an error of error unable to locate the file location,
The seventh column is set to build the project before commissioning, before commissioning the eighth set to deploy, the tenth set of deployment operations to transfer files to the target,
X is an option, if the file is changing deployment file twelfth decision to deploy, the fifth is the file where you want to deploy.
Further compilation arm and gdb related gdbserver in future articles will be introduced to! This article not be introduced. If gdb and gdbserver inconsistent, the same will not debug
Here is my gdbserver version information:
[192.168.50.58:/mnt/EMRCV4/BIN]# gdbserver --version
GNU gdbserver (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
gdbserver is free software, covered by the GNU General Public License.
This gdbserver was configured as "arm-unknown-linux-gnueabi"
Here is gdb version information
root @ Ubuntu: / usr / bin # arm-unknown-linux-gnueabi-gdb
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3 +: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host = i686-pc-linux-gnu --target = arm-unknown-linux-gnueabi".
For bug reporting instructions, please see:
Note that we must pay attention This GDB was configured as "--host = i686-pc-linux-gnu --target = arm-unknown-linux-gnueabi".
If not, Tongyang will Bianyishibai of.
Thus fully configured, a few days later, I will be under the circumstances to supplement and improve this article if you are interested, please continue to focus on it!