mirror of
https://github.com/acpica/acpica/
synced 2025-01-16 14:29:18 +03:00
Temp fix for deadlock on namespace mutex
date 2000.08.21.23.04.00; author rmoore1; state Exp;
This commit is contained in:
parent
c1fcda9b89
commit
61f12d67da
@ -1,6 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dbapi - AML Debugger external interfaces
|
||||
*
|
||||
* Module Name: dbxface - AML Debugger external interfaces
|
||||
* $Revision: 1.26 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -37,9 +38,9 @@
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification with rights to further distribute source must include
|
||||
* the above Copyright Notice, the above License, this list of Conditions,
|
||||
@ -47,11 +48,11 @@
|
||||
* Licensee must cause all Covered Code to which Licensee contributes to
|
||||
* contain a file documenting the changes Licensee made to create that Covered
|
||||
* Code and the date of any change. Licensee must include in that file the
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* documentation of any changes made by any predecessor Licensee. Licensee
|
||||
* must include a prominent statement that the modification is derived,
|
||||
* directly or indirectly, from Original Intel Code.
|
||||
*
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
|
||||
* Redistribution of source code of any substantial portion of the Covered
|
||||
* Code or modification without rights to further distribute source must
|
||||
* include the following Disclaimer and Export Compliance provision in the
|
||||
@ -85,7 +86,7 @@
|
||||
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
* PARTICULAR PURPOSE.
|
||||
*
|
||||
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
|
||||
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
|
||||
@ -114,27 +115,27 @@
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <acpi.h>
|
||||
#include <parser.h>
|
||||
#include <amlcode.h>
|
||||
#include <namesp.h>
|
||||
#include <parser.h>
|
||||
#include <events.h>
|
||||
#include <interp.h>
|
||||
#include <debugger.h>
|
||||
#include "acpi.h"
|
||||
#include "acparser.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acparser.h"
|
||||
#include "acevents.h"
|
||||
#include "acinterp.h"
|
||||
#include "acdebug.h"
|
||||
|
||||
|
||||
#ifdef ACPI_DEBUG
|
||||
#ifdef ENABLE_DEBUGGER
|
||||
|
||||
#define _COMPONENT DEBUGGER
|
||||
MODULE_NAME ("dbcmds");
|
||||
MODULE_NAME ("dbxface");
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DbSingleStep
|
||||
*
|
||||
* PARAMETERS:
|
||||
* FUNCTION: AcpiDbSingleStep
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
@ -143,7 +144,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DbSingleStep (
|
||||
AcpiDbSingleStep (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_GENERIC_OP *Op,
|
||||
UINT8 OpType)
|
||||
@ -155,31 +156,30 @@ DbSingleStep (
|
||||
|
||||
/* Is there a breakpoint set? */
|
||||
|
||||
if (Gbl_MethodBreakpoint)
|
||||
if (WalkState->MethodBreakpoint)
|
||||
{
|
||||
/* Check if the breakpoint has been reached or passed */
|
||||
|
||||
if ((Gbl_BreakpointWalk == WalkState) &&
|
||||
(Gbl_MethodBreakpoint <= Op->AmlOffset))
|
||||
if (WalkState->MethodBreakpoint <= Op->AmlOffset)
|
||||
{
|
||||
/* Hit the breakpoint, resume single step, reset breakpoint */
|
||||
|
||||
OsdPrintf ("***Break*** at AML offset 0x%X\n", Op->AmlOffset);
|
||||
Gbl_CmSingleStep = TRUE;
|
||||
Gbl_StepToNextCall = FALSE;
|
||||
Gbl_MethodBreakpoint = 0;
|
||||
AcpiOsPrintf ("***Break*** at AML offset 0x%X\n", Op->AmlOffset);
|
||||
AcpiGbl_CmSingleStep = TRUE;
|
||||
AcpiGbl_StepToNextCall = FALSE;
|
||||
WalkState->MethodBreakpoint = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check if this is an opcode that we are interested in --
|
||||
* namely, opcodes that have arguments
|
||||
*/
|
||||
|
||||
if (Op->Opcode == AML_NAMEDFIELD_OP)
|
||||
{
|
||||
return AE_OK;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
switch (OpType)
|
||||
@ -196,9 +196,6 @@ DbSingleStep (
|
||||
case OPTYPE_NAMED_OBJECT:
|
||||
switch (Op->Opcode)
|
||||
{
|
||||
/*
|
||||
case AML_MethodOp:
|
||||
*/
|
||||
case AML_NAMEPATH_OP:
|
||||
return (AE_OK);
|
||||
break;
|
||||
@ -210,53 +207,71 @@ DbSingleStep (
|
||||
* Under certain debug conditions, display this opcode and its operands
|
||||
*/
|
||||
|
||||
if ((OutputToFile) ||
|
||||
(Gbl_CmSingleStep) ||
|
||||
(DebugLevel & TRACE_PARSE))
|
||||
if ((OutputToFile) ||
|
||||
(AcpiGbl_CmSingleStep) ||
|
||||
(AcpiDbgLevel & TRACE_PARSE))
|
||||
{
|
||||
if ((OutputToFile) ||
|
||||
(DebugLevel & TRACE_PARSE))
|
||||
(AcpiDbgLevel & TRACE_PARSE))
|
||||
{
|
||||
OsdPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n");
|
||||
AcpiOsPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n");
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Display this op (and only this op - zero out the NEXT field temporarily,
|
||||
* and disable parser trace output for the duration of the display because
|
||||
* we don't want the extraneous debug output)
|
||||
*/
|
||||
|
||||
OriginalDebugLevel = DebugLevel;
|
||||
DebugLevel &= ~(TRACE_PARSE | TRACE_FUNCTIONS);
|
||||
OriginalDebugLevel = AcpiDbgLevel;
|
||||
AcpiDbgLevel &= ~(TRACE_PARSE | TRACE_FUNCTIONS);
|
||||
Next = Op->Next;
|
||||
Op->Next = NULL;
|
||||
|
||||
/* Now we can display it */
|
||||
|
||||
DbDisplayOp (Op, ACPI_UINT32_MAX);
|
||||
AcpiDbDisplayOp (Op, ACPI_UINT32_MAX);
|
||||
|
||||
if ((Op->Opcode == AML_IF_OP) ||
|
||||
(Op->Opcode == AML_WHILE_OP))
|
||||
{
|
||||
if (WalkState->ControlState->Common.Value)
|
||||
{
|
||||
AcpiOsPrintf ("Predicate was TRUE, executed block\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
AcpiOsPrintf ("Predicate is FALSE, skipping block\n");
|
||||
}
|
||||
}
|
||||
|
||||
else if (Op->Opcode == AML_ELSE_OP)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Restore everything */
|
||||
|
||||
Op->Next = Next;
|
||||
OsdPrintf ("\n");
|
||||
DebugLevel = OriginalDebugLevel;
|
||||
AcpiOsPrintf ("\n");
|
||||
AcpiDbgLevel = OriginalDebugLevel;
|
||||
}
|
||||
|
||||
|
||||
/* If we are not single stepping, just continue executing the method */
|
||||
|
||||
if (!Gbl_CmSingleStep)
|
||||
if (!AcpiGbl_CmSingleStep)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If we are executing a step-to-call command,
|
||||
* If we are executing a step-to-call command,
|
||||
* Check if this is a method call.
|
||||
*/
|
||||
|
||||
if (Gbl_StepToNextCall)
|
||||
if (AcpiGbl_StepToNextCall)
|
||||
{
|
||||
if (Op->Opcode != AML_METHODCALL_OP)
|
||||
{
|
||||
@ -267,7 +282,7 @@ DbSingleStep (
|
||||
|
||||
/* Found a method call, stop executing */
|
||||
|
||||
Gbl_StepToNextCall = FALSE;
|
||||
AcpiGbl_StepToNextCall = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -278,32 +293,32 @@ DbSingleStep (
|
||||
|
||||
if (Op->Opcode == AML_METHODCALL_OP)
|
||||
{
|
||||
Gbl_CmSingleStep = FALSE; /* No more single step while executing called method */
|
||||
AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */
|
||||
|
||||
/* Set the breakpoint on the call, it will stop execution as soon as we return */
|
||||
|
||||
/* TBD: don't kill the user breakpoint! */
|
||||
/* TBD: [Future] don't kill the user breakpoint! */
|
||||
|
||||
Gbl_MethodBreakpoint = Op->AmlOffset + 1; /* Must be non-zero! */
|
||||
Gbl_BreakpointWalk = WalkState;
|
||||
WalkState->MethodBreakpoint = Op->AmlOffset + 1; /* Must be non-zero! */
|
||||
}
|
||||
|
||||
|
||||
/* TBD: [Investigate] what are the namespace locking issues here */
|
||||
|
||||
CmReleaseMutex (MTX_NAMESPACE);
|
||||
/* AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); */
|
||||
|
||||
/* Go into the command loop and await next user command */
|
||||
|
||||
Gbl_MethodExecuting = TRUE;
|
||||
|
||||
AcpiGbl_MethodExecuting = TRUE;
|
||||
Status = AE_CTRL_TRUE;
|
||||
while (Status == AE_CTRL_TRUE)
|
||||
{
|
||||
if (Gbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
|
||||
if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
|
||||
{
|
||||
/* Handshake with the front-end that gets user command lines */
|
||||
|
||||
CmReleaseMutex (MTX_DEBUG_COMMAND);
|
||||
CmAcquireMutex (MTX_DEBUGGER);
|
||||
AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
|
||||
AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
|
||||
}
|
||||
|
||||
else
|
||||
@ -312,41 +327,41 @@ DbSingleStep (
|
||||
|
||||
/* Force output to console until a command is entered */
|
||||
|
||||
DbSetOutputDestination (DB_CONSOLE_OUTPUT);
|
||||
AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
|
||||
|
||||
/* Different prompt if method is executing */
|
||||
|
||||
if (!Gbl_MethodExecuting)
|
||||
if (!AcpiGbl_MethodExecuting)
|
||||
{
|
||||
OsdPrintf ("%1c ", DB_COMMAND_PROMPT);
|
||||
AcpiOsPrintf ("%1c ", DB_COMMAND_PROMPT);
|
||||
}
|
||||
else
|
||||
{
|
||||
OsdPrintf ("%1c ", DB_EXECUTE_PROMPT);
|
||||
AcpiOsPrintf ("%1c ", DB_EXECUTE_PROMPT);
|
||||
}
|
||||
|
||||
/* Get the user input line */
|
||||
|
||||
OsdGetLine (LineBuf);
|
||||
AcpiOsGetLine (LineBuf);
|
||||
}
|
||||
|
||||
Status = DbCommandDispatch (LineBuf, WalkState, Op);
|
||||
Status = AcpiDbCommandDispatch (LineBuf, WalkState, Op);
|
||||
}
|
||||
|
||||
CmAcquireMutex (MTX_NAMESPACE);
|
||||
/* AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); */
|
||||
|
||||
|
||||
/* User commands complete, continue execution of the interrupted method */
|
||||
|
||||
return Status;
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: DbInitialize
|
||||
*
|
||||
* PARAMETERS:
|
||||
* FUNCTION: AcpiDbInitialize
|
||||
*
|
||||
* PARAMETERS:
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
@ -355,36 +370,48 @@ DbSingleStep (
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
DbInitialize (void)
|
||||
{
|
||||
AcpiDbInitialize (void)
|
||||
{
|
||||
|
||||
|
||||
/* Init globals */
|
||||
|
||||
Buffer = OsdAllocate (BUFFER_SIZE);
|
||||
Buffer = AcpiOsAllocate (BUFFER_SIZE);
|
||||
|
||||
/* Initial scope is the root */
|
||||
|
||||
// setvbuf (stdin, NULL, _IONBF, 0);
|
||||
ScopeBuf [0] = '\\';
|
||||
ScopeBuf [1] = 0;
|
||||
|
||||
if (Gbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
|
||||
{
|
||||
CmAcquireMutex (MTX_DEBUG_COMMAND);
|
||||
CmAcquireMutex (MTX_DEBUGGER);
|
||||
|
||||
OsdQueueForExecution (0, DbExecuteThread, NULL);
|
||||
/*
|
||||
* If configured for multi-thread support, the debug executor runs in
|
||||
* a separate thread so that the front end can be in another address
|
||||
* space, environment, or even another machine.
|
||||
*/
|
||||
|
||||
if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
|
||||
{
|
||||
/* These were created with one unit, grab it */
|
||||
|
||||
AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
|
||||
AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
|
||||
|
||||
/* Create the debug execution thread to execute commands */
|
||||
|
||||
AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL);
|
||||
}
|
||||
|
||||
if (!opt_verbose)
|
||||
{
|
||||
INDENT_STRING = " ";
|
||||
if (!opt_verbose)
|
||||
{
|
||||
INDENT_STRING = " ";
|
||||
opt_disasm = TRUE;
|
||||
opt_stats = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* ACPI_DEBUG */
|
||||
#endif /* ENABLE_DEBUGGER */
|
||||
|
Loading…
Reference in New Issue
Block a user