Knowledge Library
Knowledge Library Home
Knowledge Library Home Knowledge Library Products Operating Systems Wind River Linux Wind River Linux 8 Getting Started Wind River Linux Demo Series: Debugging an Application in Windows — Video, 05:05

Wind River Linux Demo Series: Debugging an Application in Windows — Video, 05:05

Table of contents

Learn how to debug a simple, then a complex (multi-process) example in Workbench hosted in Windows.

Published on 16 September 2015

Transcript

Time (mm:ss) Narration
From: 00:02 Hello, and welcome to the Wind River Linux Demo Series. This video tutorial covers debugging an application in Windows. In order to do this, you will need an SDK that includes the appropriate compiler for your target. You can use the pre-built SDK included in Workbench, or you can use an SDK built by a platform developer on your team. The platform developer will need to add the "--enable-win-sdk" option to the configuration of the platform project before building the SDK. The other thing you'll need, is access to a target with the file system that has been enabled with debug-specific functionality. I'll be using the SDK included in my Workbench installation, and I have a connection to a QEMU simulated target, as shown in the system management tool bar. Let's begin with a basic application. First, I'll need to create a Wind River Workbench project. From the file menu, select New > Wind River Workbench Project.
From: 01:01 My application is written in C so I'll select "C Application" and click "Next". I want to call this project "prime", then click "Finish". Workbench generates the new project and you can see it from the Project Explorer view. Now I need to import my source file. In the Project Explorer view, right-click on "prime" and select "Import". Since my file is on my local file system, I need to expand "General", and select "File System". I'm going to browse to the folder where my file lives, then click "OK". All the files in that folder are listed in the dialog box. Choose "prime.c", then click "Finish". Workbench imports the selected file and you can see it from the Project Explorer view. Next, I need to select the correct build spec for my project. With the prime project selected in the Project Explorer view, click the Set Active Build Spec and Debug Mode icon.
From: 02:00 I am connected to a 64-bit QEMU target, so I need the 64-bit toolchain. I want to perform source-level debugging, so I need to make sure the debug mode option is enabled so debug symbols get built as well. I build the project by right-clicking on the prime project and selecting "Build Project". Since I'm already connected to my target, I'll go ahead and start a debug session by selecting "Debug Remote Linux Application". I make sure the right binary is selected, and the right target connection is chosen. Click "Debug". Workbench opens the Debug perspective and launches the prime.out binary on the QEMU target. At this point, I can start debugging my application, like setting a breakpoint in the source file, and running to it. Now, I'm going to terminate this debug session and demonstrate how to debug a multi-process application by using one of the Wind River sample projects
From: 03:01 included in your Workbench installation. From the file menu, select New > Example > Wind River Linux Application Sample Project. Click "Next". Choose "The Client-Server Demonstration Program" and click "Finish". Workbench generates the project and you can view it from the Project Explorer view. The source files are there. Notice that there are two build targets for this project. Like the prime project, make sure you're using the correct build spec, and that debug mode is enabled. Build the project. You can see that two binaries are built: client.out and server.out. To debug these two binaries, I'll need to launch two debug sessions. I'll start a debug session using the server.out binary first. In the Debug Configurations dialog box, I make sure server.out is selected, and the correct target connection is chosen. Click "Debug". Workbench switches over to the Debug perspective and launches the
From: 04:04 server.out binary on the QEMU target. In the source file, I'm going to set a breakpoint on line 76, so I'll know that a client has successfully connected to the server. Let me hit run. It won't hit my breakpoint right now because it's waiting for a client to connect. Next, I need to start another debug session for the client.out binary. So, let me switch to the System Development perspective. In the Debug Configurations dialog box, I make sure client.out is selected and the correct target connection is chosen. In order to run client.out properly, I need to pass in the client's IP address. In the Arguments tab, I type "127.0.0.1" in. I also need to change the default port number for GDB server since that's already being used by the server's debug session. So I'll click the Debugger tab, then select the Gdbserver Settings tab,
From: 05:01 and change the port number from "49152" to "49153". That should do it! Now click "Debug". The client.out binary runs and stops at main, like server.out. Notice the two debug sessions in the terminal. In the client.c source file, I'll set a breakpoint at line 36 to demonstrate to you multi-process debugging. I'm going to run the program. You can see it stopped at the breakpoint in server.out. Run the program again. You can see it stopped at the breakpoint in client.out. You can also see the output from the printf in the server's GDB server session. Run again, and you can see the output string from the client's GDB server session. Thanks for watching the Wind River Linux Demo Series. Be sure to check out the rest of the series, and have a great day!

Contact: dwinters

Content ID: 045794

 
Last modified