Framework |
CoreServices/CoreServices.h |
Declared in | Debugging.h |
Debugger Services is a Carbon API that provides standard exception handling and assertion functions to assist you in debugging Mac OS applications.
NewDebugComponent
NewDebugOption
GetDebugComponentInfo
GetDebugOptionInfo
SetDebugOptionValue
DisposeDebugComponent
DebugAssert
InstallDebugAssertOutputHandler
TaskLevel
NewDebugAssertOutputHandlerUPP
InvokeDebugAssertOutputHandlerUPP
DisposeDebugAssertOutputHandlerUPP
NewDebugComponentCallbackUPP
InvokeDebugComponentCallbackUPP
DisposeDebugComponentCallbackUPP
Displays an assertion messsage using the current output handler.
void DebugAssert ( OSType componentSignature, UInt32 options, const char *assertionString, const char *exceptionLabelString, const char *errorString, const char *fileName, long lineNumber, void *value );
The unique signature of the component causing the assertion.
Reserved for use by Apple.
A pointer to a string containing the assertion, or NULL
.
A pointer to a string containing the exceptionLabel, or NULL
.
A pointer to the error string, or NULL
.
A pointer to the file name or path name generated by the preprocessor __FILE__
identifier, or NULL
.
The line number in the file (generated by the preprocessor __LINE__
identifier), or 0 (zero).
A value associated with the assertion, or NULL
.
The DEBUGASSERTMSG
macro calls this function (by default) to display assertion messages. To redirect the output from this function, use InstallDebugAssertOutputHandler
to install a custom output handler.
Debugging.h
void DisposeDebugAssertOutputHandlerUPP ( DebugAssertOutputHandlerUPP userUPP );
Debugging.h
Removes a component registration and all related debug options.
OSStatus DisposeDebugComponent ( OSType componentSignature );
The unique signature of a component.
A result code. If the result is non-zero, the Notification Manager cannot remove the debug options.
Debugging.h
void DisposeDebugComponentCallbackUPP ( DebugComponentCallbackUPP userUPP );
Debugging.h
Returns the signature and name of a registered component.
OSStatus GetDebugComponentInfo ( UInt32 index, OSType *componentSignature, Str255 componentName );
An index into a list of registered components (one-based).
A pointer to an OSType
, provided by the caller to receive the unique signature of the specified component.
A string buffer, provided by the caller to receive the component name.
A result code. If index
is not valid, the result code is debuggingNoMatchErr
.
Debugging.h
Returns information about the debug option of a registered component.
OSStatus GetDebugOptionInfo ( UInt32 index, OSType componentSignature, SInt32 *optionSelectorNum, Str255 optionName, Boolean *optionSetting );
An index into a list of registered debug options (zero-based). You should use the constant kComponentDebugOption
.
The unique signature of your registered component.
A pointer to an integer, provided by the caller to receive the option selector number.
A string buffer, provided by the caller to receive the option name.
A pointer to a Boolean
, provided by the caller to receive the current option setting.
A result code. Debugger Services returns debuggingNoMatchErr
if the index is not valid, debuggingInvalidSignatureErr
if the component is not registered, or noErr
.
Debugging.h
Installs an output handler for DebugAssert
to call in place of DebugStr
, the default handler.
void InstallDebugAssertOutputHandler ( DebugAssertOutputHandlerUPP handler );
The custom output handler to install, or NULL to switch back to DebugStr
.
Debugging.h
void InvokeDebugAssertOutputHandlerUPP ( OSType componentSignature, UInt32 options, const char *assertionString, const char *exceptionLabelString, const char *errorString, const char *fileName, long lineNumber, void *value, ConstStr255Param outputMsg, DebugAssertOutputHandlerUPP userUPP );
Debugging.h
void InvokeDebugComponentCallbackUPP ( SInt32 optionSelectorNum, UInt32 command, Boolean *optionSetting, DebugComponentCallbackUPP userUPP );
Debugging.h
DebugAssertOutputHandlerUPP NewDebugAssertOutputHandlerUPP ( DebugAssertOutputHandlerProcPtr userRoutine );
Debugging.h
Registers a component with Debugger Services.
OSStatus NewDebugComponent ( OSType componentSignature, ConstStr255Param componentName, DebugComponentCallbackUPP componentCallback );
The unique signature of a new component.
A displayable string that names the new component.
A universal procedure pointer (UPP) to a debug component callback function, provided by the caller for working with options.
A result code. See Debugger Services Result Codes
.
Debugging.h
DebugComponentCallbackUPP NewDebugComponentCallbackUPP ( DebugComponentCallbackProcPtr userRoutine );
Debugging.h
Registers a new debug option with Debugger Services.
OSStatus NewDebugOption ( OSType componentSignature, SInt32 optionSelectorNum, ConstStr255Param optionName );
The unique signature of a registered component.
The selector number of the new debug option.
A displayable string that names this debug option.
A result code. See Debugger Services Result Codes
.
Debugging.h
Modifies the setting of a registered debug option.
OSStatus SetDebugOptionValue ( OSType componentSignature, SInt32 optionSelectorNum, Boolean newOptionSetting );
The unique signature of a registered component.
The selector number of a registered debug option.
The new setting for the option.
A result code. Debugger Services returns debuggingInvalidOptionErr
if the selector number is not valid, debuggingInvalidSignatureErr
if the component is not registered, or noErr
.
Debugging.h
Provides information about the task interrupt level, if the task is running at interrupt-time.
UInt32 TaskLevel ( void );
The current task interrupt level. If the return value is 0, the task is (probably) running at non-interrupt time. Otherwise, one of the TaskLevel
masks can be used to learn more.
Debugging.h
Defines
a pointer to a function that handles the output from DebugAssert
.
typedef void (*DebugAssertOutputHandlerProcPtr) ( OSType componentSignature, UInt32 options, const char * assertionString, const char * exceptionLabelString, const char * errorString, const char * fileName, long lineNumber, void * value, ConstStr255Param outputMsg );
If you name your function MyDebugAssertOutputHandler
,
you would declare it like this:
void MyDebugAssertOutputHandler ( OSType componentSignature, UInt32 options, const char * assertionString, const char * exceptionLabelString, const char * errorString, const char * fileName, long lineNumber, void * value, ConstStr255Param outputMsg );
The unique signature of the component causing the assertion.
Reserved for use by Apple.
The name of the assertion, or NULL.
The exception label, or NULL
.
The description of an error condition, or NULL
.
The file or path name (generated by the preprocessor __FILE__
identifier), or NULL
.
The file or path name (generated by the preprocessor __FILE__
identifier), or NULL
.
The line number in the file (generated by
the preprocessor __LINE__
identifier),
or 0 (zero).
A value associated with the assertion, or NULL
.
The string that the caller (DebugAssert)
normally
passes to DebugStr
when
a custom output handler isn't installed.
The parameters (excluding outputMsg
)
are the raw values passed to DebugAssert
when
an exception occurs. A custom output handler can safely ignore these
parameters and simply redirect the output message (for example,
to a log file).
Debugging.h
Defines a pointer to a function that Debugger Services calls to read or modify the debug option settings defined by a component.
typedef void (*DebugComponentCallbackProcPtr) ( SInt32 optionSelectorNum, UInt32 command, Boolean * optionSetting );
If you name your function MyDebugComponentCallback
,
you would declare it like this:
void MyDebugComponentCallback ( SInt32 optionSelectorNum, UInt32 command, Boolean * optionSetting );
A component debug option, previously defined
by calling NewDebugOption
.
Specifies the operation to be performed—kGetDebugOption
to
get current setting, or kSetDebugOption
to
modify the setting.
A pointer to a Boolean
that
Debugger Services uses to
pass in the new setting,
if command
is kSetDebugOption
receive the result of the operation, if command
is kGetDebugOption
Debugging.h
Defines a universal procedure pointer (UPP) type for a custom assertion output handler.
typedef DebugAssertOutputHandlerProcPtr DebugAssertOutputHandlerUPP;
For information about custom assertion output handlers, see DebugAssertOutputHandlerProcPtr
.
Debugging.h
Defines a universal procedure pointer (UPP) type for a custom component debug option callback.
typedef DebugComponentCallbackProcPtr DebugComponentCallbackUPP;
For information about custom component debug option callbacks,
see DebugComponentCallbackProcPtr
.
Debugging.h
Masks to determine what kind of tasks are executing at interrupt time.
enum { k68kInterruptLevelMask = 0x00000007, kInVBLTaskMask = 0x00000010, kInDeferredTaskMask = 0x00000020, kInSecondaryIntHandlerMask = 0x00000040, kInNestedInterruptMask = 0x00000080 };
k68kInterruptLevelMask
68K interrupt levels 0 through 7.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
kInVBLTaskMask
VBLs are executing.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
kInDeferredTaskMask
Deferred tasks are executing.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
kInSecondaryIntHandlerMask
Secondary interrupt handlers are executing.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
kInNestedInterruptMask
The operating system is handling an interrupt.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
For more information, see TaskLevel
.
Addresses not mapped in Mac OS 8 or 9.
enum { kBlessedBusErrorBait = 0x68F168F1 };
kBlessedBusErrorBait
An address that will never be mapped in Mac OS 8 or 9.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
An exception occurs when an application tries to access the
address kBlessedBusErrorBait
in
Mac OS 8 or 9, which makes it a good value to use when initializing
pointers.
In Mac OS X, you should use 0x00000000 for this purpose.
Defines the debug option types supported by Debugger Services.
enum { kComponentDebugOption = 0 };
kComponentDebugOption
Specifies the component debug option type.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
For information about how this constant is used, see GetDebugOptionInfo
.
Defines the commands (or operations) that a debug option callback needs to implement.
enum { kGetDebugOption = 1, kSetDebugOption = 2 };
kGetDebugOption
The callback should return the current Boolean
value
of the specified debug option.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
kSetDebugOption
The callback should modify the Boolean
value
of the specified debug option.
Available in Mac OS X v10.0 and later.
Declared in Debugging.h
.
The most common result codes returned by Debugger Services are listed in the table below.
© 2003 Apple Computer, Inc. All Rights Reserved. (Last updated: 2003-01-01)