{"id":1683,"date":"2017-11-06T17:19:18","date_gmt":"2017-11-07T01:19:18","guid":{"rendered":"http:\/\/balafon.net\/?p=1683"},"modified":"2017-11-17T14:05:32","modified_gmt":"2017-11-17T22:05:32","slug":"configuration-for-debugging-the-pony-compiler-in-visual-studio-code-on-windows","status":"publish","type":"post","link":"https:\/\/balafon.net\/?p=1683","title":{"rendered":"Configuration for Debugging the Pony Compiler in Visual Studio Code on Windows"},"content":{"rendered":"<p>For debugging the <a href=\"https:\/\/www.ponylang.org\/\">Pony compiler<\/a> on Windows I use the following configuration files in the <code>.vscode<\/code> directory of my cloned <a href=\"https:\/\/github.com\/ponylang\/ponyc\">ponyc git repo<\/a>.<\/p>\n<p>I also use the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=npruehs.pony\">Pony Syntax Colorizer<\/a> for syntax highlighting in Pony programs.<\/p>\n<p>Updated: updated <code>tasks.json<\/code> for more recent VSCode versions.<\/p>\n<p><strong>c_cpp_properties.json:<\/strong><\/p>\n<pre lang=\"javascript\">\r\n{\r\n  \"configurations\": [\r\n    {\r\n      \"name\": \"Win32\",\r\n      \"includePath\": [\r\n        \"${workspaceRoot}\/build\/debug-llvm-3.9.1\/ThirdParty\/lib\/LLVM-3.9.1-Debug\/include\",\r\n        \"C:\/Program Files (x86)\/Microsoft Visual Studio\/2017\/Community\/VC\/Tools\/MSVC\/14.11.25503\/include\",\r\n        \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/shared\",\r\n        \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/ucrt\",\r\n        \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/um\",\r\n        \"${workspaceRoot}\/src\/common\",\r\n        \"${workspaceRoot}\/src\/libponyrt\"\r\n      ],\r\n      \"defines\": [\r\n        \"PONY_VERSION=\\\"0.20.0\\\"\",\r\n        \"LLVM_VERSION=\\\"3.9.1\\\"\",\r\n        \"PONY_COMPILER=\\\"msvc\\\"\",\r\n        \"PONY_BUILD_CONFIG=\\\"debug\\\"\",\r\n        \"PONY_LLVM=391\",\r\n        \"DEBUG\",\r\n        \"_DEBUG\",\r\n        \"_MSC_VER=1900\",\r\n        \"UNICODE\"\r\n      ],\r\n      \"browse\": {\r\n        \"limitSymbolsToIncludedHeaders\": true,\r\n        \"databaseFilename\": \"C:\/Users\/Gordon\/Dev\/pony\/ponyc\/.vscode\/browse\/.browse.VC.db\",\r\n        \"path\": [\r\n          \"${workspaceRoot}\/build\/debug-llvm-3.9.1\/ThirdParty\/lib\/LLVM-3.9.1-Debug\/include\",\r\n          \"C:\/Program Files (x86)\/Microsoft Visual Studio\/2017\/Community\/VC\/Tools\/MSVC\/14.11.25503\/include\",\r\n          \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/shared\",\r\n          \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/ucrt\",\r\n          \"C:\/Program Files (x86)\/Windows Kits\/10\/Include\/10.0.16299.0\/um\",\r\n          \"${workspaceRoot}\/src\"\r\n        ]\r\n      },\r\n      \"intelliSenseMode\": \"msvc-x64\"\r\n    }\r\n  ],\r\n  \"version\": 3\r\n}\r\n<\/pre>\n<p>Obviously the version numbers and directory names for LLVM, Visual Studio and Windows SDK will need to be updated for your particular installation.<\/p>\n<p><strong>launch.json<\/strong><\/p>\n<pre lang=\"javascript\">\r\n{\r\n  \"version\": \"0.2.0\",\r\n  \"configurations\": [\r\n    {\r\n      \"name\": \"Launch Ponyc\",\r\n      \"type\": \"cppvsdbg\",\r\n      \"request\": \"launch\",\r\n      \"program\": \"${workspaceRoot}\/build\/debug-llvm-3.9.1\/ponyc.exe\",\r\n      \"args\": [ ],\r\n      \"stopAtEntry\": false,\r\n      \"cwd\": \"${workspaceRoot}\",\r\n      \"environment\": [\r\n        {\r\n          \"name\": \"PONYPATH\",\r\n          \"value\": \"\"\r\n        }\r\n      ],\r\n      \"externalConsole\": false\r\n    },\r\n    {\r\n      \"name\": \"Attach to Process\",\r\n      \"type\": \"cppvsdbg\",\r\n      \"request\": \"attach\",\r\n      \"processId\": \"${command:pickProcess}\"\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>This provides two launch tasks, one for the Pony compiler, and one for attaching to a running program.<\/p>\n<p><strong>tasks.json<\/strong><\/p>\n<pre lang=\"javascript\">\r\n{\r\n  \"version\": \"2.0.0\",\r\n  \"tasks\": [\r\n    {\r\n      \"label\": \"distclean\",\r\n      \"command\": \"${workspaceRoot}\/make.bat\",\r\n      \"args\": [\r\n        \"distclean\"\r\n      ],\r\n      \"type\": \"shell\",\r\n      \"group\": \"none\",\r\n      \"problemMatcher\": []\r\n    },\r\n    {\r\n      \"label\": \"configure\",\r\n      \"command\": \"${workspaceRoot}\/make.bat\",\r\n      \"args\": [\r\n        \"configure\"\r\n      ],\r\n      \"type\": \"shell\",\r\n      \"group\": \"none\",\r\n      \"problemMatcher\": []\r\n    },\r\n    {\r\n      \"label\": \"clean\",\r\n      \"command\": \"${workspaceRoot}\/make.bat\",\r\n      \"args\": [\r\n        \"clean\",\r\n        \"--config=debug\"\r\n      ],\r\n      \"type\": \"shell\",\r\n      \"group\": \"none\",\r\n      \"problemMatcher\": []\r\n    },\r\n    {\r\n      \"label\": \"build\",\r\n      \"command\": \"${workspaceRoot}\/make.bat\",\r\n      \"args\": [\r\n        \"build\",\r\n        \"--config=debug\"\r\n      ],\r\n      \"type\": \"shell\",\r\n      \"group\": {\r\n        \"kind\": \"build\",\r\n        \"isDefault\": true\r\n      },\r\n      \"problemMatcher\": \"$msCompile\"\r\n    },\r\n    {\r\n      \"label\": \"test\",\r\n      \"command\": \"${workspaceRoot}\/make.bat\",\r\n      \"args\": [\r\n        \"build\",\r\n        \"test\",\r\n        \"--config=debug\"\r\n      ],\r\n      \"type\": \"shell\",\r\n      \"group\": {\r\n        \"kind\": \"test\",\r\n        \"isDefault\": true\r\n      },\r\n      \"problemMatcher\": \"$msCompile\"\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>This will provide tasks for building and testing ponyc in debug mode.<\/p>\n<p><strong>settings.json<\/strong><\/p>\n<pre lang=\"javascript\">\r\n{\r\n  \"files.associations\": {\r\n    \"*.h\": \"cpp\",\r\n    \"*.c\": \"cpp\"\r\n  }\r\n}\r\n<\/pre>\n<p>Windows builds must use C++ for all source files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For debugging the Pony compiler on Windows I use the following configuration files in the .vscode directory of my cloned ponyc git repo. I also use the Pony Syntax Colorizer for syntax highlighting in Pony programs. Updated: updated tasks.json for more recent VSCode versions. c_cpp_properties.json: { &#8220;configurations&#8221;: [ { &#8220;name&#8221;: &#8220;Win32&#8221;, &#8220;includePath&#8221;: [ &#8220;${workspaceRoot}\/build\/debug-llvm-3.9.1\/ThirdParty\/lib\/LLVM-3.9.1-Debug\/include&#8221;, &#8220;C:\/Program &hellip; <a href=\"https:\/\/balafon.net\/?p=1683\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Configuration for Debugging the Pony Compiler in Visual Studio Code on Windows&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[195],"class_list":["post-1683","post","type-post","status-publish","format-standard","hentry","category-computing","category-journal","tag-pony"],"_links":{"self":[{"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/posts\/1683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/balafon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1683"}],"version-history":[{"count":10,"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions"}],"predecessor-version":[{"id":1694,"href":"https:\/\/balafon.net\/index.php?rest_route=\/wp\/v2\/posts\/1683\/revisions\/1694"}],"wp:attachment":[{"href":"https:\/\/balafon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/balafon.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/balafon.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}