How to use vscode Debugger

  • Can you describe or provide the steps to follow to use vscode debugger, please?

  • And What is the difference between Debug Legato application (attach) / Debug Legato application (launch)

  • When I run the debugger, it requests to run the app in dev mode despite I just did it right before !!

Hi @mehdiALL1 ,

Can you describe or provide the steps to follow to use vscode debugger, please?

These are the necessary steps I took to debug a simple sample program similar to helloWorld.

I have attached a video to demonstrate the steps.

  1. Enter Legato View

  2. Set break points within the app you want to debug

  3. Enter Debug View

  4. Create a new “launch.json” using the template “Debug Legato application(launch)”

  5. Start the “Run and Debug”

  6. If devmode is not installed on the target you will be prompted to install.

  7. Select “Build and Install…” to install devmode on the target

  8. After installing attempt again to start “Run and Debug”

  9. You will be notified that there is no app called “myNewApp” (This can be done earlier on creation of “launch.json” but I forgot).

  10. Update the “launch.json” with your application name and defined executable name

  11. Start “Run and Debug” and you will notice the debugger stop on the main entry point to the application

  12. You can now start, step and view variable information to debug.

And What is the difference between Debug Legato application (attach) / Debug Legato application (launch)

Debug Legato Application (attach) will attempt to connect gdb to the application after it has been started. Debug Legato Application (launch), will use gdb to launch the application and as a result it will be connected from the start. Using “attach” theres a chance you miss the startup, and initial execution of the application, which can cause you to miss break points on lines that execute in the first ~second of the application.

When I run the debugger, it requests to run the app in dev mode despite I just did it right before !!

Try to enable dev mode again, it may not have detected that it was installed the first time.

Let me know if you have any questions.

Regards,

Lukasz

1 Like

Hi @lpacyk,

I have attached a video to demonstrate the steps.

I don’t see this video… can you send it again? please

Regards

Hi @mehdiALL1 looks like it previously failed to upload due to a file size error.
I compressed it to fit under 4MB

so apologies for the lower quality.

1 Like