Use GDB (GNU Debugger) to debug on RK3568

To use GDB (GNU Debugger) for debugging on RK3568, you need to make sure that the GDB tool suitable for this platform has been installed. Then, follow the steps below:

  1. Connect to RK3568 development board or device.

  2. When compiling your code on the development board, you need to ensure that debug information is enabled in the compile options. You can use -gthe option to generate debug symbols. For example:

    $ gcc -g myfile.c -o myfile
    
  3. Transfer the compiled executable file myfileto the RK3568 device.

  4. Open a terminal on the RK3568 device and navigate to the directory where the executable is located.

  5. To start the GDB debugger, the command is gdb.

    $ gdb
    
  6. Load the executable in GDB.

    (gdb) file myfile
    
  7. Set up the debugging environment, such as setting breakpoints, watching variables, etc.

    (gdb) break main              // 在 main 函数处设置断点
    (gdb) run                     // 运行程序,触发断点停止
    (gdb) print variable_name     // 观察指定变量的值
    
  8. Use GDB's other commands for debugging.

    (gdb) next                    // 执行下一条语句
    (gdb) step                    // 单步执行
    (gdb) continue                // 继续执行直到下一个断点
    

おすすめ

転載: blog.csdn.net/weixin_37787043/article/details/132159374