OSDN Git Service

LDP: Update drafts (based on PO updates)
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / backtrace.3
index 9822d23..d007971 100644 (file)
@@ -1,6 +1,7 @@
 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
 .\" drawing on material by Justin Pryzby <pryzbyj@justinpryzby.com>
 .\"
+.\" %%%LICENSE_START(PERMISSIVE_MISC)
 .\" Permission is hereby granted, free of charge, to any person obtaining
 .\" a copy of this software and associated documentation files (the
 .\" "Software"), to deal in the Software without restriction, including
 .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+.\" %%%LICENSE_END
 .\"
 .\" References:
 .\"   glibc manual and source
+.\"*******************************************************************
 .\"
-.\" Japanese Version Copyright (c) 2007  Akihiro MOTOKI
-.\"         all rights reserved.
-.\" Translated 2007-10-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.66
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH BACKTRACE 3 2008-06-14 GNU "Linux Programmer's Manual"
-.\"O .SH NAME
+.\"*******************************************************************
+.TH BACKTRACE 3 2008\-06\-14 GNU "Linux Programmer's Manual"
 .SH 名前
-.\"O backtrace, backtrace_symbols, backtrace_symbols_fd \- support
-.\"O for application self-debugging
-backtrace, backtrace_symbols, backtrace_symbols_fd \- 
-アプリケーション自身でのデバッグのサポート
-.\"O .SH SYNOPSIS
+backtrace, backtrace_symbols, backtrace_symbols_fd \- アプリケーション自身でのデバッグのサポート
 .SH 書式
-.B #include <execinfo.h>
+\fB#include <execinfo.h>\fP
 
-.B int backtrace(void
-.BI ** buffer ,
-.B int
-.IB size );
+\fBint backtrace(void\fP \fB**\fP\fIbuffer\fP\fB,\fP \fBint\fP \fIsize\fP\fB);\fP
 
-.B char **backtrace_symbols(void *const
-.BI * buffer ,
-.B int
-.IB size );
+\fBchar **backtrace_symbols(void *const\fP \fB*\fP\fIbuffer\fP\fB,\fP \fBint\fP
+\fIsize\fP\fB);\fP
 
-.B void backtrace_symbols_fd(void *const
-.BI * buffer ,
-.B int
-.IB size ,
-.B int
-.IB fd );
-.\"O .SH DESCRIPTION
+\fBvoid backtrace_symbols_fd(void *const\fP \fB*\fP\fIbuffer\fP\fB,\fP \fBint\fP
+\fIsize\fP\fB,\fP \fBint\fP \fIfd\fP\fB);\fP
 .SH 説明
