{"id":271,"date":"2018-03-04T17:07:48","date_gmt":"2018-03-05T01:07:48","guid":{"rendered":"https:\/\/sysprogs.com\/tutorials\/?p=271"},"modified":"2018-04-27T12:35:41","modified_gmt":"2018-04-27T19:35:41","slug":"configuring-visualkernel-to-access-source-code-directly-via-ssh","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/VisualKernel\/tutorials\/directssh\/","title":{"rendered":"Configuring VisualKernel to access source code directly via SSH"},"content":{"rendered":"<p>This tutorial shows how to configure VisualKernel to access the Linux kernel and module source code directly over SSH instead of downloading it to the Windows machine. This\u00a0allows viewing\/editing files with reserved names (e.g. aux.h) and\u00a0names\u00a0that\u00a0are the same except for capitalization (e.g. <strong>ipt_ecn.h<\/strong> vs <strong>ipt_ECN.h<\/strong>).<\/p>\n<p>Before you begin, install VisualKernel 3.0 or later.<\/p>\n<ol>\n<li>Start Visual Studio and open the\u00a0VisualKernel Module Wizard:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-272\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1.png\" alt=\"\" width=\"941\" height=\"653\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1.png 941w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1-300x208.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1-768x533.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1-392x272.png 392w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/01-prj-1-130x90.png 130w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/li>\n<li>Proceed with the default &#8220;Hello, World&#8221; project:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-273\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/02-hello-1.png\" alt=\"\" width=\"886\" height=\"693\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/02-hello-1.png 886w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/02-hello-1-300x235.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/02-hello-1-768x601.png 768w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/>Ensure\u00a0the &#8220;Use Advanced Kernel Project Subsystem&#8221; checkbox is checked.<\/li>\n<li>Select\u00a0the target\u00a0machine you want to debug. As stopping at a kernel breakpoint would suspend all SSH communication until the target is resumed, direct SSH access is only supported if you use a second Linux machine for building\/debugging your kernel. Select it in the &#8220;build the module on&#8221; field and press &#8220;Next&#8221;:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-274\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/03-k2.png\" alt=\"\" width=\"886\" height=\"693\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/03-k2.png 886w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/03-k2-300x235.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/03-k2-768x601.png 768w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/><\/li>\n<li>VisualKernel will ask\u00a0for a directory to use on the second Linux machine\u00a0to store debug files. Proceed with the default option:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-275\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/04-recommend.png\" alt=\"\" width=\"486\" height=\"262\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/04-recommend.png 486w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/04-recommend-300x162.png 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/li>\n<li>VisualKernel will\u00a0suggest storing the sources\u00a0directly on the build machine and access them via SSH. Proceed with this option:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-276\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/05-direct.png\" alt=\"\" width=\"886\" height=\"693\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/05-direct.png 886w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/05-direct-300x235.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/05-direct-768x601.png 768w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/><\/li>\n<li>Select a debug method that matches your target setup:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-277\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/06-network.png\" alt=\"\" width=\"886\" height=\"693\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/06-network.png 886w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/06-network-300x235.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/06-network-768x601.png 768w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/><\/li>\n<li>Press &#8220;Finish&#8221; to create the project. Note how the full path of the\u00a0source files starts with the <strong>vkrnl-ssh:\/\/<\/strong> prefix indicating files directly accessed over SSH:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-278\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/07-path.png\" alt=\"\" width=\"1262\" height=\"779\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/07-path.png 1262w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/07-path-300x185.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/07-path-768x474.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/07-path-1024x632.png 1024w\" sizes=\"(max-width: 1262px) 100vw, 1262px\" \/><\/li>\n<li>The Advanced Linux Kernel projects use the Advanced Clang-based IntelliSense\u00a0engine that is capable of accessing\u00a0remote files automatically. Hence you can reference\u00a0headers on the Linux machine without caching any files\/directories on the Windows side and IntelliSense will find them instantly:<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-279\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/08-timer.png\" alt=\"\" width=\"1262\" height=\"779\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/08-timer.png 1262w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/08-timer-300x185.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/08-timer-768x474.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/08-timer-1024x632.png 1024w\" sizes=\"(max-width: 1262px) 100vw, 1262px\" \/><\/li>\n<li>Set a breakpoint in the init() function and press F5 to start debugging. Once the breakpoint is hit, use the Call Stack window to walk the stack. VisualKernel will automatically open the Kernel sources cached on the build machine:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-280\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/09-module.png\" alt=\"\" width=\"1262\" height=\"779\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/09-module.png 1262w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/09-module-300x185.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/09-module-768x474.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/09-module-1024x632.png 1024w\" sizes=\"(max-width: 1262px) 100vw, 1262px\" \/><\/li>\n<li>If you want\u00a0VisualKernel to index the kernel sources in order to quickly find function definitions, references and use Code Map, double-click on the &#8220;Referenced Kernel&#8221; item in Solution Explorer.\u00a0VisualKernel will query the\u00a0exact build commands from the KBuild system and will create an optimized code database:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-281\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/10-load.png\" alt=\"\" width=\"1262\" height=\"779\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/10-load.png 1262w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/10-load-300x185.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/10-load-768x474.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/10-load-1024x632.png 1024w\" sizes=\"(max-width: 1262px) 100vw, 1262px\" \/><\/li>\n<li>Once the database is created, you can\u00a0use Solution Explorer to browse through the kernel\u00a0sources as if it was a regular project. VisualGDB kernel projects are optimized for the huge size of the kernel codebase, so they will\u00a0load much faster than the regular VC++ projects of the same size, and they will fully support reserved and case-sensitive names:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-282\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/11-ecn.png\" alt=\"\" width=\"1262\" height=\"779\" srcset=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/11-ecn.png 1262w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/11-ecn-300x185.png 300w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/11-ecn-768x474.png 768w, https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2018\/02\/11-ecn-1024x632.png 1024w\" sizes=\"(max-width: 1262px) 100vw, 1262px\" \/><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to configure VisualKernel to access the Linux kernel and module source code directly over SSH instead<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[45],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/271"}],"collection":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":1,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/271\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}