忍者ブログ

[PR]

2024年11月24日 ()
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

install strace from source

2008年12月28日 (linux)

序章

straceを使おうと思ったらcommand not foundだった.のでインストール.

環境

  • kernel: 2.6.18-92.el5
  • gcc: 4.1.2
  • binutils: 2.17

インストール

# cd /usr/local/src
# wget http://ufpr.dl.sourceforge.net/sourceforge/strace/strace-4.5.18.tar.bz2
# tar jxvf strace-4.5.18.tar.bz2
# cd strace-4.5.18
# ./configure
# make
# make install

テスト

% cat >helloworld.c 
#include 

int main(int argc,char *argv[])
{
    printf("hello world\n");

    return(0);
}
% gcc helloworld.c 
% strace ./a.out 
execve("./a.out", ["./a.out"], [/* 34 vars */]) = 0
brk(0)                                  = 0x9628000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=43763, ...}) = 0
mmap2(NULL, 43763, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f18000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000o\262\0004\0\0\0X"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1602320, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f17000
mmap2(0xb11000, 1320356, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb11000
mmap2(0xc4e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13d) = 0xc4e000
mmap2(0xc51000, 9636, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xc51000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f16000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7f166c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xc4e000, 8192, PROT_READ)     = 0
mprotect(0x15b000, 4096, PROT_READ)     = 0
munmap(0xb7f18000, 43763)               = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f22000
write(1, "hello world\n"..., 12hello world
)        = 12
exit_group(0)                           = ?
[23:55:42][0]% 

できた.

PR
Comment
  Vodafone絵文字 i-mode絵文字 Ezweb絵文字
« /etc/inittab | HOME | iconv »