{"id":187,"date":"2009-03-04T19:27:25","date_gmt":"2009-03-05T03:27:25","guid":{"rendered":"http:\/\/www.visophyte.org\/blog\/?p=187"},"modified":"2009-09-12T05:11:14","modified_gmt":"2009-09-12T13:11:14","slug":"gaudily-colorized-gdb-backtraces-woo","status":"publish","type":"post","link":"https:\/\/www.visophyte.org\/blog\/2009\/03\/04\/gaudily-colorized-gdb-backtraces-woo\/","title":{"rendered":"gaudily colorized gdb backtraces! woo!"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-188\" title=\"pythongdb-gaudy-groupview-crash-1\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2009\/03\/pythongdb-gaudy-groupview-crash-1.png\" alt=\"pythongdb-gaudy-groupview-crash-1\" width=\"760\" height=\"408\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2009\/03\/pythongdb-gaudy-groupview-crash-1.png 760w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2009\/03\/pythongdb-gaudy-groupview-crash-1-600x322.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2009\/03\/pythongdb-gaudy-groupview-crash-1-300x161.png 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/p>\n<p>Like many people who have overdosed on syntax highlighting and other forms of colorization, my brain is no longer able to process monochrome text displays.\u00a0 Which is why I have been so excited about <a href=\"http:\/\/sourceware.org\/gdb\/wiki\/PythonGdb\">gdb with python crammed inside<\/a>.\u00a0 (The good sense of &#8220;crammed&#8221;, wherein one is cramming cookies in one&#8217;s mouth.)\u00a0 I have perverted its spirit and used it to colorize gdb backtraces!\u00a0 Woo!<\/p>\n<p>While I was in there, I have done two useful things:<\/p>\n<ul>\n<li>There is magic of limited potency that normalizes the path automatically.<\/li>\n<li>It looks at all the values in the arguments (and locals too, I guess) and if they are used more than once, it considers making them &#8220;interesting&#8221;.\u00a0 Interesting values get named based on where we first saw them, and assigned a color.\u00a0 Then, whenever they appear in the backtrace, they get their special name and color to help us see the flow of values through the backtrace.\u00a0 For example, in the screenshot above you can see &#8220;this5&#8221; in a nice* blue color.\u00a0 Each time its value appears, the &#8220;this5&#8221; label appears (the 5 is for frame 5).\u00a0 I find this easier than manually scanning using my brain.<\/li>\n<\/ul>\n<p>My hg repo is here: <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/pythongdb-gaudy\/\">http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/pythongdb-gaudy\/<\/a><\/p>\n<p>If you like this, or if you don&#8217;t like this but do like useful things, you are even more likely to like Jim Blandy&#8217;s <a href=\"http:\/\/hg.mozilla.org\/users\/jblandy_mozilla.com\/archer-mozilla\/\">archer-mozilla<\/a> repo which is full of magic debugging help for spidermonkey in gdb.\u00a0 (nb: The python-gdb trunk right now has changed how pretty printers register, and I don&#8217;t think that repo has yet caught up.)\u00a0 Also, see <a href=\"http:\/\/tromey.com\/blog\/?cat=17\">Tom Tromey&#8217;s blog posts about the whole python-gdb thing<\/a>.<\/p>\n<p>* When I use &#8220;nice&#8221; in terms of colors, this is from my perspective as someone who demands many colors, has the time to add crazy colors to everything, but inexplicably does not have the time to actually pick colors that humans find appealing (or even non-nauseating).\u00a0 I am going to pass the buck to the people who originally conceived of 256-color xterms and thought I could be trusted with a color cube, no matter how limited.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Like many people who have overdosed on syntax highlighting and other forms of colorization, my brain is no longer able to process monochrome text displays.\u00a0 Which is why I have been so excited about gdb with python crammed inside.\u00a0 (The &hellip; <a href=\"https:\/\/www.visophyte.org\/blog\/2009\/03\/04\/gaudily-colorized-gdb-backtraces-woo\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7,4],"tags":[27,31,128],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-debugging","category-visualizing","tag-colors","tag-gdb","tag-shiny"],"_links":{"self":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/comments?post=187"}],"version-history":[{"count":4,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/187\/revisions"}],"predecessor-version":[{"id":395,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/187\/revisions\/395"}],"wp:attachment":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/media?parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/categories?post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/tags?post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}