Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

GPU application Attach debug record

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Preliminary work

1.1 Engineering path confirmation

There are six projects in the GPU project, as shown in figure 1-1:

Figure 1-1 GPU Project Project

The six projects are recommended to be placed in the same directory, otherwise strange problems may occur during debugging, such as under the default workspace directory of IDE, as shown in figure 1-2:

Figure 1-2 workspace project catalogue

1.2 Test program file name confirmation

For example, if the test program project is called gpu_test, then the file name of the main program must be gpu_test.c, otherwise the gpu_test.c cannot be found when debugging. An example is shown in figure 1-3:

Figure 1-3 confirm the main file of the test program

2.GDB Debug Settings 2.1 create a new debug project 2.1.1 Open the test project main program file

Figure 21:

Figure 2-1 Open the test main program file

2.1.2 Open the Debug Configurations option

As shown in figure 2-2:

Figure 2-2 opens the debug configuration menu

2.1.3 create a new SylixOS debugging project

Right-click the SylixOS Remote Application option and select the New option to create a new SylixOS debug project, as shown in figure 2-3:

Figure 2-3 New debugging project

2.2 Select a debugger

Be careful not to select programs under the strip directory, as shown in figure 2-4:

Figure 2-4 Select debugger

2.3 Select attach debug mode

Figure 2-5:

Figure 2-5 Select attach debug mode

2.4 add a dynamic library path

Add a total of 4 paths to dynamic libraries, as shown in figure 2-6 and figure 2-7:

Figure 2-6 add dynamic library path

Figure 2-7 added dynamic library

2.5 specify the debugger to start debugging

Provided that the test program and library have been downloaded to the target board and the test program is already running, the process ID can be found by typing the ps command at the terminal connected to the target board. Figure 2-8:

Figure 2-8 specifies the process ID

3. Use of debugging function

3.1 Select the debugging function window

As shown in figure 3-1: you can choose to add function windows as needed, such as Debug, Breakpoints, Memory, Variables, and so on.

Figure 3-1 Select function window

After selecting the function window, you can also adjust the position of each window according to your preferences, as shown in figure 3-2:

Figure 3-2 window position adjustment

3.2 add breakpoints

Click on the line of code where you want to add a breakpoint, and when the blue area appears, double-click directly to add a breakpoint. After the addition is successful, a small dot appears in the blue area, and the breakpoint takes effect immediately, the program stops when it runs to this line of code, and the background color of this line of code changes to green, as shown in figure 3-3:

Figure 3-3 adding breakpoints

3.3 add multiple breakpoints

The method of adding is the same as in the previous section, and multiple breakpoints can be managed in the Breakpoints area, as shown in figure 3-4:

Figure 3-4 adding multiple breakpoints

3.4 View variables and registers

When the program runs to the breakpoint, you can view the variable values in the breakpoint context in the Variables area, as shown in figure 3-5:

Figure 3-5 View variables

Similarly, look at the value of the register in the Registers area, as shown in figure 3-6:

Figure 3-6 View registers

3.5 resume operation

If you want the program to run to the breakpoint again, press F8. If you want to run without the breakpoint, uncheck the breakpoint in front of it in the Breakpoints area, and then press F8. Figure 3-7:

Figure 3-7 resumes operation

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report