FreeBSD/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDsDumpMethodStack
 *
 * PARAMETERS:  Status          - Method execution status
 *              WalkState       - Current state of the parse tree walk
 *              Op              - Executing parse op
 *
 * RETURN:      None
 *
 * DESCRIPTION: Called when a method has been aborted because of an error.
 *              Dumps the method execution stack.
 *
 ******************************************************************************/
AcpiDsDumpMethodStack
PARAMETERS:  Status          - Method execution status
WalkState       - Current state of the parse tree walk
Op              - Executing parse op

None

Called when a method has been aborted because of an error.
Dumps the method execution stack.
AcpiDsDumpMethodStack PARAMETERS : Status - Method execution status WalkState - Current state of the parse tree walk Op - Executing parse op None Called when a method has been aborted because of an error . Dumps the method execution stack .
void
AcpiDsDumpMethodStack (
    ACPI_STATUS             Status,
    ACPI_WALK_STATE         *WalkState,
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_PARSE_OBJECT       *Next;
    ACPI_THREAD_STATE       *Thread;
    ACPI_WALK_STATE         *NextWalkState;
    ACPI_NAMESPACE_NODE     *PreviousMethod = NULL;
    ACPI_OPERAND_OBJECT     *MethodDesc;
    ACPI_FUNCTION_TRACE (DsDumpMethodStack);
    if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
    {
        return_VOID;
    }
    if (WalkState->DeferredNode)
    {
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
            "Executing subtree for Buffer/Package/Region\n"));
        return_VOID;
    }
    Thread = WalkState->Thread;
    if (!Thread)
    {
        return_VOID;
    }
    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
        "\n**** Exception %s during execution of method ",
        AcpiFormatException (Status)));
    AcpiDsPrintNodePathname (WalkState->MethodNode, NULL);
    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH,
        "\n\nMethod Execution Stack:\n"));
    NextWalkState = Thread->WalkStateList;
    while (NextWalkState)
    {
        MethodDesc = NextWalkState->MethodDesc;
        if (MethodDesc)
        {
            AcpiExStopTraceMethod (
                (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
                MethodDesc, WalkState);
        }
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
            "    Method [%4.4s] executing: ",
            AcpiUtGetNodeName (NextWalkState->MethodNode)));
        if (NextWalkState == WalkState)
        {
            if (Op)
            {
                Next = Op->Common.Next;
                Op->Common.Next = NULL;
#ifdef ACPI_DISASSEMBLER
                AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
#endif
                Op->Common.Next = Next;
            }
        }
        else
        {
            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method "));
            AcpiDsPrintNodePathname (PreviousMethod, NULL);
        }
        PreviousMethod = NextWalkState->MethodNode;
        NextWalkState = NextWalkState->Next;
        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n"));
    }
    return_VOID;
}
void AcpiDsDumpMethodStack ( ACPI_STATUS Status , ACPI_WALK_STATE * WalkState , ACPI_PARSE_OBJECT * Op ) { ACPI_PARSE_OBJECT * Next ; ACPI_THREAD_STATE * Thread ; ACPI_WALK_STATE * NextWalkState ; ACPI_NAMESPACE_NODE * PreviousMethod = NULL ; ACPI_OPERAND_OBJECT * MethodDesc ; ACPI_FUNCTION_TRACE ( DsDumpMethodStack ) ; if ( ( Status & AE_CODE_MASK ) == AE_CODE_CONTROL ) { return_VOID ; } if ( WalkState -> DeferredNode ) { ACPI_DEBUG_PRINT ( ( ACPI_DB_DISPATCH , " \n " ) ) ; return_VOID ; } Thread = WalkState -> Thread ; if ( ! Thread ) { return_VOID ; } ACPI_DEBUG_PRINT ( ( ACPI_DB_DISPATCH , " \n " , AcpiFormatException ( Status ) ) ) ; AcpiDsPrintNodePathname ( WalkState -> MethodNode , NULL ) ; ACPI_DEBUG_PRINT_RAW ( ( ACPI_DB_DISPATCH , " \n \n \n " ) ) ; NextWalkState = Thread -> WalkStateList ; while ( NextWalkState ) { MethodDesc = NextWalkState -> MethodDesc ; if ( MethodDesc ) { AcpiExStopTraceMethod ( ( ACPI_NAMESPACE_NODE * ) MethodDesc -> Method . Node , MethodDesc , WalkState ) ; } ACPI_DEBUG_PRINT ( ( ACPI_DB_DISPATCH , " " , AcpiUtGetNodeName ( NextWalkState -> MethodNode ) ) ) ; if ( NextWalkState == WalkState ) { if ( Op ) { Next = Op -> Common . Next ; Op -> Common . Next = NULL ; #ifdef ACPI_DISASSEMBLER AcpiDmDisassemble ( NextWalkState , Op , ACPI_UINT32_MAX ) ; #endif Op -> Common . Next = Next ; } } else { ACPI_DEBUG_PRINT_RAW ( ( ACPI_DB_DISPATCH , " " ) ) ; AcpiDsPrintNodePathname ( PreviousMethod , NULL ) ; } PreviousMethod = NextWalkState -> MethodNode ; NextWalkState = NextWalkState -> Next ; ACPI_DEBUG_PRINT_RAW ( ( ACPI_DB_DISPATCH , " \n " ) ) ; } return_VOID ; }
FUNCTION:    AcpiDsDumpMethodStack
 PARAMETERS:  Status          - Method execution status
              WalkState       - Current state of the parse tree walk
              Op              - Executing parse op
FUNCTION : AcpiDsDumpMethodStack PARAMETERS : Status - Method execution status WalkState - Current state of the parse tree walk Op - Executing parse op
/* Ignore control codes, they are not errors */ /* We may be executing a deferred opcode */ /*
     * If there is no Thread, we are not actually executing a method.
     * This can happen when the iASL compiler calls the interpreter
     * to perform constant folding.
     */ /* Display exception and method name */ /* Display stack of executing methods */ /* Walk list of linked walk states */ /* First method is the currently executing method */ /* Display currently executing ASL statement */ /*
             * This method has called another method
             * NOTE: the method call parse subtree is already deleted at
             * this point, so we cannot disassemble the method invocation.
             */