{"id":816,"date":"2008-01-28T03:00:00","date_gmt":"2008-01-27T18:00:00","guid":{"rendered":"https:\/\/ecoop.net\/memo\/2008-01-28-3.html"},"modified":"2008-01-28T03:00:00","modified_gmt":"2008-01-27T18:00:00","slug":"2008-01-28-3","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/2008-01-28-3.html","title":{"rendered":"tips &#8211; ltrace \u3067\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u95a2\u6570\u547c\u3073\u51fa\u3057\u3092\u30c8\u30ec\u30fc\u30b9\u3059\u308b"},"content":{"rendered":"<p>\n<a href=\"http:\/\/0xcc.net\/blog\/archives\/000103.html\">http:\/\/0xcc.net\/blog\/archives\/000103.html<\/a><br \/>\n\u3088\u308a\u3002\n<\/p>\n<blockquote><p>ltrace [ {\u30aa\u30d7\u30b7\u30e7\u30f3} ] {\u5b9f\u884c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0} [ {\u5f15\u6570..} ]\n<\/p><\/blockquote>\n<p>\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u4efb\u610f\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u7684\u306b\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u3092\u633f\u5165\u3057\u3066\u5b9f\u884c\u3057\u3001\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u306e\u547c\u3073\u51fa\u3057\u3092\u30c8\u30ec\u30fc\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u7c21\u5358\u306b\u3044\u3046\u3068 GDB \u3088\u308a\u9ad8\u7d1a\u306a\u30c7\u30d0\u30c3\u30ac\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<br \/>\n&nbsp;<br \/>\nLinux \u306e\u5834\u5408\u306f\u6a19\u6e96\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3053\u3068\u304c\u591a\u305d\u3046\u3067\u3059\u304c\u3001yum \u3084 apt-get \u3092\u4f7f\u3046\u5834\u5408\u306f\n<\/p>\n<blockquote><p>yum install ltrace\n<\/p><\/blockquote>\n<p>\u307e\u305f\u306f\n<\/p>\n<blockquote><p>apt-get install ltrace\n<\/p><\/blockquote>\n<p>\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f FreeBSD \u306e\u5834\u5408\u3082 ports \u306b\u542b\u307e\u308c\u3066\u3044\u308b\u305f\u3081\u3001\n<\/p>\n<blockquote><p>portinstall sysutils\/ltrace\n<\/p><\/blockquote>\n<p>\u3068\u3059\u308b\u3053\u3068\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<br \/>\n&nbsp;<br \/>\n\u5229\u7528\u4f8b: <br \/>\nls \/ \u3092\u5b9f\u884c\u3057\u30e9\u30a4\u30d6\u30e9\u30ea\u95a2\u6570\u3092\u30c8\u30ec\u30fc\u30b9\u3057\u3001log.txt \u306b\u30c8\u30ec\u30fc\u30b9\u7d50\u679c\u3092\u51fa\u529b\u3059\u308b(-o)\u3002\n<\/p>\n<blockquote><p>$ ltrace -o log.txt ls \/ # \u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u3068\u30c8\u30ec\u30fc\u30b9<br \/>\nbin   dev  home    lib         media  mnt  proc  sbin tmp  var<br \/>\nboot  etc  initrd  lost+found  misc   opt  root  sys  usr<br \/>\n$ cat log.txt # \u30c8\u30ec\u30fc\u30b9\u7d50\u679c\u53c2\u7167<br \/>\n_start(0xbff1abd4, 0xbff1abd7, 0, 0xbff1abd9, 0xbff1abf0 &lt;unfinished &#8230;><br \/>\n__libc_start_main(0x804ea41, 2, 0xbfe34df4, 0x8056f58, 0x8056fac &lt;unfinished &#8230;<br \/>\nsetlocale(6, &#8220;&#8221;)                                 = &#8220;en_US&#8221;<br \/>\nbindtextdomain(&#8220;coreutils&#8221;, &#8220;\/usr\/share\/locale&#8221;) = &#8220;\/usr\/share\/locale&#8221;<br \/>\ntextdomain(&#8220;coreutils&#8221;)                          = &#8220;coreutils&#8221;<br \/>\n__cxa_atexit(0x8053701, 0, 0, 0x805b570, 0xbfe34d68) = 0<br \/>\nis_selinux_enabled(0x8053701, 0xd1bbe4, 0x32206e75, 0x34312036, 0x3a30333a) = 0<br \/>\nisatty(1)                                        = 1<br \/>\n# \u4ee5\u4e0b\u7565\n<\/p><\/blockquote>\n<p>\u5229\u7528\u4f8b2: <br \/>\n\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30c8\u30ec\u30fc\u30b9\u3060\u3051\u3067\u306a\u304f\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u3082\u30c8\u30ec\u30fc\u30b9(-S)\u3057\u3001<br \/>\n\u95a2\u6570\u547c\u3073\u51fa\u3057\u306e\u95a2\u4fc2\u3092\u968e\u5c64\u69cb\u9020\u3067\u51fa\u529b\u3059\u308b(-n {number})\u3002\n<\/p>\n<blockquote><p>$ ltrace -o log2.txt -S -n 2 ls \/<br \/>\n# \u7565\n<\/p>\n<blockquote><p>$ cat log2.txt <br \/>\nSYS_uname(0xbfe4106c)                            = 0\n<\/p><\/blockquote>\n<p>SYS_brk(NULL)                                    = 0x99ca000<br \/>\nSYS_access(0xbffdc1, 4, 0xc03fd4, 0xbffdc1, 4)   = -2<br \/>\nSYS_open(&#8220;\/etc\/ld.so.cache&#8221;, 0, 00)              = 3<br \/>\n# \u4e2d\u7565<br \/>\nSYS_munmap(0xb7f92000, 4096)                     = 0<br \/>\n_start(0xbff20bd4, 0xbff20bd7, 0, 0xbff20bd9, 0xbff20bf0 &lt;unfinished &#8230;><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;__libc_start_main(0x804ea41, 2, 0xbfe412c4, 0x8056f58, 0x8056fac &lt;unfinished<br \/>\n&nbsp;&#8230;><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setlocale(6, &#8220;&#8221; &lt;unfinished &#8230;><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_open(&#8220;\/usr\/lib\/locale\/locale-archive&#8221;, 32768, 01540) = 3<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_fstat64(3, 0xd301a0, 0xd2eff4, 0xd301a0, 0xd0fc60) = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_mmap2(0, 0x200000, 1, 2, 3)      = 0xb7d82000<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_mmap2(0, 204800, 1, 2, 3)        = 0xb7d50000<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_mmap2(0, 4096, 1, 2, 3)          = 0xb7d4f000<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SYS_close(3)                         = 0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<... setlocale resumed> )                = &#8220;en_US&#8221;<br \/>\n# \u4ee5\u4e0b\u7565\n<\/p><\/blockquote>\n<p>\u5229\u7528\u4f8b3: \u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u7d4c\u904e\u6642\u9593\u3092\u4e00\u7dd2\u306b\u51fa\u529b\u3059\u308b(\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u7528\u9014\u306a\u3069)\n<\/p>\n<blockquote><p>$ ltrace -tt -o log.txt ls \/ # \u30de\u30a4\u30af\u30ed\u79d2\u5358\u4f4d<br \/>\n19:56:53.267749 SYS_uname(0xbff417dc)            = 0<br \/>\n19:56:53.267865 SYS_brk(NULL)                    = 0x9e12000<br \/>\n19:56:53.267917 SYS_access(0xbffdc1, 4, 0xc03fd4, 0xbffdc1, 4) = -2<br \/>\n# \u4ee5\u4e0b\u7565\n<\/p><\/blockquote>\n<p>-t \u306b\u3059\u308b\u3068 19:56:53 \u306e\u3088\u3046\u306b\u79d2\u5358\u4f4d\u3001-tt \u306b\u3059\u308b\u3068\u4f8b\u306e\u3088\u3046\u306b\u30de\u30a4\u30af\u30ed\u79d2\u5358\u4f4d\u3001 -ttt \u306b\u3059\u308b\u3068 \u30de\u30a4\u30af\u30ed\u79d2\u5358\u4f4d\u3067 1201517930.289331 \u306e\u3088\u3046\u306a UNIX \u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u5f62\u5f0f\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/0xcc.net\/blog\/archives\/000103.html \u3088\u308a\u3002 ltrace [ {\u30aa\u30d7\u30b7\u30e7\u30f3} ] {\u5b9f\u884c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0} [ {\u5f15\u6570..} ] \u306e\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u4efb\u610f\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u7684\u306b\u30d6\u30ec &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/2008-01-28-3.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">tips &#8211; ltrace \u3067\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u95a2\u6570\u547c\u3073\u51fa\u3057\u3092\u30c8\u30ec\u30fc\u30b9\u3059\u308b<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[25,20],"class_list":["post-816","post","type-post","status-publish","format-standard","hentry","tag-freebsd","tag-linux"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":0,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}