-.\"O .BR backtrace ()
-.\"O returns a backtrace for the calling program,
-.\"O in the array pointed to by
-.\"O .IR buffer .
-.\"O A backtrace is the series of currently active function calls for
-.\"O the program.
-.\"O Each item in the array pointed to by
-.\"O .I buffer
-.\"O is of type \fIvoid *\fP, and is the return address from
-.\"O the corresponding stack frame.
-.BR backtrace ()
-は、呼び出したプログラムのバックトレースを
-.I buffer
-が指す配列に入れて返す。バックトレースは、プログラムで
-現在動作中の関数呼び出しの並びである。
-.I buffer
-が指す配列の個々の要素は \fIvoid *\fP 型で、
-対応するスタックフレームからのリターンアドレスである。
-.\"O The
-.\"O .I size
-.\"O argument specifies the maximum number of addresses
-.\"O that can be stored in
-.\"O .IR buffer .
-.\"O If the backtrace is larger than
-.\"O .IR size ,
-.\"O then the addresses corresponding to the
-.\"O .I size
-.\"O most recent function calls are returned;
-.\"O to obtain the complete backtrace, make sure that
-.\"O .I buffer
-.\"O and
-.\"O .I size
-.\"O are large enough.
-.I size
-引き数は
-.I buffer
-に格納できるアドレスの最大個数を指定する。
-バックトレースが
-.I size
-より大きい場合、
-.I size
-個の直近の関数呼び出しに対応するアドレスが返される。
-完全なバックトレースを取得するためには、確実に
-.I buffer
-と
-.I size
-が十分大きくなるようにすること。
-
-.\"O Given the set of addresses returned by
-.\"O .BR backtrace ()
-.\"O in
-.\"O .IR buffer ,
-.\"O .BR backtrace_symbols ()
-.\"O translates the addresses into an array of strings that describe
-.\"O the addresses symbolically.
-.BR backtrace ()
-によって
-.I buffer
-にアドレスの集合が得られたら、
-.BR backtrace_symbols ()
-によって、アドレス集合を、そのアドレスをシンボルで表した文字列の配列
-に翻訳できる。
-.\"O The
-.\"O .I size
-.\"O argument specifies the number of addresses in
-.\"O .IR buffer .
-.I size
-引き数は
-.I buffer
-に格納されたアドレスの数を指定する。
-.\"O The symbolic representation of each address consists of the function name
-.\"O (if this can be determined), a hexadecimal offset into the function,
-.\"O and the actual return address (in hexadecimal).
-個々のアドレスのシンボル表現は、関数名 (特定できた場合)、
-関数へのオフセット (16進表記)、実際のリターンアドレス (16進表記)
-から構成される。
-.\"O The address of the array of string pointers is returned
-.\"O as the function result of
-.\"O .BR backtrace_symbols ().
-.\"O This array is
-.\"O .BR malloc (3)ed
-.\"O by
-.\"O .BR backtrace_symbols (),
-.\"O and must be freed by the caller.
-.\"O (The strings pointed to by the array of pointers
-.\"O need not and should not be freed.)
-.BR backtrace_symbols ()
-の実行結果としては、
-文字列ポインタの配列のアドレスが返される。
-この配列は
-.BR backtrace_symbols ()
-によって
-.BR malloc (3)
-され、呼び出し側で free しなければならない
-(ポインタの配列が指す個々の文字列は free する必要はないし、
-free すべきでもない)。
-
-.\"O .BR backtrace_symbols_fd ()
-.\"O takes the same
-.\"O .I buffer
-.\"O and
-.\"O .I size
-.\"O arguments as
-.\"O .BR backtrace_symbols (),
-.\"O but instead of returning an array of strings to the caller,
-.\"O it writes the strings, one per line, to the file descriptor
-.\"O .IR fd .
-.\"O .BR backtrace_symbols_fd ()
-.\"O does not call
-.\"O .BR malloc (3),
-.\"O and so can be employed in situations where the latter function might fail.
-.BR backtrace_symbols_fd ()
-は、
-.BR backtrace_symbols ()
-と同じ引き数
-.I buffer
-と
-.I size
-をとるが、呼び出し側に文字列の配列を返す代わりに、
-文字列をファイルディスクリプタ
-.I fd
-に 1 行に 1 エントリの形で書き込む。
-.BR backtrace_symbols_fd ()
-は
-.BR malloc (3)
-を呼び出さない。
+\fBbacktrace\fP()  returns a backtrace for the calling program, in the array
+pointed to by \fIbuffer\fP.  A backtrace is the series of currently active
+function calls for the program.  Each item in the array pointed to by
+\fIbuffer\fP is of type \fIvoid\ *\fP, and is the return address from the
+corresponding stack frame.  The \fIsize\fP argument specifies the maximum
+number of addresses that can be stored in \fIbuffer\fP.  If the backtrace is
+larger than \fIsize\fP, then the addresses corresponding to the \fIsize\fP most
+recent function calls are returned; to obtain the complete backtrace, make
+sure that \fIbuffer\fP and \fIsize\fP are large enough.
+
+\fBbacktrace\fP()  によって \fIbuffer\fP にアドレスの集合が得られたら、 \fBbacktrace_symbols\fP()
+によって、アドレス集合を、そのアドレスをシンボルで表した文字列の配列 に翻訳できる。 \fIsize\fP 引き数は \fIbuffer\fP
+に格納されたアドレスの数を指定する。 個々のアドレスのシンボル表現は、関数名 (特定できた場合)、 関数へのオフセット
+(16進表記)、実際のリターンアドレス (16進表記)  から構成される。 \fBbacktrace_symbols\fP()  の実行結果としては、
+文字列ポインタの配列のアドレスが返される。 この配列は \fBbacktrace_symbols\fP()  によって \fBmalloc\fP(3)
+され、呼び出し側で free しなければならない (ポインタの配列が指す個々の文字列は free する必要はないし、 free すべきでもない)。
+
+\fBbacktrace_symbols_fd\fP()  は、 \fBbacktrace_symbols\fP()  と同じ引き数 \fIbuffer\fP と
+\fIsize\fP をとるが、呼び出し側に文字列の配列を返す代わりに、 文字列をファイルディスクリプタ \fIfd\fP に 1 行に 1
+エントリの形で書き込む。 \fBbacktrace_symbols_fd\fP()  は \fBmalloc\fP(3)  を呼び出さない。
 そのため、これに続く関数が失敗する可能性がある状況でも利用できる。
