{"id":339,"date":"2011-09-22T17:55:29","date_gmt":"2011-09-22T17:55:29","guid":{"rendered":"http:\/\/www.blogs.abeazam.com\/dev\/?p=339"},"modified":"2011-09-22T17:55:29","modified_gmt":"2011-09-22T17:55:29","slug":"xcode-gdb-debugger-commands","status":"publish","type":"post","link":"http:\/\/www.blogs.abeazam.com\/dev\/2011\/09\/xcode-gdb-debugger-commands\/","title":{"rendered":"xCode GDB Debugger Commands"},"content":{"rendered":"<p>One of the things that I struggled with going from eclipse and Visual Studio to xCode was the the debugger. \u00a0Most of the objects have memory references rather than values. For a long time while developing iOS apps all i would get, or though I had was one cryptic error message. Till I discovered po which stands for print object. This allowed me to print out the contents of an object which can be very useful.<\/p>\n<p>Here is \u00a0list of gdb commands: (Warning properties are not identified by the\u00a0debugger\u00a0so dont use anything with dot notation)<\/p>\n<p><strong>po<\/strong> &#8211; print object &#8211; can be used to print out the likes of NSStrings and NSDictionaries<br \/>\nuse: po someObject<\/p>\n<p><strong>print<\/strong> &#8211; prints base types &#8211; used to print out to the screen ints floats and the like<br \/>\nuse: print myFloat<\/p>\n<p><strong>set<\/strong> &#8211; set a\u00a0variable\u00a0&#8211; allows you to set\u00a0variables<br \/>\nuse: \u00a0set someString=@&#8221;test&#8221;<\/p>\n<p><strong>call<\/strong> &#8211; calls a method &#8211; can be used to call methods or the properties getters and setters<br \/>\nuse: &#8211; call [someObjectInstance withString:@&#8221;newString&#8221;];<\/p>\n<p><strong>n<\/strong> &#8211; Next &#8211; always you to travers your code during breck<br \/>\nuse: n<\/p>\n<p>There are 2 main places you can use the commands.<\/p>\n<p>The first is the consol output during a break or crash just after the gdb:<br \/>\n<a href=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/debugScreen.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-348\" title=\"debugScreen\" src=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/debugScreen.jpg\" alt=\"\" width=\"559\" height=\"275\" \/><\/a><\/p>\n<p>The second is in a break point first set a break point then click the &#8220;Click to add action text&#8221; ass seen bellow.<br \/>\n<a href=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/ClickToAddAction.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-347\" title=\"ClickToAddAction\" src=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/ClickToAddAction.jpg\" alt=\"\" width=\"507\" height=\"149\" \/><\/a><\/p>\n<p>Now you can add you command in the newly\u00a0available text\u00a0field\u00a0that will always be\u00a0triggered\u00a0at that point in the code.<br \/>\n<a href=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/breakPointCommand.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-346\" title=\"breakPointCommand\" src=\"http:\/\/www.blogs.abeazam.com\/dev\/wp-content\/uploads\/2011\/09\/breakPointCommand.jpg\" alt=\"\" width=\"509\" height=\"196\" \/><\/a><\/p>\n<p>Carful with the\u00a0break\u00a0point\u00a0triggers\u00a0not to confuse your self if you put sets or calls in there.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the things that I struggled with going from eclipse and Visual Studio to xCode was the the debugger. \u00a0Most of the objects have memory references rather than values. For a long time while developing iOS apps all i would get, or though I had was one cryptic error message. Till I discovered po [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[25,26,28,36,37,53],"tags":[],"_links":{"self":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/339"}],"collection":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":0,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}