動機
下準備 / インストール
$ git clone git@github.com:soarpenguin/procps-3.0.5.git
- とりあえず 無意識で install すると、
/usr/bin
にインストールされるので、注意( VM ならまぁ問題なかろう)
- tmp に作ることにする。
- なお、Makefile の書き方も読み方も全く知らない
$ mkdir /tmp/sample
$ cd procps-3.0.5
$ make
# 空気的に DESTDIR で ビルドディレクトリ指定するっぽいのでしている
$ sudo make install DESTDIR=/tmp/sample
install -D --owner 0 --group 0 --mode a=rx --strip uptime /tmp/sample/usr/bin/uptime
install -D --owner 0 --group 0 --mode a=rx --strip tload /tmp/sample/usr/bin/tload
install -D --owner 0 --group 0 --mode a=rx --strip free /tmp/sample/usr/bin/free
install -D --owner 0 --group 0 --mode a=rx --strip w /tmp/sample/usr/bin/w
install -D --owner 0 --group 0 --mode a=rx --strip top /tmp/sample/usr/bin/top
install -D --owner 0 --group 0 --mode a=rx --strip vmstat /tmp/sample/usr/bin/vmstat
install -D --owner 0 --group 0 --mode a=rx --strip watch /tmp/sample/usr/bin/watch
install -D --owner 0 --group 0 --mode a=rx --strip skill /tmp/sample/usr/bin/skill
$ gdb /tmp/sample/usr/bin/top
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/sample/usr/bin/top...(no debugging symbols found)...done.
- と思いきや、
no debugging symbols found
と出る
- 明らかにダメっぽかったので、StackOverflow で聞いてみた。
stackoverflow.com
- すると、
gdb
の オプションの strip
がダメっぽかったので、--strip
オプションを外してみた
- 以下は
git diff
の結果
- 今度はビルドメッセージに
--strip
が出なかったので、起動してみる
$ gdb /tmp/sample/usr/bin/top
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/sample/usr/bin/top...done.
- すると今度は
no debugging..
が出ない
(gdb) b configs_read
# Ctr-x + a で画面を出す
(gdb) r
- どうやらアタッチ出来たっぽい。
- これで恐らくソースを追うことが出来るだろう。
- 次回に続く(多分)