-.\"O .SH "RETURN VALUE"
 .SH 返り値
-.\"O .BR backtrace ()
-.\"O returns the number of addresses returned in
-.\"O .IR buffer ,
-.\"O which is not greater than
-.\"O .IR size .
-.\"O If the return value is less than
-.\"O .IR size ,
-.\"O then the full backtrace was stored; if it is equal to
-.\"O .IR size ,
-.\"O then it may have been truncated, in which case the addresses of the
-.\"O oldest stack frames are not returned.
-.BR backtrace ()
-は
-.I buffer
-に格納したアドレスの個数を返す。その個数は
-.I size
-より大きくなることはない。
-返り値が
-.I size
-より小さい場合、バックトレース全体が格納されている。返り値が
-.I size
-と等しい場合、バックトレースは切り詰められているかもしれない。
-切り詰められた場合、最も古いスタックフレームのアドレスは
-返されないことになる。
+\fBbacktrace\fP()  は \fIbuffer\fP に格納したアドレスの個数を返す。その個数は \fIsize\fP より大きくなることはない。 返り値が
+\fIsize\fP より小さい場合、バックトレース全体が格納されている。返り値が \fIsize\fP
+と等しい場合、バックトレースは切り詰められているかもしれない。 切り詰められた場合、最も古いスタックフレームのアドレスは 返されないことになる。
 
-.\"O On success,
-.\"O .BR backtrace_symbols ()
-.\"O returns a pointer to the array
-.\"O .BR malloc (3)ed
-.\"O by the call;
-.\"O on error, NULL is returned.
-.BR backtrace_symbols ()
-は、成功すると、この呼び出しで
-.BR malloc (3)
-された配列へのポインタを返す。
+\fBbacktrace_symbols\fP()  は、成功すると、この呼び出しで \fBmalloc\fP(3)  された配列へのポインタを返す。
 エラーの場合、 NULL を返す。
-.\"O .SH VERSIONS
 .SH バージョン
-.\"O .BR backtrace (),
-.\"O .BR backtrace_symbols (),
-.\"O and
-.\"O .BR backtrace_symbols_fd ()
-.\"O are provided in glibc since version 2.1.
-.BR backtrace (),
-.BR backtrace_symbols (),
-.BR backtrace_symbols_fd ()
-はバージョン 2.1 以降の glibc で提供されている。
-.\"O .SH CONFORMING TO
+\fBbacktrace\fP(), \fBbacktrace_symbols\fP(), \fBbacktrace_symbols_fd\fP()  はバージョン
+2.1 以降の glibc で提供されている。
 .SH 準拠
-.\"O These functions are GNU extensions.
 これらの関数は GNU による拡張である。
-.\"O .SH NOTES
 .SH 注意
-.\"O These functions make some assumptions about how a function's return
-.\"O address is stored on the stack.
-.\"O Note the following:
-これらの関数は、関数のリターンアドレスがスタック上でどのように格納されるか
-に関してある仮定を置いている。
-以下の点に注意。
+これらの関数は、関数のリターンアドレスがスタック上でどのように格納されるか に関してある仮定を置いている。 以下の点に注意。
 .IP * 3
-.\"O Omission of the frame pointers (as
-.\"O implied by any of
-.\"O .BR gcc (1)'s
-.\"O nonzero optimization levels) may cause these assumptions to be
-.\"O violated.
-.RB ( gcc (1)
-の 0 以外の最適化レベルで暗黙のうちに行われる)
-フレームポインタの省略を行うと、これらの前提が崩れる可能性がある。
+(\fBgcc\fP(1)  の 0 以外の最適化レベルで暗黙のうちに行われる)  フレームポインタの省略を行うと、これらの前提が崩れる可能性がある。
 .IP *
