PostFrontal Forum
PostFrontal Forum
LK8000_Support_Forum | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 LK8000 International Support
 Developers
 Experience with vscode and debug?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
mana Posted - 30/06/2020 : 21:00:48
I'm new to modern development environments and started using vscode on Windows via WSL2 (my code and the build tools reside on Ubuntu, vscode runs on Windows 10) and after successfully modifying and building LK8000, I'm now trying to use the debug feature.

If one of you successfully used vscode in debug mode, do you mind sharing tips or guidelines? (I'm stuck properly modifying the launch.json)

BTW, as WSL2 doesn't natively support running GUI based linux apps, I'm thinking of doing the debug on the PC executable, though I'm not sure it would work. An alternative is to code in vscode, then get my code in Android Studio and debug from there.
2   L A T E S T    R E P L I E S    (Newest First)
mana Posted - 01/07/2020 : 14:37:08
Thank you very much Bruno, I got it working just before seeing your post!

For anyone finding this thread & looking for similar information, I managed to run the LK8000 linux executable on Windows / WSL2. I installed X410 on Windows (x-terminal client), adjusted the DISPLAY variable on WSL to point to the correct IP address and now I can launch LK8000 (linux) that opens via X410 under Windows. I also managed to run the debugger in vscode / WSL2 with a launch.json almost identical to Bruno's:

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/LK8000-LINUX_debug-ns",   
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
			"miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"            
        }
    ]
}


In tasks.json I also made a very simple build task, called through the launch.json via "preLaunchTask": "build" :

tasks.json
{
    "version": "2.0.0",
	"tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "make",
            "args": ["DEBUG=y"],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": "$gcc"
        }
    ]
}

So to validate my code tweaks I will keep using WSL2 rather than going the cygwin_x86/mingw32 or using a Linux VM or booting to Linux. I’m pretty pleased with WSL2, including build speed! To top it off Microsoft announced that later this year WSL2 will natively support launching GUI applications without installing a 3rd party X-terminal.

@brunotl, do you have a more fancy make/build tasks.json on vscode?

My current issue is the debugger sometimes telling me it doesn’t find a source file coming from an external library, eg :
Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-20.04/build/glibc-YYA7BZ/glibc-2.31/sysdeps/unix/sysv/linux/raise.c').

Is there a way to configure vscode to not try to step into external libraries in debug?
brunotl Posted - 01/07/2020 : 12:34:37
this is my launch.json to debug PC target build with "cygwin_x86/mingw32".


{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb)",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/LK8000-PC_debug-ns.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [
                {
                    "name": "PATH",
                    "value": "%PATH%;C:\\cygwin\\bin"
                }
            ],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\cygwin\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "gdb Pretty Printing",
                    "text": "-enable-pretty-printing -gdb-set detach-on-fork off",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}


PostFrontal Forum © PostFrontal - La community del Volo a Vela Go To Top Of Page
This page was generated in 0.1 seconds. Snitz Forums 2000

Since 2006, owned and maintained by PostFrontal S.A.S. di Giuliano Golfieri & c. - VAT ID: IT05264240960
THIS WEBSITE ONLY USES FUNCTIONAL COOKIES
Privacy & Cookie Policy