How to use sudo to run code on PetaLinux VSCode debugger?

  Kiến thức lập trình

I use sudo privileges to run C programs on PetaLinux. Like the example below.

$ sduo ./test.c

My petalinux version

$ uname -a
Linux petalinux_project 5.15.36-xilinx-v2022.2 #1 SMP PREEMPT Mon Oct 3 07:50:07 UTC 2022 armv7l armv7l armv7l GNU/Linux

Now I want to use the gdb debugger, but I don’t know how to add sudo. If I don’t run the debugger with sudo, my program will crash.

My launch.json is as follows:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "target": <exe_file_path>,
            "cwd": "${workspaceRoot}",
            "valuesFormatting": "parseText",
        }
    ]
}

Could you please explain it to me? Thank you, everyone.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT