summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/stack_8c-source.html
diff options
context:
space:
mode:
authorhunt <hunt>2005-04-07 21:48:47 +0000
committerhunt <hunt>2005-04-07 21:48:47 +0000
commit655ee2825121e149a9976e562946892efb20aea1 (patch)
tree91b9b4cc46aeee50e9d789689bea0b96e11ceba1 /runtime/docs/html/stack_8c-source.html
parent3d4bc8bea6b45893bd4b49f44df26bd602b4cba5 (diff)
downloadsystemtap-steved-655ee2825121e149a9976e562946892efb20aea1.tar.gz
systemtap-steved-655ee2825121e149a9976e562946892efb20aea1.tar.xz
systemtap-steved-655ee2825121e149a9976e562946892efb20aea1.zip
*** empty log message ***
Diffstat (limited to 'runtime/docs/html/stack_8c-source.html')
-rw-r--r--runtime/docs/html/stack_8c-source.html280
1 files changed, 147 insertions, 133 deletions
diff --git a/runtime/docs/html/stack_8c-source.html b/runtime/docs/html/stack_8c-source.html
index 552f51cc..eda90dc4 100644
--- a/runtime/docs/html/stack_8c-source.html
+++ b/runtime/docs/html/stack_8c-source.html
@@ -4,10 +4,10 @@
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
-<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
-<h1>stack.c</h1><a href="stack_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _STACK_C_</span>
-00002 <span class="preprocessor"></span><span class="preprocessor">#define _STACK_C_</span>
-00003 <span class="preprocessor"></span><span class="comment">/* -*- linux-c -*- */</span>
+<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
+<h1>stack.c</h1><a href="stack_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _STACK_C_ </span><span class="comment">/* -*- linux-c -*- */</span>
+00002 <span class="preprocessor">#define _STACK_C_</span>
+00003 <span class="preprocessor"></span>
00004 <span class="comment"></span>
00005 <span class="comment">/** @file stack.c</span>
00006 <span class="comment"> * @brief Stack Tracing Functions</span>
@@ -27,148 +27,162 @@
00020 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
00021
00022 <span class="keywordflow">if</span> (verbose)
-00023 _stp_print ("trace for %d (%s)\n", current-&gt;pid, current-&gt;comm);
+00023 _stp_printf ("trace for %d (%s)\n", current-&gt;pid, current-&gt;comm);
00024
00025 while (((<span class="keywordtype">long</span>) stack &amp; (THREAD_SIZE-1)) != 0) {
00026 addr = *stack++;
00027 <span class="keywordflow">if</span> (_stp_kta(addr)) {
-00028 <span class="keywordflow">if</span> (verbose)
-00029 _stp_symbol_print (addr);
-00030 else
-00031 _stp_print ("0x%lx ", addr);
-00032 }
-00033 }
-00034 _stp_print_str ("\n");
-00035 }
-00036
+00028 <span class="keywordflow">if</span> (verbose) {
+00029 <a class="code" href="group__sym.html#ga2">_stp_symbol_print</a> (addr);
+00030 <a class="code" href="group__print.html#ga11">_stp_print</a> (<span class="stringliteral">"\n"</span>);
+00031 } <span class="keywordflow">else</span>
+00032 <a class="code" href="group__print.html#ga3">_stp_printf</a> (<span class="stringliteral">"0x%lx "</span>, addr);
+00033 }
+00034 }
+00035 <a class="code" href="group__print.html#ga2">_stp_print_flush</a>();
+00036 }
00037
-00038 static <span class="keywordtype">char</span> *__stp_stack_sprint (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
-00039 {
-00040 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
-00041 <span class="keywordtype">char</span> *ptr = _stp_scbuf_cur();
+00038
+00039 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_stack_sprint (String str, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
+00040 {
+00041 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
00042 <span class="keywordflow">while</span> (((<span class="keywordtype">long</span>) stack &amp; (THREAD_SIZE-1)) != 0) {
00043 addr = *stack++;
00044 <span class="keywordflow">if</span> (_stp_kta(addr)) {
00045 <span class="keywordflow">if</span> (verbose)
-00046 _stp_symbol_sprint (addr);
+00046 _stp_symbol_sprint (str, addr);
00047 else
-00048 _stp_sprint ("0x%lx ", addr);
+00048 _stp_sprintf (str, "0x%lx ", addr);
00049 }
00050 }
-00051 return ptr;
-00052 }
-00053
-00054 #else <span class="comment">/* i386 */</span>
-00055
-00056 static inline <span class="keywordtype">int</span> valid_stack_ptr (struct thread_info *tinfo, <span class="keywordtype">void</span> *p)
-00057 {
-00058 <span class="keywordflow">return</span> p &gt; (<span class="keywordtype">void</span> *)tinfo &amp;&amp;
-00059 p &lt; (<span class="keywordtype">void</span> *)tinfo + THREAD_SIZE - 3;
-00060 }
-00061
-00062 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _stp_print_context_stack (
-00063 <span class="keyword">struct</span> thread_info *tinfo,
-00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack,
-00065 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp )
-00066 {
-00067 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
-00068
-00069 <span class="preprocessor">#ifdef CONFIG_FRAME_POINTER</span>
-00070 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, (<span class="keywordtype">void</span> *)ebp)) {
-00071 addr = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)(ebp + 4);
-00072 <a class="code" href="group__sym.html#ga3">_stp_symbol_print</a> (addr);
-00073 <a class="code" href="group__io.html#ga2">_stp_print_str</a>(<span class="stringliteral">"\n"</span>);
-00074 ebp = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)ebp;
-00075 }
-00076 <span class="preprocessor">#else</span>
-00077 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, stack)) {
-00078 addr = *stack++;
-00079 <span class="keywordflow">if</span> (_stp_kta (addr)) {
-00080 <a class="code" href="group__sym.html#ga3">_stp_symbol_print</a> (addr);
-00081 <a class="code" href="group__io.html#ga2">_stp_print_str</a> (<span class="stringliteral">"\n"</span>);
-00082 }
-00083 }
-00084 <span class="preprocessor">#endif</span>
-00085 <span class="preprocessor"></span> <span class="keywordflow">return</span> ebp;
+00051 }
+00052
+00053 #else <span class="comment">/* i386 */</span>
+00054
+00055 static inline <span class="keywordtype">int</span> valid_stack_ptr (struct thread_info *tinfo, <span class="keywordtype">void</span> *p)
+00056 {
+00057 <span class="keywordflow">return</span> p &gt; (<span class="keywordtype">void</span> *)tinfo &amp;&amp;
+00058 p &lt; (<span class="keywordtype">void</span> *)tinfo + THREAD_SIZE - 3;
+00059 }
+00060
+00061 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _stp_print_context_stack (
+00062 <span class="keyword">struct</span> thread_info *tinfo,
+00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack,
+00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp )
+00065 {
+00066 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
+00067
+00068 <span class="preprocessor">#ifdef CONFIG_FRAME_POINTER</span>
+00069 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, (<span class="keywordtype">void</span> *)ebp)) {
+00070 addr = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)(ebp + 4);
+00071 <a class="code" href="group__sym.html#ga2">_stp_symbol_print</a> (addr);
+00072 <a class="code" href="group__print.html#ga5">_stp_print_cstr</a>(<span class="stringliteral">"\n"</span>);
+00073 ebp = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)ebp;
+00074 }
+00075 <span class="preprocessor">#else</span>
+00076 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, stack)) {
+00077 addr = *stack++;
+00078 <span class="keywordflow">if</span> (_stp_kta (addr)) {
+00079 <a class="code" href="group__sym.html#ga2">_stp_symbol_print</a> (addr);
+00080 <a class="code" href="group__print.html#ga5">_stp_print_cstr</a> (<span class="stringliteral">"\n"</span>);
+00081 }
+00082 }
+00083 <span class="preprocessor">#endif</span>
+00084 <span class="preprocessor"></span> <a class="code" href="group__print.html#ga2">_stp_print_flush</a>();
+00085 <span class="keywordflow">return</span> ebp;
00086 }
00087
00088 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _stp_sprint_context_stack (
-00089 <span class="keyword">struct</span> thread_info *tinfo,
-00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack,
-00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp )
-00092 {
-00093 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
-00094
-00095 <span class="preprocessor">#ifdef CONFIG_FRAME_POINTER</span>
-00096 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, (<span class="keywordtype">void</span> *)ebp)) {
-00097 addr = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)(ebp + 4);
-00098 <a class="code" href="group__sym.html#ga2">_stp_symbol_sprint</a> (addr);
-00099 <a class="code" href="group__scbuf.html#ga3">_stp_sprint_str</a>(<span class="stringliteral">"\n"</span>);
-00100 ebp = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)ebp;
-00101 }
-00102 <span class="preprocessor">#else</span>
-00103 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, stack)) {
-00104 addr = *stack++;
-00105 <span class="keywordflow">if</span> (_stp_kta (addr)) {
-00106 <a class="code" href="group__sym.html#ga2">_stp_symbol_sprint</a> (addr);
-00107 <a class="code" href="group__scbuf.html#ga3">_stp_sprint_str</a> (<span class="stringliteral">"\n"</span>);
-00108 }
-00109 }
-00110 <span class="preprocessor">#endif</span>
-00111 <span class="preprocessor"></span> <span class="keywordflow">return</span> ebp;
-00112 }
-00113
-00114 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_stack_print (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
-00115 {
-00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp;
-00117
-00118 <span class="comment">/* Grab ebp right from our regs */</span>
-00119 <span class="keyword">asm</span> (<span class="stringliteral">"movl %%ebp, %0"</span> : <span class="stringliteral">"=r"</span> (ebp) : );
-00120
-00121 <span class="keywordflow">while</span> (stack) {
-00122 <span class="keyword">struct </span>thread_info *context = (<span class="keyword">struct </span>thread_info *)
-00123 ((<span class="keywordtype">unsigned</span> long)stack &amp; (~(THREAD_SIZE - 1)));
-00124 ebp = _stp_print_context_stack (context, stack, ebp);
-00125 stack = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>*)context-&gt;previous_esp;
-00126 }
-00127 }
-00128
-00129 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_stack_sprint (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
-00130 {
-00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp;
-00132
-00133 <span class="comment">/* Grab ebp right from our regs */</span>
-00134 <span class="keyword">asm</span> (<span class="stringliteral">"movl %%ebp, %0"</span> : <span class="stringliteral">"=r"</span> (ebp) : );
-00135
-00136 <span class="keywordflow">while</span> (stack) {
-00137 <span class="keyword">struct </span>thread_info *context = (<span class="keyword">struct </span>thread_info *)
-00138 ((<span class="keywordtype">unsigned</span> long)stack &amp; (~(THREAD_SIZE - 1)));
-00139 ebp = _stp_sprint_context_stack (context, stack, ebp);
-00140 stack = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>*)context-&gt;previous_esp;
-00141 }
-00142 }
-00143
-00144 <span class="preprocessor">#endif </span><span class="comment">/* i386 */</span>
-00145 <span class="comment"></span>
-00146 <span class="comment">/** Print stack dump.</span>
-00147 <span class="comment"> * Prints a stack dump to the trace buffer.</span>
-00148 <span class="comment"> * @param verbose Verbosity:</span>
-00149 <span class="comment"> */</span>
-00150
-<a name="l00151"></a><a class="code" href="group__stack.html#ga6">00151</a> <span class="keywordtype">void</span> <a class="code" href="group__stack.html#ga6">_stp_stack_print</a> (<span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
-00152 {
-00153 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stack;
-00154 <span class="keywordflow">return</span> __stp_stack_print (&amp;stack, verbose, levels);
-00155 }
-00156
-00157 <span class="keywordtype">char</span> *_stp_stack_sprint (<span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
-00158 {
-00159 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stack;
-00160 <span class="keywordtype">char</span> *ptr = _stp_scbuf_cur();
-00161 __stp_stack_sprint (&amp;stack, verbose, levels);
-00162 <span class="keywordflow">return</span> ptr;
-00163 }
-00164 <span class="comment"></span>
-00165 <span class="comment">/** @} */</span>
-00166 <span class="preprocessor">#endif </span><span class="comment">/* _STACK_C_ */</span>
+00089 String str,
+00090 <span class="keyword">struct</span> thread_info *tinfo,
+00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack,
+00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp )
+00093 {
+00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> addr;
+00095
+00096 <span class="preprocessor">#ifdef CONFIG_FRAME_POINTER</span>
+00097 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, (<span class="keywordtype">void</span> *)ebp)) {
+00098 addr = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)(ebp + 4);
+00099 <a class="code" href="group__sym.html#ga1">_stp_symbol_sprint</a> (str, addr);
+00100 <a class="code" href="group__string.html#ga9">_stp_string_cat</a> (<span class="stringliteral">"\n"</span>);
+00101 ebp = *(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)ebp;
+00102 }
+00103 <span class="preprocessor">#else</span>
+00104 <span class="preprocessor"></span> <span class="keywordflow">while</span> (valid_stack_ptr(tinfo, stack)) {
+00105 addr = *stack++;
+00106 <span class="keywordflow">if</span> (_stp_kta (addr)) {
+00107 <a class="code" href="group__sym.html#ga1">_stp_symbol_sprint</a> (addr);
+00108 <a class="code" href="group__string.html#ga9">_stp_string_cat</a> (<span class="stringliteral">"\n"</span>);
+00109 }
+00110 }
+00111 <span class="preprocessor">#endif</span>
+00112 <span class="preprocessor"></span> <span class="keywordflow">return</span> ebp;
+00113 }
+00114
+00115 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_stack_print (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
+00116 {
+00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp;
+00118
+00119 <span class="comment">/* Grab ebp right from our regs */</span>
+00120 <span class="keyword">asm</span> (<span class="stringliteral">"movl %%ebp, %0"</span> : <span class="stringliteral">"=r"</span> (ebp) : );
+00121
+00122 <span class="keywordflow">while</span> (stack) {
+00123 <span class="keyword">struct </span>thread_info *context = (<span class="keyword">struct </span>thread_info *)
+00124 ((<span class="keywordtype">unsigned</span> long)stack &amp; (~(THREAD_SIZE - 1)));
+00125 ebp = _stp_print_context_stack (context, stack, ebp);
+00126 stack = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>*)context-&gt;previous_esp;
+00127 }
+00128 }
+00129
+00130 <span class="keyword">static</span> <span class="keywordtype">void</span> __stp_stack_sprint (String str, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *stack, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
+00131 {
+00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ebp;
+00133
+00134 <span class="comment">/* Grab ebp right from our regs */</span>
+00135 <span class="keyword">asm</span> (<span class="stringliteral">"movl %%ebp, %0"</span> : <span class="stringliteral">"=r"</span> (ebp) : );
+00136
+00137 <span class="keywordflow">while</span> (stack) {
+00138 <span class="keyword">struct </span>thread_info *context = (<span class="keyword">struct </span>thread_info *)
+00139 ((<span class="keywordtype">unsigned</span> long)stack &amp; (~(THREAD_SIZE - 1)));
+00140 ebp = _stp_sprint_context_stack (str, context, stack, ebp);
+00141 stack = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>*)context-&gt;previous_esp;
+00142 }
+00143 }
+00144
+00145 <span class="preprocessor">#endif </span><span class="comment">/* i386 */</span>
+00146 <span class="comment"></span>
+00147 <span class="comment">/** Print stack dump.</span>
+00148 <span class="comment"> * Prints a stack dump to the print buffer.</span>
+00149 <span class="comment"> * @param verbose Verbosity</span>
+00150 <span class="comment"> * @param levels Number of levels to trace.</span>
+00151 <span class="comment"> * @todo Implement verbosity and levels parameters.</span>
+00152 <span class="comment"> * @bug levels parameter is not functional</span>
+00153 <span class="comment"> */</span>
+00154
+<a name="l00155"></a><a class="code" href="group__stack.html#ga6">00155</a> <span class="keywordtype">void</span> <a class="code" href="group__stack.html#ga6">_stp_stack_print</a> (<span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
+00156 {
+00157 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stack;
+00158 __stp_stack_print (&amp;stack, verbose, levels);
+00159 }
+00160 <span class="comment"></span>
+00161 <span class="comment">/** Writes stack dump to a String</span>
+00162 <span class="comment"> *</span>
+00163 <span class="comment"> * @param str String</span>
+00164 <span class="comment"> * @param verbose Verbosity</span>
+00165 <span class="comment"> * @param levels Number of levels to trace.</span>
+00166 <span class="comment"> * @returns Same String as was input.</span>
+00167 <span class="comment"> * @todo Implement verbosity and levels parameters.</span>
+00168 <span class="comment"> * @bug levels parameter is not functional</span>
+00169 <span class="comment"> */</span>
+00170
+<a name="l00171"></a><a class="code" href="group__stack.html#ga7">00171</a> String <a class="code" href="group__stack.html#ga7">_stp_stack_sprint</a> (String str, <span class="keywordtype">int</span> verbose, <span class="keywordtype">int</span> levels)
+00172 {
+00173 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stack;
+00174 __stp_stack_sprint (str, &amp;stack, verbose, levels);
+00175 <a class="code" href="group__io.html#ga2">_stp_log</a> (<span class="stringliteral">"sss: str=%s\n"</span>, str-&gt;buf);
+00176 <span class="keywordflow">return</span> str;
+00177 }
+00178 <span class="comment"></span>
+00179 <span class="comment">/** @} */</span>
+00180 <span class="preprocessor">#endif </span><span class="comment">/* _STACK_C_ */</span>
</pre></div></body></html>