-.\"O Inlined functions do not have stack frames.
 インライン関数はスタックフレームを持たない。
 .IP *
-.\"O Tail-call optimization causes one stack frame to replace another.
-末尾呼び出しの最適化 (tail-call optimization) を行うと、
-あるスタックフレームが別のスタックフレームを置き換える可能性がある。
+末尾呼び出しの最適化 (tail\-call optimization) を行うと、 あるスタックフレームが別のスタックフレームを置き換える可能性がある。
 .PP
-.\"O The symbol names may be unavailable without the use of special linker
-.\"O options.
-.\"O For systems using the GNU linker, it is necessary to use the
-.\"O .I \-rdynamic
-.\"O linker option.
-.\"O Note that names of "static" functions are not exposed,
-.\"O and won't be available in the backtrace.
-シンボル名は特別なリンカ・オプションを使用しないと利用できない場合がある。
-GNU リンカを使用するシステムでは、
-.I \-rdynamic
-リンカ・オプションを使う必要がある。
-"static" な関数のシンボル名は公開されず、
-バックトレースでは利用できない点に注意すること。
-.\"O .SH EXAMPLE
+シンボル名は特別なリンカ・オプションを使用しないと利用できない場合がある。 GNU リンカを使用するシステムでは、 \fI\-rdynamic\fP
+リンカ・オプションを使う必要がある。 "static" な関数のシンボル名は公開されず、 バックトレースでは利用できない点に注意すること。
 .SH 例
-.\"O The program below demonstrates the use of
-.\"O .BR backtrace ()
-.\"O and
-.\"O .BR backtrace_symbols ().
-.\"O The following shell session shows what we might see when running the
-.\"O program:
-以下のプログラムは、
-.BR backtrace ()
-と
-.BR backtrace_symbols ()
-の使用例を示したものである。
-以下に示すシェルのセッションは、
-このプログラムを動かした際の実行例である。
+以下のプログラムは、 \fBbacktrace\fP()  と \fBbacktrace_symbols\fP()  の使用例を示したものである。
+以下に示すシェルのセッションは、 このプログラムを動かした際の実行例である。
 .nf
 .in +4n
 
-.RB "$" " cc \-rdynamic prog.c \-o prog"
-.RB "$" " ./prog 3"
+$\fB cc \-rdynamic prog.c \-o prog\fP
+$\fB ./prog 3\fP
 backtrace() returned 8 addresses
 \&./prog(myfunc3+0x5c) [0x80487f0]
 \&./prog [0x8048871]
@@ -305,7 +106,6 @@ backtrace() returned 8 addresses
 \&./prog [0x8048711]
 .in
 .fi
-.\"O .SS Program source
 .SS プログラムのソース
 \&
 .nf
@@ -323,10 +123,8 @@ myfunc3(void)
     char **strings;
 
     nptrs = backtrace(buffer, SIZE);
-    printf("backtrace() returned %d addresses\\n", nptrs);
+    printf("backtrace() returned %d addresses\en", nptrs);
 
-.\"O     /* The call backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO)
-.\"O        would produce similar output to the following: */
     /* backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO) を
        呼び出しても、以下と同様の出力が得られる。 */
 
@@ -337,12 +135,11 @@ myfunc3(void)
     }
 
     for (j = 0; j < nptrs; j++)
-        printf("%s\\n", strings[j]);
+        printf("%s\en", strings[j]);
 
     free(strings);
 }
 
-.\"O static void   /* "static" means don\(aqt export the symbol... */
 static void   /* "static" はシンボルを公開しないことを意味する */
 myfunc2(void)
 {
@@ -362,7 +159,7 @@ int
 main(int argc, char *argv[])
 {
     if (argc != 2) {
-        fprintf(stderr, "%s num\-calls\\n", argv[0]);
+        fprintf(stderr, "%s num\-calls\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -370,9 +167,9 @@ main(int argc, char *argv[])
     exit(EXIT_SUCCESS);
 }
 .fi
-.\"O .SH SEE ALSO
 .SH 関連項目
-.BR gcc (1),
-.BR ld (1),
-.BR dlopen (3),
-.BR malloc (3)
+\fBgcc\fP(1), \fBld\fP(1), \fBdlopen\fP(3), \fBmalloc\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。