{"id":328,"date":"2014-02-16T00:13:25","date_gmt":"2014-02-15T15:13:25","guid":{"rendered":"http:\/\/tech.akat.info\/?p=328"},"modified":"2015-11-09T00:41:32","modified_gmt":"2015-11-08T15:41:32","slug":"linux%e3%81%ae%e3%83%87%e3%83%90%e3%83%83%e3%82%af%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=328","title":{"rendered":"linux\u306e\u30c7\u30d0\u30c3\u30af\u65b9\u6cd5"},"content":{"rendered":"<p>\u3044\u3064\u304b\u307e\u3068\u3081\u308b-\u30e1\u30e2<\/p>\n<h2>gdb<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n \u30b3\u30a2\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u5834\u5408\r\n gdb -c core\r\n bt\r\n \r\n (gdb) attach 2471\r\nAttaching to process 2471\r\nReading symbols from \/usr\/sbin\/winbindd...(no debugging symbols found)...done.\r\nReading symbols from \/lib\/x86_64-linux-gnu\/libcap.so.2...(no debugging symbols found)...done.\r\nLoaded symbols for \/lib\/x86_64-linux-gnu\/libcap.so.2\r\nReading symbols from \/lib\/x86_64-linux-gnu\/libresolv.so.2...(no debugging symbols found)...done.\r\nLoaded symbols for \/lib\/x86_64-linux-gnu\/libresolv.so.2\r\nReading symbols from \/lib\/x86_64-linux-gnu\/libnsl.so.1...(no debugging symbols found)...done.\r\nLoaded symbols for \/lib\/x86_64-linux-gnu\/libnsl.so.1\r\nReading symbols from \/lib\/x86_64-linux-gnu\/libdl.so.2...(no debugging symbols found)...done.\r\n\r\n(gdb) bt # \u73fe\u5728\u306e\u30d0\u30c3\u30af\u30c8\u30ec\u30fc\u30b9\u3092\u8868\u793a\u3059\u308b\r\n#0  0x00007f4459c73df8 in poll () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n#1  0x00007f445c95561e in sys_poll ()\r\n#2  0x00007f445c98c8dc in ?? ()\r\n#3  0x00007f445c98d460 in _tevent_loop_once ()\r\n#4  0x00007f445c89fc3b in main ()\r\n\r\n(gdb) info proc # \u30d7\u30ed\u30bb\u30b9\u60c5\u5831\u3092\u8868\u793a\u3059\u308b\r\nprocess 29027\r\ncmdline = 'php-fpm: master process (\/etc\/php5\/fpm\/php-fpm.conf)'\r\ncwd = '\/'\r\nexe = '\/usr\/sbin\/php5-fpm'\r\n\r\n(gdb) info threads # \u30b9\u30ec\u30c3\u30c9\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\r\n  Id   Target Id         Frame\r\n* 1    Thread 0x7f546190f720 (LWP 29027) &quot;php5-fpm&quot; 0x00007f545ecbd0d3 in epoll_wait () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n\r\n(gdb) info program # \u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u72b6\u614b\u3092\u8868\u793a\r\n        Using the running image of attached Thread 0x7fa5c6525780 (LWP 5776).\r\nProgram stopped at 0x7fa5c54cb2b3.\r\n\r\n(gdb) info locals # \u30ed\u30fc\u30ab\u30eb\u5909\u6570\u306e\u540d\u524d\u3068\u5024\u3092\u8868\u793a\r\nNo locals.\r\n\r\n(gdb) thread apply 1 bt # \u30b9\u30ec\u30c3\u30c9\u306b\u30b3\u30de\u30f3\u30c9\u3092\u9001\u4fe1\u3059\u308b\r\n\r\nThread 1 (Thread 0x7f546190f720 (LWP 29027)):\r\n#0  0x00007f545ecbd0d3 in epoll_wait () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n#1  0x0000000000757542 in ?? ()\r\n#2  0x000000000074e299 in ?? ()\r\n#3  0x0000000000748e57 in ?? ()\r\n#4  0x0000000000431214 in ?? ()\r\n#5  0x00007f545ec00ead in __libc_start_main () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n#6  0x0000000000432501 in _start ()\r\n\r\n(gdb) show # \u5404\u7a2e\u8a2d\u5b9a\u3092\u8868\u793a\u3059\u308b\r\nada trust-PAD-over-XVS:  Whether an optimization trusting PAD types over XVS types is activated is on.\r\nannotate:  Annotation_level is 0.\r\narchitecture:  The target architecture is set automatically (currently i386:x86-64)\r\nargs:  Argument list to give program being debugged when it is started is &quot;&quot;.\r\nauto-load-scripts:  The debugger's behaviour regarding auto-loaded scripts is on.\r\nauto-solib-add:  Autoloading of shared library symbols is on.\r\n\r\n(gdb) run \/var\/www\/htdocs\/a.php\r\nStarting program: \/usr\/bin\/php5 \/var\/www\/htdocs\/a.php\r\n&#x5B;Thread debugging using libthread_db enabled]\r\nUsing host libthread_db library &quot;\/lib\/x86_64-linux-gnu\/libthread_db.so.1&quot;.\r\n&#x5B;New Thread 0x7ffff0f09700 (LWP 1497)]\r\n&#x5B;Thread 0x7ffff0f09700 (LWP 1497) exited]\r\narray(1) {\r\n  &#x5B;0]=&gt;\r\n  string(21) &quot;\/var\/www\/htdocs\/a.php&quot;\r\n}\r\n&#x5B;Inferior 1 (process 1494) exited normally]\r\n\r\n\r\n(gdb) quit\r\n\r\n(gdb) where\r\n#0  0x00007f545ecbd0d3 in epoll_wait () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n#1  0x0000000000757542 in ?? ()\r\n#2  0x000000000074e299 in ?? ()\r\n#3  0x0000000000748e57 in ?? ()\r\n#4  0x0000000000431214 in ?? ()\r\n#5  0x00007f545ec00ead in __libc_start_main () from \/lib\/x86_64-linux-gnu\/libc.so.6\r\n#6  0x0000000000432501 in _start ()\r\n<\/pre>\n<p>https:\/\/www.ibm.com\/developerworks\/jp\/linux\/library\/l-debug\/<\/p>\n<h2>strace<\/h2>\n<p>strace\u306f\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u30c8\u30ec\u30fc\u30b5\u3067\u3001\u3059\u3067\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u3063\u3066\u767a\u305b\u3089\u308c\u305f\u30b3\u30fc\u30eb\u3092\u8ffd\u8de1\u3059\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@akat:\/home\/akat# strace -tt -s 1024 -p 29027\r\nProcess 29027 attached - interrupt to quit\r\n00:01:46.929454 clock_gettime(CLOCK_MONOTONIC, {6643581, 965972053}) = 0\r\n00:01:46.930045 clock_gettime(CLOCK_MONOTONIC, {6643581, 966349703}) = 0\r\n00:01:46.930632 epoll_wait(7, {}, 1, 179) = 0\r\n00:01:47.110395 clock_gettime(CLOCK_MONOTONIC, {6643582, 146960800}) = 0\r\n00:01:47.111103 clock_gettime(CLOCK_MONOTONIC, {6643582, 147427003}) = 0\r\n00:01:47.111410 getsockopt(6, SOL_TCP, TCP_INFO, &quot;\\n&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;@B\\17&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\30\\2&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\200&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\340p\\370\\213&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\340p\\370\\213\\340p\\370\\213&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\220\\320\\3&#92;&#48;\\377\\377\\377\\177\\n&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;\\3&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&#92;&#48;&quot;, &#x5B;104]) = 0\r\n00:01:47.111942 clock_gettime(CLOCK_MONOTONIC, {6643582, 148215308}) = 0\r\n00:01:47.112281 epoll_wait(7, ^C &lt;unfinished ...&gt;\r\nProcess 29027 detached\r\n<\/pre>\n<h2>mysql<\/h2>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nfile \/usr\/sbin\/mysqld # dynamically linked\u3067\u306a\u3051\u308c\u3070\u3001nm\u30b3\u30de\u30f3\u30c9\u306e-D\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u4e0d\u8981\r\nnm -n -D \/usr\/sbin\/mysqld &gt; mysqld.sym\r\nlv mysqld.sym\r\nresolve_stack_dump -s mysqld.sym -n \/var\/log\/mysql\/error.log &gt; mysqld.stack\r\n<\/pre>\n<h2>\u53c2\u8003<\/h2>\n<p>http:\/\/techblog.yahoo.co.jp\/tips\/php\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3044\u3064\u304b\u307e\u3068\u3081\u308b-\u30e1\u30e2 gdb \u30b3\u30a2\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u5834\u5408 gdb -c core bt (gdb) attach 2471 Attaching to process 2471 Reading symbols from \/us [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2,8],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/328"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=328"}],"version-history":[{"count":7,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions"}],"predecessor-version":[{"id":2350,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions\/2350"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}