{"id":760,"date":"2011-03-30T22:20:22","date_gmt":"2011-03-31T06:20:22","guid":{"rendered":"http:\/\/www.visophyte.org\/blog\/?p=760"},"modified":"2011-03-30T22:20:22","modified_gmt":"2011-03-31T06:20:22","slug":"unified-jsc-backtraces-colorized-backtraces-colorized-source-listing-for-gdb-7-3archer-trunk-updated","status":"publish","type":"post","link":"https:\/\/www.visophyte.org\/blog\/2011\/03\/30\/unified-jsc-backtraces-colorized-backtraces-colorized-source-listing-for-gdb-7-3archer-trunk-updated\/","title":{"rendered":"unified JS\/C++ backtraces, colorized backtraces, colorized source listing for gdb 7.3\/archer-trunk updated"},"content":{"rendered":"<div id=\"attachment_762\" style=\"width: 686px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-762\" class=\"size-full wp-image-762\" title=\"mbt-indexed\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/mbt-indexed.png\" alt=\"\" width=\"676\" height=\"333\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/mbt-indexed.png 676w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/mbt-indexed-600x295.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/mbt-indexed-300x147.png 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><p id=\"caption-attachment-762\" class=\"wp-caption-text\">type &quot;mbt&quot;, see this.<\/p><\/div>\n<p>gdb has had <a href=\"http:\/\/sourceware.org\/gdb\/wiki\/PythonGdb\">integrated python support<\/a> for some time and it is truly awesome. \u00a0The innards have changed here and there, so my previous efforts to <a href=\"http:\/\/www.visophyte.org\/blog\/2009\/03\/04\/gaudily-colorized-gdb-backtraces-woo\/\">show colorized\/fancy backtraces<\/a>, <a href=\"http:\/\/www.visophyte.org\/blog\/2009\/04\/25\/gaudily-syntax-highlighted-code-listings-in-archer-gdb\/\">show colorized source listings<\/a>, and <a href=\"http:\/\/www.visophyte.org\/blog\/2009\/09\/12\/prototype-unified-javascriptc-back-traces-for-mozilla-in-archer-gdb\/\">provide unified JS\/C++ mozilla backtraces<\/a> (with colors still) have experienced some bit-rot over time.<\/p>\n<div id=\"attachment_763\" style=\"width: 479px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-763\" class=\"size-full wp-image-763\" title=\"cbt\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/cbt.png\" alt=\"\" width=\"469\" height=\"335\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/cbt.png 469w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/cbt-300x214.png 300w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><p id=\"caption-attachment-763\" class=\"wp-caption-text\">type &quot;cbt&quot;, see this<\/p><\/div>\n<p>I have de-bitrotted the changes, hard. \u00a0Hard in this case means that the changes depend on gdb 7.3 which only exists in the future or <a href=\"http:\/\/sourceware.org\/gdb\/wiki\/PythonGdb\">in the archer repo you can find on this wiki page<\/a>, or maybe in gdb upstream but I already had the archer repo checked out&#8230;<\/p>\n<div id=\"attachment_764\" style=\"width: 622px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-764\" class=\"size-full wp-image-764\" title=\"sl\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/sl.png\" alt=\"\" width=\"612\" height=\"319\" srcset=\"https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/sl.png 612w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/sl-600x312.png 600w, https:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2011\/03\/sl-300x156.png 300w\" sizes=\"auto, (max-width: 612px) 100vw, 612px\" \/><p id=\"caption-attachment-764\" class=\"wp-caption-text\">type &quot;sl&quot;, see this.<\/p><\/div>\n<p>In any event, if you like gdb and work with mozilla, you will not only want these things, but also <a href=\"http:\/\/hg.mozilla.org\/users\/jblandy_mozilla.com\/archer-mozilla\/\">Jim Blandy&#8217;s mozilla-archer repo<\/a> which has magic SpiderMonkey JS helpers (one of which mozbt depends on; those JSStrings are crazy, yo!). \u00a0Coincidentally, he also depends on the future, and his README tells you how to check out the archer branch in greater detail.<\/p>\n<p>You can get your own copy of these very exciting gdb python things from my github <a href=\"https:\/\/github.com\/asutherland\/pythongdb-gaudy\">pythongdb-gaudy repo<\/a>.<\/p>\n<p>The important notes for the unified backtrace are:<\/p>\n<ul>\n<li>It does&#8217;t work with the tracing JIT; the trace JIT doesn&#8217;t produce the required frames during its normal operation.<\/li>\n<li>It might work with the method JIT if gdb could unwind method JIT frames, but it doesn&#8217;t seem to do that yet. \u00a0(Or I didn&#8217;t build with the right flag to tell it to use a frame pointer\/etc., or I am using the wrong gdb branch\/etc.) \u00a0Once the Method JIT starts telling gdb about its generated code with debug symbols and the performance issues in gdb&#8217;s JIT interface are dealt with, you can just use the colorizing backtrace because no special logic is required to interleave frames at that point and Jim Blandy&#8217;s magic JS pretty printers should &#8216;just work&#8217;.<\/li>\n<li>Don&#8217;t forget that if you just want a pure JS backtrace (and with all kinds of fanciness) and have a debug build, you can just do &#8220;call DumpJSStack()&#8221; in gdb and it will call back into XPConnect and invoke the C++ code that authoritatively knows how to walk this stuff.<\/li>\n<li>If you&#8217;re cool and using generators, then you&#8217;re stuck with the interpreter, so it will totally work.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>gdb has had integrated python support for some time and it is truly awesome. \u00a0The innards have changed here and there, so my previous efforts to show colorized\/fancy backtraces, show colorized source listings, and provide unified JS\/C++ mozilla backtraces (with &hellip; <a href=\"https:\/\/www.visophyte.org\/blog\/2011\/03\/30\/unified-jsc-backtraces-colorized-backtraces-colorized-source-listing-for-gdb-7-3archer-trunk-updated\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7],"tags":[27,58,31,128],"class_list":["post-760","post","type-post","status-publish","format-standard","hentry","category-debugging","tag-colors","tag-gaudy","tag-gdb","tag-shiny"],"_links":{"self":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/760","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=760"}],"version-history":[{"count":6,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/760\/revisions"}],"predecessor-version":[{"id":770,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/760\/revisions\/770"}],"wp:attachment":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/media?parent=760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/categories?post=760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/tags?post=760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}