OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

MoreBacktraceTestCommon.h
1 /*
2 File: MoreBacktraceTestCommon.h
3
4 Contains: Common code for testing backtraces.
5
6 Written by: DTS
7
8 Copyright: Copyright (c) 2006 by Apple Computer, Inc., All Rights Reserved.
9
10 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc.
11 ("Apple") in consideration of your agreement to the following terms, and your
12 use, installation, modification or redistribution of this Apple software
13 constitutes acceptance of these terms. If you do not agree with these terms,
14 please do not use, install, modify or redistribute this Apple software.
15
16 In consideration of your agreement to abide by the following terms, and subject
17 to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
18 copyrights in this original Apple software (the "Apple Software"), to use,
19 reproduce, modify and redistribute the Apple Software, with or without
20 modifications, in source and/or binary forms; provided that if you redistribute
21 the Apple Software in its entirety and without modifications, you must retain
22 this notice and the following text and disclaimers in all such redistributions of
23 the Apple Software. Neither the name, trademarks, service marks or logos of
24 Apple Computer, Inc. may be used to endorse or promote products derived from the
25 Apple Software without specific prior written permission from Apple. Except as
26 expressly stated in this notice, no other rights or licenses, express or implied,
27 are granted by Apple herein, including but not limited to any patent rights that
28 may be infringed by your derivative works or by other works in which the Apple
29 Software may be incorporated.
30
31 The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
32 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
33 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
35 COMBINATION WITH YOUR PRODUCTS.
36
37 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
38 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
39 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
41 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
42 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
43 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
45 Change History (most recent first):
46
47 $Log: MoreBacktraceTestCommon.h,v $
48 Revision 1.1 2006/01/22 22:47:51 eskimo1
49 A new module that abstracts the test code out of the GUI test app so that it can also be used by the command line tool.
50
51
52 */
53
54 #pragma once
55
56 /////////////////////////////////////////////////////////////////
57
58 // MoreIsBetter Setup
59
60 #include "MoreSetup.h"
61
62 // Mac OS Interfaces
63
64 #include <stdbool.h>
65 #include <unistd.h>
66
67 // MIB Interfaces
68
69 #include "MoreBacktrace.h"
70
71 /////////////////////////////////////////////////////////////////
72
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76
77 /////////////////////////////////////////////////////////////////
78
79 // This module contains common test code that's shared between the application
80 // and the command line tool.
81
82 extern int TestMoreBacktraceFramesToText(
83 const MoreBTFrame frames[],
84 size_t frameCount,
85 bool lookupSymbolNames,
86 char ** btPtr
87 );
88 // Converts a backtrace (specified by frames and frameCount)
89 // to textual form, returning a pointer to the text in *btPtr.
90 // Each line is separated by a '\n' and the entire string
91 // is null terminated. The caller is responsible for disposing
92 // of this result using free.
93 //
94 // If lookupSymbolNames is true,
95 // the textual representation will contain symbols generated
96 // using the MoreAddrToSym module. Given that this module
97 // only supports looking up symbols in the current task
98 // (at least currently), you should only pass true to this
99 // parameter if the backtrace came from the current task.
100 //
101 // On entry, frames must not be NULL.
102 // On entry, btPtr must not be NULL.
103 // On entry, *btPtr must be NULL.
104 // Returns an errno-style error code.
105 // On success, *btPtr will not be NULL.
106 // On error, *btPtr will be NULL.
107
108 // The following routines run a variety of different backtrace tests.
109 // This each return an errno-style error code, and set *btPtr as
110 // specified by TestMoreBacktraceFramesToText.
111
112 extern int TestMoreBacktraceMachSelf(char **btPtr);
113 // Backtrace the current thread.
114
115 extern int TestMoreBacktraceMachThread(pid_t pid, char **btPtr);
116 // Backtrace a random thread in the specified task.
117
118 extern int TestMoreBacktraceMachSelfSignal(bool nonLeaf, char **btPtr);
119 // Backtrace across a signal handler. If nonLeaf is set,
120 // this requires user intervention to deliver the signal.
121
122 extern int TestMoreBacktraceMachThreadStackSmash(char **btPtr);
123 // Backtrace a thread with a smashed stack.
124
125 #ifdef __cplusplus
126 }
127 #endif
MoreBTFrame
Definition: MoreBacktrace.h:189