summaryrefslogtreecommitdiff
path: root/source/components/debugger
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2015-07-20 22:31:50 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2015-07-20 22:31:50 +0000
commit136eac2a0638d3c751b1987603f71a9ae26879fd (patch)
tree1e61df024e8a47b6bc4e25d07f455c9dcd7e2dc8 /source/components/debugger
parentf3bbb1ca6c1b2b877d015a8f5f0c67e48a7a57ae (diff)
Notes
Diffstat (limited to 'source/components/debugger')
-rw-r--r--source/components/debugger/dbcmds.c86
-rw-r--r--source/components/debugger/dbdisply.c11
-rw-r--r--source/components/debugger/dbinput.c29
-rw-r--r--source/components/debugger/dbmethod.c20
-rw-r--r--source/components/debugger/dbnames.c6
-rw-r--r--source/components/debugger/dbobject.c525
-rw-r--r--source/components/debugger/dbutils.c3
-rw-r--r--source/components/debugger/dbxface.c16
8 files changed, 667 insertions, 29 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c
index 4a2c4e8501077..d22bf4ca79e28 100644
--- a/source/components/debugger/dbcmds.c
+++ b/source/components/debugger/dbcmds.c
@@ -86,6 +86,8 @@ AcpiDbDoOneSleepState (
UINT8 SleepState);
+static char *AcpiDbTraceMethodName = NULL;
+
/*******************************************************************************
*
* FUNCTION: AcpiDbConvertToNode
@@ -1226,4 +1228,88 @@ AcpiDbGenerateSci (
#endif /* !ACPI_REDUCED_HARDWARE */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbTrace
+ *
+ * PARAMETERS: EnableArg - ENABLE/AML to enable tracer
+ * DISABLE to disable tracer
+ * MethodArg - Method to trace
+ * OnceArg - Whether trace once
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Control method tracing facility
+ *
+ ******************************************************************************/
+
+void
+AcpiDbTrace (
+ char *EnableArg,
+ char *MethodArg,
+ char *OnceArg)
+{
+ UINT32 DebugLevel = 0;
+ UINT32 DebugLayer = 0;
+ UINT32 Flags = 0;
+
+
+ if (EnableArg)
+ {
+ AcpiUtStrupr (EnableArg);
+ }
+ if (OnceArg)
+ {
+ AcpiUtStrupr (OnceArg);
+ }
+ if (MethodArg)
+ {
+ if (AcpiDbTraceMethodName)
+ {
+ ACPI_FREE (AcpiDbTraceMethodName);
+ AcpiDbTraceMethodName = NULL;
+ }
+ AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1);
+ if (!AcpiDbTraceMethodName)
+ {
+ AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg);
+ return;
+ }
+ strcpy (AcpiDbTraceMethodName, MethodArg);
+ }
+ if (!strcmp (EnableArg, "ENABLE") ||
+ !strcmp (EnableArg, "METHOD") ||
+ !strcmp (EnableArg, "OPCODE"))
+ {
+ if (!strcmp (EnableArg, "ENABLE"))
+ {
+ /* Inherit current console settings */
+
+ DebugLevel = AcpiGbl_DbConsoleDebugLevel;
+ DebugLayer = AcpiDbgLayer;
+ }
+ else
+ {
+ /* Restrict console output to trace points only */
+
+ DebugLevel = ACPI_LV_TRACE_POINT;
+ DebugLayer = ACPI_EXECUTER;
+ }
+
+ Flags = ACPI_TRACE_ENABLED;
+ if (!strcmp (EnableArg, "OPCODE"))
+ {
+ Flags |= ACPI_TRACE_OPCODE;
+ }
+ if (OnceArg && !strcmp (OnceArg, "ONCE"))
+ {
+ Flags |= ACPI_TRACE_ONESHOT;
+ }
+ }
+
+ (void) AcpiDebugTrace (AcpiDbTraceMethodName,
+ DebugLevel, DebugLayer, Flags);
+}
+
#endif /* ACPI_DEBUGGER */
diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c
index aedc8bfb8258f..10821a2f4a0d9 100644
--- a/source/components/debugger/dbdisply.c
+++ b/source/components/debugger/dbdisply.c
@@ -49,7 +49,6 @@
#include "acparser.h"
#include "acinterp.h"
#include "acdebug.h"
-#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
@@ -513,7 +512,7 @@ AcpiDbDisplayLocals (
return;
}
- AcpiDmDisplayLocals (WalkState);
+ AcpiDbDecodeLocals (WalkState);
}
@@ -543,7 +542,7 @@ AcpiDbDisplayArguments (
return;
}
- AcpiDmDisplayArguments (WalkState);
+ AcpiDbDecodeArguments (WalkState);
}
@@ -599,7 +598,7 @@ AcpiDbDisplayResults (
{
ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%u: ", i);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
if (Index == 0)
{
Frame = Frame->Results.Next;
@@ -763,7 +762,7 @@ AcpiDbDisplayResultObject (
}
AcpiOsPrintf ("ResultObj: ");
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
AcpiOsPrintf ("\n");
}
@@ -793,7 +792,7 @@ AcpiDbDisplayArgumentObject (
}
AcpiOsPrintf ("ArgObj: ");
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
}
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index e588167dd03ea..15dfb4b3a70ce 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -218,7 +218,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"TABLES", 0},
{"TEMPLATE", 1},
{"TERMINATE", 0},
- {"TEST", 1},
+ {"TEST", 1},
{"THREADS", 3},
{"TRACE", 1},
{"TREE", 0},
@@ -270,7 +270,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
- {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
+ {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
@@ -297,8 +297,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Results", "Display method result stack\n"},
{1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
- {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
- {1, " Trace <method name>", "Trace method execution\n"},
+ {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"},
+ {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
+ {1, " Enable", "Enable all messages\n"},
+ {1, " Disable", "Disable tracing\n"},
+ {1, " Method", "Enable method execution messages\n"},
+ {1, " Opcode", "Enable opcode execution messages\n"},
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
@@ -749,15 +753,22 @@ AcpiDbCommandDispatch (
return (AE_CTRL_TERMINATE);
}
-
- /* Add all commands that come here to the history buffer */
-
- AcpiDbAddToHistory (InputBuffer);
+ /* Find command and add to the history buffer */
ParamCount = AcpiDbGetLine (InputBuffer);
CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
Temp = 0;
+ /*
+ * We don't want to add the !! command to the history buffer. It
+ * would cause an infinite loop because it would always be the
+ * previous command.
+ */
+ if (CommandIndex != CMD_HISTORY_LAST)
+ {
+ AcpiDbAddToHistory (InputBuffer);
+ }
+
/* Verify that we have the minimum number of params */
if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
@@ -1110,7 +1121,7 @@ AcpiDbCommandDispatch (
case CMD_TRACE:
- (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
+ AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
break;
case CMD_TREE:
diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c
index 2b03d359f3c7a..f42496a399b71 100644
--- a/source/components/debugger/dbmethod.c
+++ b/source/components/debugger/dbmethod.c
@@ -46,7 +46,9 @@
#include "acdispat.h"
#include "acnamesp.h"
#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
+#endif
#include "acparser.h"
#include "acpredef.h"
@@ -79,6 +81,7 @@ AcpiDbSetMethodBreakpoint (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Address;
+ UINT32 AmlOffset;
if (!Op)
@@ -90,10 +93,12 @@ AcpiDbSetMethodBreakpoint (
/* Get and verify the breakpoint address */
Address = strtoul (Location, NULL, 16);
- if (Address <= Op->Common.AmlOffset)
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ WalkState->ParserState.AmlStart);
+ if (Address <= AmlOffset)
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
- Address, Op->Common.AmlOffset);
+ Address, AmlOffset);
}
/* Save breakpoint in current walk */
@@ -238,7 +243,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->Arguments[Index].Object;
AcpiOsPrintf ("Arg%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
break;
case 'L':
@@ -261,7 +266,7 @@ AcpiDbSetMethodData (
ObjDesc = WalkState->LocalVariables[Index].Object;
AcpiOsPrintf ("Local%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
break;
default:
@@ -307,7 +312,9 @@ AcpiDbDisassembleAml (
NumStatements = strtoul (Statements, NULL, 0);
}
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (NULL, Op, NumStatements);
+#endif
}
@@ -350,7 +357,7 @@ AcpiDbDisassembleMethod (
ObjDesc = Method->Object;
- Op = AcpiPsCreateScopeOp ();
+ Op = AcpiPsCreateScopeOp (ObjDesc->Method.AmlStart);
if (!Op)
{
return (AE_NO_MEMORY);
@@ -390,6 +397,8 @@ AcpiDbDisassembleMethod (
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
+
+#ifdef ACPI_DISASSEMBER
(void) AcpiDmParseDeferredOps (Op);
/* Now we can disassemble the method */
@@ -397,6 +406,7 @@ AcpiDbDisassembleMethod (
AcpiGbl_DbOpt_Verbose = FALSE;
AcpiDmDisassemble (NULL, Op, 0);
AcpiGbl_DbOpt_Verbose = TRUE;
+#endif
AcpiPsDeleteParseTree (Op);
diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c
index 0b56f076bf7f8..716fd3ce5cb66 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/components/debugger/dbnames.c
@@ -385,7 +385,7 @@ AcpiDbWalkAndMatchName (
/* Get the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
@@ -582,7 +582,7 @@ AcpiDbWalkForSpecificObjects (
/* Get and display the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
@@ -886,7 +886,7 @@ AcpiDbBusWalk (
/* Get the full path to this device object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c
new file mode 100644
index 0000000000000..c7447af6d9d87
--- /dev/null
+++ b/source/components/debugger/dbobject.c
@@ -0,0 +1,525 @@
+/*******************************************************************************
+ *
+ * Module Name: dbobject - ACPI object decode and display
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2015, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
+#include "acdisasm.h"
+#endif
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbobject")
+
+/* Local prototypes */
+
+static void
+AcpiDbDecodeNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpMethodInfo
+ *
+ * PARAMETERS: Status - Method execution status
+ * WalkState - Current state of the parse tree walk
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Called when a method has been aborted because of an error.
+ * Dumps the method execution stack, and the method locals/args,
+ * and disassembles the AML opcode that failed.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpMethodInfo (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_THREAD_STATE *Thread;
+
+
+ /* Ignore control codes, they are not errors */
+
+ if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
+ {
+ return;
+ }
+
+ /* We may be executing a deferred opcode */
+
+ if (WalkState->DeferredNode)
+ {
+ AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
+ return;
+ }
+
+ /*
+ * 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.
+ */
+ Thread = WalkState->Thread;
+ if (!Thread)
+ {
+ return;
+ }
+
+ /* Display the method locals and arguments */
+
+ AcpiOsPrintf ("\n");
+ AcpiDbDecodeLocals (WalkState);
+ AcpiOsPrintf ("\n");
+ AcpiDbDecodeArguments (WalkState);
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDecodeInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDecodeInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ UINT32 i;
+
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf (" Uninitialized");
+ return;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
+ return;
+ }
+
+ AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
+
+ switch (ObjDesc->Common.Type)
+ {
+ case ACPI_TYPE_INTEGER:
+
+ AcpiOsPrintf (" %8.8X%8.8X",
+ ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("(%u) \"%.24s",
+ ObjDesc->String.Length, ObjDesc->String.Pointer);
+
+ if (ObjDesc->String.Length > 24)
+ {
+ AcpiOsPrintf ("...");
+ }
+ else
+ {
+ AcpiOsPrintf ("\"");
+ }
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length);
+ for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
+ {
+ AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf (" %p", ObjDesc);
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDecodeNode
+ *
+ * PARAMETERS: Node - Object to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of a namespace node
+ *
+ ******************************************************************************/
+
+static void
+AcpiDbDecodeNode (
+ ACPI_NAMESPACE_NODE *Node)
+{
+
+ AcpiOsPrintf ("<Node> Name %4.4s",
+ AcpiUtGetNodeName (Node));
+
+ if (Node->Flags & ANOBJ_METHOD_ARG)
+ {
+ AcpiOsPrintf (" [Method Arg]");
+ }
+ if (Node->Flags & ANOBJ_METHOD_LOCAL)
+ {
+ AcpiOsPrintf (" [Method Local]");
+ }
+
+ switch (Node->Type)
+ {
+ /* These types have no attached object */
+
+ case ACPI_TYPE_DEVICE:
+
+ AcpiOsPrintf (" Device");
+ break;
+
+ case ACPI_TYPE_THERMAL:
+
+ AcpiOsPrintf (" Thermal Zone");
+ break;
+
+ default:
+
+ AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node));
+ break;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayInternalObject
+ *
+ * PARAMETERS: ObjDesc - Object to be displayed
+ * WalkState - Current walk state
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Short display of an internal object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisplayInternalObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT8 Type;
+
+
+ AcpiOsPrintf ("%p ", ObjDesc);
+
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("<Null Object>\n");
+ return;
+ }
+
+ /* Decode the object type */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
+ {
+ case ACPI_DESC_TYPE_PARSER:
+
+ AcpiOsPrintf ("<Parser> ");
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+
+ AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ break;
+
+ case ACPI_DESC_TYPE_OPERAND:
+
+ Type = ObjDesc->Common.Type;
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
+ return;
+ }
+
+ /* Decode the ACPI object type */
+
+ switch (ObjDesc->Common.Type)
+ {
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc));
+
+ /* Decode the refererence */
+
+ switch (ObjDesc->Reference.Class)
+ {
+ case ACPI_REFCLASS_LOCAL:
+
+ AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->LocalVariables
+ [ObjDesc->Reference.Value].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDbDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+ case ACPI_REFCLASS_ARG:
+
+ AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
+ if (WalkState)
+ {
+ ObjDesc = WalkState->Arguments
+ [ObjDesc->Reference.Value].Object;
+ AcpiOsPrintf ("%p", ObjDesc);
+ AcpiDbDecodeInternalObject (ObjDesc);
+ }
+ break;
+
+ case ACPI_REFCLASS_INDEX:
+
+ switch (ObjDesc->Reference.TargetType)
+ {
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
+ AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiOsPrintf ("%p", ObjDesc->Reference.Where);
+ if (!ObjDesc->Reference.Where)
+ {
+ AcpiOsPrintf (" Uninitialized WHERE pointer");
+ }
+ else
+ {
+ AcpiDbDecodeInternalObject (
+ *(ObjDesc->Reference.Where));
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("Unknown index target type");
+ break;
+ }
+ break;
+
+ case ACPI_REFCLASS_REFOF:
+
+ if (!ObjDesc->Reference.Object)
+ {
+ AcpiOsPrintf ("Uninitialized reference subobject pointer");
+ break;
+ }
+
+ /* Reference can be to a Node or an Operand object */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
+ {
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiDbDecodeNode (ObjDesc->Reference.Object);
+ break;
+
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case ACPI_REFCLASS_NAME:
+
+ AcpiDbDecodeNode (ObjDesc->Reference.Node);
+ break;
+
+ case ACPI_REFCLASS_DEBUG:
+ case ACPI_REFCLASS_TABLE:
+
+ AcpiOsPrintf ("\n");
+ break;
+
+ default: /* Unknown reference class */
+
+ AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
+ break;
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("<Obj> ");
+ AcpiDbDecodeInternalObject (ObjDesc);
+ break;
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]",
+ AcpiUtGetDescriptorName (ObjDesc));
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDecodeLocals
+ *
+ * PARAMETERS: WalkState - State for current method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all locals for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDecodeLocals (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf (
+ "No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ if (Node->Type != ACPI_TYPE_METHOD)
+ {
+ AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
+ return;
+ }
+
+ AcpiOsPrintf ("Local Variables for method [%4.4s]:\n",
+ AcpiUtGetNodeName (Node));
+
+ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
+ {
+ ObjDesc = WalkState->LocalVariables[i].Object;
+ AcpiOsPrintf (" Local%X: ", i);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDecodeArguments
+ *
+ * PARAMETERS: WalkState - State for current method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display all arguments for the currently running control method
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDecodeArguments (
+ ACPI_WALK_STATE *WalkState)
+{
+ UINT32 i;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ObjDesc = WalkState->MethodDesc;
+ Node = WalkState->MethodNode;
+ if (!Node)
+ {
+ AcpiOsPrintf (
+ "No method node (Executing subtree for buffer or opregion)\n");
+ return;
+ }
+
+ if (Node->Type != ACPI_TYPE_METHOD)
+ {
+ AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
+ return;
+ }
+
+ AcpiOsPrintf (
+ "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
+ AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel);
+
+ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
+ {
+ ObjDesc = WalkState->Arguments[i].Object;
+ AcpiOsPrintf (" Arg%u: ", i);
+ AcpiDbDisplayInternalObject (ObjDesc, WalkState);
+ }
+}
+
+#endif
diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c
index a089344e2297a..4a7cf4144208c 100644
--- a/source/components/debugger/dbutils.c
+++ b/source/components/debugger/dbutils.c
@@ -45,7 +45,6 @@
#include "accommon.h"
#include "acnamesp.h"
#include "acdebug.h"
-#include "acdisasm.h"
#ifdef ACPI_DEBUGGER
@@ -223,7 +222,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] = ");
- AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
+ AcpiDbDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
break;
case ACPI_TYPE_PROCESSOR:
diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c
index 33d5e363b6498..6dcf1e54c8d0c 100644
--- a/source/components/debugger/dbxface.c
+++ b/source/components/debugger/dbxface.c
@@ -45,7 +45,9 @@
#include "accommon.h"
#include "amlcode.h"
#include "acdebug.h"
+#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
+#endif
#ifdef ACPI_DEBUGGER
@@ -179,6 +181,7 @@ AcpiDbSingleStep (
UINT32 OriginalDebugLevel;
ACPI_PARSE_OBJECT *DisplayOp;
ACPI_PARSE_OBJECT *ParentOp;
+ UINT32 AmlOffset;
ACPI_FUNCTION_ENTRY ();
@@ -192,15 +195,18 @@ AcpiDbSingleStep (
return (AE_ABORT_METHOD);
}
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
+ WalkState->ParserState.AmlStart);
+
/* Check for single-step breakpoint */
if (WalkState->MethodBreakpoint &&
- (WalkState->MethodBreakpoint <= Op->Common.AmlOffset))
+ (WalkState->MethodBreakpoint <= AmlOffset))
{
/* Check if the breakpoint has been reached or passed */
/* Hit the breakpoint, resume single step, reset breakpoint */
- AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset);
+ AcpiOsPrintf ("***Break*** at AML offset %X\n", AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
WalkState->MethodBreakpoint = 0;
@@ -209,10 +215,10 @@ AcpiDbSingleStep (
/* Check for user breakpoint (Must be on exact Aml offset) */
else if (WalkState->UserBreakpoint &&
- (WalkState->UserBreakpoint == Op->Common.AmlOffset))
+ (WalkState->UserBreakpoint == AmlOffset))
{
AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n",
- Op->Common.AmlOffset);
+ AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
WalkState->MethodBreakpoint = 0;
@@ -308,7 +314,9 @@ AcpiDbSingleStep (
/* Now we can display it */
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX);
+#endif
if ((Op->Common.AmlOpcode == AML_IF_OP) ||
(Op->Common.AmlOpcode == AML_WHILE_OP))