help:developer_tools:cygwin
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | help:developer_tools:cygwin [2020/06/20 14:39] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~TOC~~ | ||
+ | |<100% 25% - >| | ||
+ | ^ \\ DATA ANALYTICS REFERENCE DOCUMENT\\ \\ ^^ | ||
+ | ^ Document Title: | ||
+ | ^ Document No.: | ||
+ | ^ Author(s): | ||
+ | ^ Contributor(s): | ||
+ | |||
+ | |||
+ | **REVISION HISTORY** | ||
+ | |< 100% 10% - - 10% 17% 10% >| | ||
+ | ^ \\ Revision\\ | ||
+ | | [[: | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Cygwin debugger in VS Code ====== | ||
+ | |||
+ | * Download and run the Cygwin installer from here https:// | ||
+ | * Follow the [[help: | ||
+ | * After installation building is required, **note** that this is done in a newly installed //Cygwin terminal//. | ||
+ | * The module in the course uses gcc instead of g++. | ||
+ | |||
+ | ===== Adding the gcc debugger gdb ===== | ||
+ | |||
+ | ==== Install gdb ==== | ||
+ | |||
+ | Rerun the cygwin installer(setup-x86_64.exe), | ||
+ | |||
+ | Click through the installer and select gdb, you might have to use search to locate it. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Click skip to select gdb and click net to complete the installation. | ||
+ | </ | ||
+ | |||
+ | |||
+ | The gdb.exe file will now appear in c: | ||
+ | |||
+ | No set up the debugger extension in VS Code if not already installed. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | The debugger can now be configured in VS Code. | ||
+ | |||
+ | ===== Step by step instructions to set up the debugger in VS Code ===== | ||
+ | |||
+ | |||
+ | - Open C file in VS Code | ||
+ | - Set breakpoint in code | ||
+ | - Press F5 or select Start debugging from Debug menu\\ {{: | ||
+ | - Select C++(GDB/ | ||
+ | - Then select gcc.exe build and debug active file\\ {{: | ||
+ | - The Launch.json window should now pop up, see that this has the right path to your gdb.exe file, save and close.\\ {{: | ||
+ | - G back to the C file and F5 again, ow it should pop up a message about not being able to build the active file, click " | ||
+ | - Select C/ | ||
+ | - Now the task,json file should pop up and confirm that " | ||
+ | - Go back to the C file again and press F5. | ||
+ | - Now everything should start up and the code should stop at the debugger breakpoint.\\ {{: | ||
+ | |||
+ | |||
+ | ==== Sample configuration files for Cygwin gdb to work in VS Code ==== | ||
+ | |||
+ | <code js launch.json[enable_line_numbers=" | ||
+ | { | ||
+ | // Use IntelliSense to learn about possible attributes. | ||
+ | // Hover to view descriptions of existing attributes. | ||
+ | // For more information, | ||
+ | " | ||
+ | " | ||
+ | | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code js tasks.json[enable_line_numbers=" | ||
+ | { | ||
+ | // See https:// | ||
+ | // for the documentation about the tasks.json format | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | Right click and save the two json configuration files above into a subfolder named '' | ||
+ | This folder should be in the same folder where your c files that you want to debug resides. | ||
+ | </ | ||
+ | |||
+ | ===== Troubleshooting ===== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | <code js> | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | |||
+ | * http:// | ||
+ | |||
+ | |||
+ | ==== UTF-8 Workaround ==== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | So the issue is caused in gb and the extra escaped character returned on line three in the VS Code debugger window as shown below. | ||
+ | |||
+ | <code bash> | ||
+ | 1: (2308) ->(gdb) | ||
+ | 1: (2317) < | ||
+ | 1: (2318) ->&" | ||
+ | 1: (2319) ->&" | ||
+ | 1: (2320) -> | ||
+ | 1: (2320) ->(gdb) | ||
+ | </ | ||
+ | |||
+ | |||
+ | As a workaround to fix this add a " | ||
+ | |||
+ | <code bash> | ||
+ | @:: gdb-with-chcp.cmd | ||
+ | @chcp 1257 >NUL 2>&1 && @" | ||
+ | </ | ||
+ | |||
+ | This sets the codepage for GDB and fixes the problem cause above when running the PC set to UTF-8 codepage. | ||
+ | |||
+ | Amend the current json code launching the debugger to point to the cmd file just created. | ||
+ | |||
+ | <code js launch.josn> | ||
+ | // use " | ||
+ | // eg | ||
+ | // ... | ||
+ | " | ||
+ | // ... | ||
+ | |||
+ | </ | ||
+ | |||
+ | This resolved my gcc debugger issues. |
help/developer_tools/cygwin.txt · Last modified: 2020/06/20 14:39 by 127.0.0.1