1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[253],{343:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return a})),t.d(n,"rightToc",(function(){return c})),t.d(n,"metadata",(function(){return p})),t.d(n,"default",(function(){return s}));var i=t(1),o=t(6),r=(t(0),t(367)),a={sidebar_label:"Debugging",title:"Debugging"},c=[{value:"Application Debugging",id:"application-debugging",children:[]},{value:"Debugging Qode process",id:"debugging-qode-process",children:[{value:"Command Line Switches",id:"command-line-switches",children:[]},{value:"External Debuggers",id:"external-debuggers",children:[]}]}],p={id:"guides/debugging",title:"Debugging",description:"## Application Debugging",source:"@site/docs/guides/debugging.md",permalink:"/docs/guides/debugging",sidebar_label:"Debugging",sidebar:"guides",previous:{title:"Architecture",permalink:"/docs/guides/nodegui-architecture"},next:{title:"Debugging in VSCode",permalink:"/docs/guides/debugging-in-vscode"}},l={rightToc:c,metadata:p},u="wrapper";function s(e){var n=e.components,t=Object(o.a)(e,["components"]);return Object(r.b)(u,Object(i.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"application-debugging"},"Application Debugging"),Object(r.b)("p",null,"Whenever your NodeGui application is not behaving the way you wanted it to,\nan array of debugging tools might help you find coding errors, performance\nbottlenecks, or optimization opportunities."),Object(r.b)("p",null,"Since a NodeGui application runs on Qode. And Qode is essentially NodeJs. We can consider a NodeGui app as a regular NodeJs app. Hence, you can use any debugging tool that you use with NodeJs\nOne of the most popular ways of debugging a NodeJs app is by making use of the ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://nodejs.org/en/docs/inspector/"}),"Chromium Developer Tools"),"."),Object(r.b)("p",null,"Google offers ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://developer.chrome.com/devtools"}),"excellent documentation for their developer tools"),".\nWe recommend that you make yourself familiar with them - they are usually one\nof the most powerful utilities in any NodeGui Developer's tool belt."),Object(r.b)("h2",{id:"debugging-qode-process"},"Debugging Qode process"),Object(r.b)("p",null,"To debug JavaScript that's executed in the Qode/Node process you will need to use an external debugger and\nlaunch Qode with the ",Object(r.b)("inlineCode",{parentName:"p"},"--inspect")," or ",Object(r.b)("inlineCode",{parentName:"p"},"--inspect-brk")," switch. Once you run it you can open up Chrome and visit ",Object(r.b)("inlineCode",{parentName:"p"},"chrome://inspect")," where you should see your app listed."),Object(r.b)("h3",{id:"command-line-switches"},"Command Line Switches"),Object(r.b)("p",null,"Use one of the following command line switches to enable debugging of the process:"),Object(r.b)("h4",{id:"--inspectport"},Object(r.b)("inlineCode",{parentName:"h4"},"--inspect=[port]")),Object(r.b)("p",null,"Qode will listen for V8 inspector protocol messages on the specified ",Object(r.b)("inlineCode",{parentName:"p"},"port"),",\nan external debugger will need to connect on this port. The default ",Object(r.b)("inlineCode",{parentName:"p"},"port")," is\n",Object(r.b)("inlineCode",{parentName:"p"},"9229"),"."),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-shell"}),"qode --inspect=9229 your/app\n")),Object(r.b)("h4",{id:"--inspect-brkport"},Object(r.b)("inlineCode",{parentName:"h4"},"--inspect-brk=[port]")),Object(r.b)("p",null,"Like ",Object(r.b)("inlineCode",{parentName:"p"},"--inspect")," but pauses execution on the first line of JavaScript."),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"Note")),Object(r.b)("p",null,"If you are using the official boilerplate ",Object(r.b)("inlineCode",{parentName:"p"},"nodegui-starter"),", then you can achieve this by running"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{}),"npm run debug\n")),Object(r.b)("h3",{id:"external-debuggers"},"External Debuggers"),Object(r.b)("p",null,"You will need to use a debugger that supports the V8 inspector protocol."),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"Connect Chrome by visiting ",Object(r.b)("inlineCode",{parentName:"li"},"chrome://inspect")," and selecting to inspect the\nlaunched NodeGui app present there."),Object(r.b)("li",{parentName:"ul"},Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"/docs/guides/debugging-in-vscode"}),"Debugging the NodeGui app in VSCode"))))}s.isMDXComponent=!0},367:function(e,n,t){"use strict";t.d(n,"a",(function(){return c})),t.d(n,"b",(function(){return s}));var i=t(0),o=t.n(i),r=o.a.createContext({}),a=function(e){var n=o.a.useContext(r),t=n;return e&&(t="function"==typeof e?e(n):Object.assign({},n,e)),t},c=function(e){var n=a(e.components);return o.a.createElement(r.Provider,{value:n},e.children)};var p="mdxType",l={inlineCode:"code",wrapper:function(e){var n=e.children;return o.a.createElement(o.a.Fragment,{},n)}},u=Object(i.forwardRef)((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,p=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&-1===n.indexOf(i)&&(t[i]=e[i]);return t}(e,["components","mdxType","originalType","parentName"]),u=a(t),s=i,d=u[c+"."+s]||u[s]||l[s]||r;return t?o.a.createElement(d,Object.assign({},{ref:n},p,{components:t})):o.a.createElement(d,Object.assign({},{ref:n},p))}));function s(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,a=new Array(r);a[0]=u;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c[p]="string"==typeof e?e:i,a[1]=c;for(var s=2;s<r;s++)a[s]=t[s];return o.a.createElement.apply(null,a)}return o.a.createElement.apply(null,t)}u.displayName="MDXCreateElement"}}]); |