{"id":139400,"date":"2020-07-12T17:33:05","date_gmt":"2020-07-12T09:33:05","guid":{"rendered":"http:\/\/4563.org\/?p=139400"},"modified":"2020-07-12T17:33:05","modified_gmt":"2020-07-12T09:33:05","slug":"%e6%b1%82%e9%97%ae-linux-gdb-%e6%9c%89%e4%bb%80%e4%b9%88%e5%91%bd%e4%bb%a4%e5%8f%af%e4%bb%a5%e7%9b%b4%e6%8e%a5%e6%8a%8a-memory-dump-%e4%bc%a0%e9%80%92%e5%88%b0%e6%89%93%e5%8d%b0%e6%9c%ba%e6%89%93","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=139400","title":{"rendered":"\u6c42\u95ee Linux gdb \u6709\u4ec0\u4e48\u547d\u4ee4\u53ef\u4ee5\u76f4\u63a5\u628a memory dump \u4f20\u9012\u5230\u6253\u5370\u673a\u6253\u5370\u5230\u7eb8\u4e0a\u4e48\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6c42\u95ee Linux gdb \u6709\u4ec0\u4e48\u547d\u4ee4\u53ef\u4ee5\u76f4\u63a5\u628a memory dump \u4f20\u9012\u5230\u6253\u5370\u673a\u6253\u5370\u5230\u7eb8\u4e0a\u4e48\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : levelworm <\/span>  <span><i><\/i> 10<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5728\u5b66\u6700\u521d\u7ea7\u7684\u9006\u5411\uff0c\u611f\u89c9\u5982\u679c\u80fd\u591f\u628a<code>x 0x400da0<\/code>\u4e4b\u540e\u663e\u793a\u7684\u51fd\u6570\u5185\u5bb9\u76f4\u63a5\u6253\u5370\u5230\u7eb8\u4e0a\uff0c\u7136\u540e\u5728\u540e\u9762\u81ea\u5df1\u624b\u5199\u6ce8\u91ca\u662f\u6700\u8212\u670d\u7684\u3002\u4f46\u662f\u6211\u67e5\u770b\u4e86<code>gdb<\/code>\u6240\u6709\u7684\u547d\u4ee4\uff0c\u53d1\u73b0\u5e76\u6ca1\u6709\u53ef\u4ee5\u6253\u5370\u5230\u7eb8\u4e0a\u7684\uff0c\u540c\u65f6\u6211\u53c8\u4e0d\u60f3\u901a\u8fc7 pipeline \u6765\u8f93\u51fa\u5230\u6253\u5370\u673a\uff0c\u8bf7\u95ee\u6709\u529e\u6cd5\u5728 gdb \u5185\u90e8\u5b8c\u6210\u8fd9\u4e2a\u4e8b\u9879\u5417\uff1f\u8c22\u8c22~~<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2631058\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lonewolfakela <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6240\u4ee5\u4f60\u4e3a\u5565\u4e0d\u60f3\u901a\u8fc7 pipeline \u6765\u8f93\u51fa\u5230\u6253\u5370\u673a\u5462\u2026\u2026                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2631059\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : levelworm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lonewolfakela \u80fd\u591f\u5728 gdb \u91cc\u5934\u4e0d\u7528\u9000\u51fa\u5c31\u884c\u4e48\uff1f\u5982\u679c\u53ef\u4ee5\u7684\u8bdd\u6700\u597d\u4e86\uff0c\u591a\u8c22\uff01<br \/>\u8bdd\u8bf4\u8fd8\u4e0d\u77e5\u9053\u5982\u4f55 pipe \u8fdb\u6253\u5370\u673a\u4e0d\u8fc7\u8ba9\u6211\u67e5\u4e00\u4e0b\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2631060\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : listenerri <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u636e\u6211\u6240\u77e5 gdb \u652f\u6301 python\/shell \u6269\u5c55\uff0c\u4e3b\u53ef\u4ee5\u60f3\u4e00\u4e0b\u600e\u4e48\u81ea\u5df1\u5b9e\u73b0\u6253\u5370\uff0c\u8d34\u4e00\u4e0b\u6211\u7684\u90e8\u5206\u914d\u7f6e\uff1a<br \/>&#8220;`<br \/># pretty print qt type value<br \/># &#8220;Lekensteyn\/qt5printers&#8221; github project needed be cloned into &#8220;~\/.config\/gdb\/&#8221;<br \/>python<br \/>import sys, os.path<br \/>sys.path.insert(0, os.path.expanduser(&#8216;~\/.config\/gdb&#8217;))<br \/>import qt5printers<br \/>qt5printers.register_printers(gdb.current_objfile())<br \/>end<\/p>\n<p># hexdump specified memory block<br \/>define hexdump<br \/>dump memory \/tmp\/dump.bin $arg0 $arg0+$arg1<br \/>shell hexdump -C \/tmp\/dump.bin<br \/>end<\/p>\n<p># alias for above hexdump<br \/>define hd<br \/>dump memory \/tmp\/dump.bin $arg0 $arg0+$arg1<br \/>shell hexdump -C \/tmp\/dump.bin<br \/>end<\/p>\n<p>&#8220;`                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2631061\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lonewolfakela <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @levelworm \u5982\u679c\u662f\u4e0d\u60f3\u9000\u51fa\u7684\u8bdd\uff0c\u53ef\u4ee5\u53c2\u8003 https:\/\/stackoverflow.com\/questions\/5941158\/gdb-print-to-file-instead-of-stdout\uff0c\u8bbe\u7f6e gdb \u628a\u8f93\u51fa\u5199\u8fdb\u6587\u4ef6\u91cc\uff0c\u4e4b\u540e\u6253\u5370\u6587\u4ef6\u4ec0\u4e48\u7684\u5e94\u8be5\u5c31\u6ca1\u5565\u56f0\u96be\u7684\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2631062\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lamy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u6709\u4e2a\u65b9\u6cd5\uff0cshell \u91cc\u6267\u884c script\uff0c\u4f1a\u628a shell \u7684\u6240\u6709\u8f93\u51fa\u8f93\u51fa\u5230\u6587\u4ef6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u95ee Linux gdb \u6709\u4ec0\u4e48\u547d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/139400"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=139400"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/139400\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=139400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=139400"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=139400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}