{"id":13135,"date":"2014-04-22T20:14:31","date_gmt":"2014-04-22T14:44:31","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=13135"},"modified":"2014-04-22T20:20:00","modified_gmt":"2014-04-22T14:50:00","slug":"simple-debugging-in-intellij-idea-part-1","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/simple-debugging-in-intellij-idea-part-1\/","title":{"rendered":"Debugging in IntelliJ IDEA: Part 1"},"content":{"rendered":"<p dir=\"ltr\">IntelliJ IDEA provides a handy debugger for grails<strong>,<\/strong> which simplifies debugging. Many people try avoiding using this awesome feature just because, either, they don&#8217;t want to leave the old habit of using <strong>printlns<\/strong> or they complain about the performance issue, and bla bla bla. As per my observation, there is no performance difference between run-app and debug app. May be they just need to change the mindset to take advantage of this helpful feature. If we run app in debug mode, for evaluating any expressions, we just set the breakpoints and evaluate the expressions with no need to reload the app, there by increasing our productivity.<\/p>\n<p dir=\"ltr\">I have decide to \u00a0cover \u2018Debugging in IntelliJ IDEA\u2019 in three part blog series as listed below;<strong><\/strong><\/p>\n<p dir=\"ltr\"><strong>Part 1-<\/strong> Simple Debugging in IntelliJ IDEA<\/p>\n<p dir=\"ltr\"><strong>Part 2-<\/strong> Remote debugging in IntelliJ IDEA<\/p>\n<p dir=\"ltr\"><strong>Part 3-<\/strong> Debug JavaScript in IntelliJ IDEA<\/p>\n<p dir=\"ltr\">Following are some steps to run your grails application in debug mode.<\/p>\n<p dir=\"ltr\"><strong>Setting breakpoints<\/strong><\/p>\n<p dir=\"ltr\">Set breakpoints in your grails app. This is most easy \u2013 just click the left gutter at the line you want the script to suspend.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/settingsBreakpoint.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13158\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/settingsBreakpoint.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p><strong>Run grails app in debug mode<\/strong><\/p>\n<p dir=\"ltr\">Select run menu and click on debug, now your application start in debug mode.<\/p>\n<p dir=\"ltr\"><strong>Examining the debugging information<\/strong><\/p>\n<p dir=\"ltr\">After starting application your program execution suspends when the first breakpoint is hit. Such a breakpoint is marked with a blue stripe.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/examiningDebugging1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13164\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/examiningDebugging1.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p dir=\"ltr\">You can press F8 to step to the next statement and f9 to step to the next breakpoint.<\/p>\n<p dir=\"ltr\">As you step through your application, the corresponding information appears in the debugger window.<\/p>\n<p dir=\"ltr\">Select examining variable then click on Add to Watches button in Watches window, output get displayed.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/selectexaminingVariable.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13159\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/selectexaminingVariable.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p dir=\"ltr\"><strong>Evaluate Expression<\/strong><\/p>\n<p dir=\"ltr\">You can evaluate any expression on clicking Evaluate Expression button in debugger window.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/evaluationbtn.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13165\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/evaluationbtn.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p dir=\"ltr\">Enter any expression which you want to evaluate then click on Evaluate button.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/evaluation.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13166\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/evaluation.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p dir=\"ltr\"><strong>View and Mute Breakpoints<\/strong><\/p>\n<p dir=\"ltr\">You can view all breakpoints on clicking View BreakPoints button in debugger window and also can remove or add breakpoints here .<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/viewandmutebrkpoint.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13157\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/viewandmutebrkpoint.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p dir=\"ltr\">There is also a button Mute Breakpoints button in this window.<\/p>\n<p dir=\"ltr\"><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/mutebrkpoint.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-13161\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/04\/mutebrkpoint.png\" alt=\"\" width=\"1360\" height=\"768\" \/><\/a><\/p>\n<p>This covered <strong>Simple debugging in IntelliJ\u00a0IDEA<\/strong> and We\u2019ll introduce <strong>Remote debugging in IntelliJ\u00a0IDEA<\/strong> in next coming part.<strong><br \/>\n<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>IntelliJ IDEA provides a handy debugger for grails, which simplifies debugging. Many people try avoiding using this awesome feature just because, either, they don&#8217;t want to leave the old habit of using printlns or they complain about the performance issue, and bla bla bla. As per my observation, there is no performance difference between run-app [&hellip;]<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":23},"categories":[7],"tags":[1394,1404,4840,1403,691],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/13135"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=13135"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/13135\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=13135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=13135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=13135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}