AML Parser: Add debug option to dump parse trees

Debug level 0x00800000 will dump the current parse tree
just before it is deleted.
This commit is contained in:
Robert Moore 2018-05-18 10:11:40 -07:00
parent 926a7331ef
commit 288363a4e1
2 changed files with 30 additions and 3 deletions

View File

@ -169,6 +169,8 @@
*
******************************************************************************/
#include "amlcode.h"
void
AcpiPsDeleteParseTree (
ACPI_PARSE_OBJECT *SubtreeRoot)
@ -176,19 +178,40 @@ AcpiPsDeleteParseTree (
ACPI_PARSE_OBJECT *Op = SubtreeRoot;
ACPI_PARSE_OBJECT *Next = NULL;
ACPI_PARSE_OBJECT *Parent = NULL;
UINT32 Level = 0;
ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE_TREES,
" root %p\n", SubtreeRoot));
/* Visit all nodes in the subtree */
while (Op)
{
/* Check if we are not ascending */
if (Op != Parent)
{
/* This is the descending case */
if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_PARSE_TREES, _COMPONENT))
{
/* This debug option will print the entire parse tree */
AcpiOsPrintf (" %*.s%s %p", (Level * 4), " ",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Op);
if (Op->Named.AmlOpcode == AML_INT_NAMEPATH_OP)
{
AcpiOsPrintf (" %4.4s", Op->Common.Value.String);
}
if (Op->Named.AmlOpcode == AML_STRING_OP)
{
AcpiOsPrintf (" %s", Op->Common.Value.String);
}
AcpiOsPrintf ("\n");
}
/* Look for an argument or child of the current op */
Next = AcpiPsGetArg (Op, 0);
@ -197,6 +220,7 @@ AcpiPsDeleteParseTree (
/* Still going downward in tree (Op is not completed yet) */
Op = Next;
Level++;
continue;
}
}
@ -221,6 +245,7 @@ AcpiPsDeleteParseTree (
}
else
{
Level--;
Op = Parent;
}
}

View File

@ -223,7 +223,8 @@
#define ACPI_LV_ALLOCATIONS 0x00100000
#define ACPI_LV_FUNCTIONS 0x00200000
#define ACPI_LV_OPTIMIZATIONS 0x00400000
#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1
#define ACPI_LV_PARSE_TREES 0x00800000
#define ACPI_LV_VERBOSITY2 0x00F00000 | ACPI_LV_VERBOSITY1
#define ACPI_LV_ALL ACPI_LV_VERBOSITY2
/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
@ -275,6 +276,7 @@
#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
#define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES)
#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)