Programming camp Codereading

Embed Size (px)

Citation preview

MIRACLE LINUX

2009

2009813

Debug HacksYLUG(Linux Users Group)

/hyoshio
http://d.hatena.ne.jp/hyoshiok


http://blog.miraclelinux.com/yume/

[email protected]

http://twitter.com/hyoshiok


OSS


OSRDBMS



100K
100
10

100K1M
1001000
100

1M
1000
100

find -type f -name "*.[ch]"|wc

find -type f -name "*.[ch]"|xargs wc|grep total

doc

lib

test

README, INSTALL, COPYING,

(Docs)

ChangeLog

ChangeLog/Release Notes

Linux git/Subversion/CVS

Mailing List

Wiki

blog

Google

Mailing List

Bug database

emacs

gdb

cscope

(crash)

ruby

GNU Hello

http://savannah.gnu.org/projects/hello


$ git-clone git:// ()


README


- automake
- autoconf
- bison
- gettext
- git
- gperf
- gzip
- perl
- rsync
- tar


$ time git clone ssh:// ()
$ cd ruby
$ time autoconf
$ time ./configure
$ time make
$ time make test

$ git checkout -b trunk origin/trunk

$ autoconf

./configure

make -j4 miniruby

make

strace

ltrace

gdb

oprofile

make

make

gcc -g (
MakefileCFLAGS

cscope

emacsshell

strace


$ strace ruby -vexecve("/usr/local/bin/ruby", ["ruby", "-v"], [/* 39 vars */]) = 0uname({sys="Linux", node="asianux2.miraclelinux.com", ...}) = 0brk(0) = 0x976a000access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)open("/etc/ld.so.cache", O_RDONLY) = 3fstat64(3, {st_mode=S_IFREG|0644, st_size=89946, ...}) = 0old_mmap(NULL, 89946, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fea000close(3) = 0open("/lib/libdl.so.2", O_RDONLY) = 3

gdb


http://savannah.gnu.org/projects/gdb

gdb

gcc -g

printf

gdb

run

bt

p

c s n

oprofile

# opcontrol --start

# opcontrol --stop

# opreport -l

http://oprofile.sourceforge.net/news/

oprofile

CPU: Core Solo / Duo, speed 2666.77 MHz (estimated)

Counted DCACHE_PEND_MISS events (Weighted cycles of L1 miss outstanding) with

a unit mask of 0x00 (Weighted cycles) count 100000

vma samples % linenr info app name symbol name

000000000042be50 244787 33.2383 gc.c:1661 ruby os_each_obj

000000000042bfac 1 4.1e-04 gc.c:1599

000000000042bfb9 5 0.0020 gc.c:1599

000000000042bfbe 6 0.0025 gc.c:1599

000000000042bfd0 4862 1.9862 gc.c:1601

000000000042bfd3 228573 93.3763 gc.c:1601

000000000042bfd6 2698 1.1022 gc.c:1601

000000000042bfd8 250 0.1021 ruby.h:672

oprofile

$ time find -type f -name \ '*.[ch]' -or -name '*.cpp' \ -or -name '*.cxx' | xargs \ egrep -l hogehoge

$ time grep -r \
include='*.[ch]' hogehoge .

hogehoge

cscope
http://cscope.sourceforge.net/

lxr
http://lxr.linux.no/

GNU GLOBAL
http://www.gnu.org/software/global/

ack-grep

cscope
$ time cscope-indexer -r

emacs

gdb

oprofile

Linux

LINUX
ISBN:487311313X

Linux2.6
ISBN:4797338261

ISBN:4839912653

Ruby

ISBN:4844317210(
http://i.loveruby.net/ja/rhg/

http://blog.miraclelinux.com/yume/

(524)

http://blog.miraclelinux.com/yume/2007/08/post_d6bd.html

99)

http://blog.miraclelinux.com/yume/2007/08/post_d3eb.html

http://blog.miraclelinux.com/yume/

/hyoshiok

http://d.hatena.ne.jp/hyoshiok/

2

3

4

5

6

7

8

9

08/13/09

MIRACLE LINUX

2

3

4

5

6

7

8

9

Ruby 1.8.5257197767

Linux 2.6.1816522680

MySQL 5.0.24a1795988463

??? ??? (???)2008/07/30, 09:21:45 /

??? ??? (???)2007/10/15, 21:13:50 /

ChangeLog

??? ??? (???)2007/10/15, 21:13:51 /

ChangeLogcscope

(gdb)straceoprofilestrace

??? ??? (???)2007/10/16, 09:49:57 /