diff options
Diffstat (limited to 'source/components/debugger')
| -rw-r--r-- | source/components/debugger/dbfileio.c | 26 | ||||
| -rw-r--r-- | source/components/debugger/dbinput.c | 3 | ||||
| -rw-r--r-- | source/components/debugger/dbmethod.c | 39 | 
3 files changed, 51 insertions, 17 deletions
| diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index 7b0870d1c9910..4a0fe00347027 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -135,17 +135,16 @@ AcpiDbOpenDebugFile (      AcpiDbCloseDebugFile ();      AcpiGbl_DebugFile = fopen (Name, "w+"); -    if (AcpiGbl_DebugFile) -    { -        AcpiOsPrintf ("Debug output file %s opened\n", Name); -        ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); -        AcpiGbl_DbOutputToFile = TRUE; -    } -    else +    if (!AcpiGbl_DebugFile)      {          AcpiOsPrintf ("Could not open debug file %s\n", Name); +        return;      } +    AcpiOsPrintf ("Debug output file %s opened\n", Name); +    ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name); +    AcpiGbl_DbOutputToFile = TRUE; +  #endif  }  #endif @@ -288,7 +287,7 @@ AcpiDbReadTable (      {          /* Read the table header */ -        if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != +        if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) !=                  sizeof (ACPI_TABLE_HEADER))          {              AcpiOsPrintf ("Could not read the table header\n"); @@ -387,7 +386,6 @@ AcpiDbReadTable (      AcpiOsFree (*Table);      *Table = NULL;      *TableLength = 0; -      return (AE_ERROR);  } @@ -485,15 +483,15 @@ AcpiDbReadTableFromFile (      char                    *Filename,      ACPI_TABLE_HEADER       **Table)  { -    FILE                    *fp; +    FILE                    *File;      UINT32                  TableLength;      ACPI_STATUS             Status;      /* Open the file */ -    fp = fopen (Filename, "rb"); -    if (!fp) +    File = fopen (Filename, "rb"); +    if (!File)      {          AcpiOsPrintf ("Could not open input file %s\n", Filename);          return (AE_ERROR); @@ -502,8 +500,8 @@ AcpiDbReadTableFromFile (      /* Get the entire file */      fprintf (stderr, "Loading Acpi table from file %s\n", Filename); -    Status = AcpiDbReadTable (fp, Table, &TableLength); -    fclose(fp); +    Status = AcpiDbReadTable (File, Table, &TableLength); +    fclose(File);      if (ACPI_FAILURE (Status))      { diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index a431ddcba5091..d9c01c8c4ab31 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -100,6 +100,7 @@ enum AcpiExDebuggerCommands      CMD_CLOSE,      CMD_DEBUG,      CMD_DISASSEMBLE, +    CMD_DISASM,      CMD_DUMP,      CMD_ENABLEACPI,      CMD_EVALUATE, @@ -170,6 +171,7 @@ static const ACPI_DB_COMMAND_INFO   AcpiGbl_DbCommands[] =      {"CLOSE",        0},      {"DEBUG",        1},      {"DISASSEMBLE",  1}, +    {"DISASM",       1},      {"DUMP",         1},      {"ENABLEACPI",   0},      {"EVALUATE",     1}, @@ -796,6 +798,7 @@ AcpiDbCommandDispatch (          break;      case CMD_DISASSEMBLE: +    case CMD_DISASM:          (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);          break; diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index 5335611278f78..c3266c51e2599 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -345,6 +345,13 @@ AcpiDbDisassembleMethod (          return (AE_BAD_PARAMETER);      } +    if (Method->Type != ACPI_TYPE_METHOD) +    { +        ACPI_ERROR ((AE_INFO, "%s (%s): Object must be a control method", +            Name, AcpiUtGetTypeName (Method->Type))); +        return (AE_BAD_PARAMETER); +    } +      ObjDesc = Method->Object;      Op = AcpiPsCreateScopeOp (); @@ -362,21 +369,47 @@ AcpiDbDisassembleMethod (      }      Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, -                    ObjDesc->Method.AmlStart, -                    ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); +        ObjDesc->Method.AmlStart, +        ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); +    if (ACPI_FAILURE (Status)) +    { +        return (Status); +    } + +    Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); +    WalkState->OwnerId = ObjDesc->Method.OwnerId; + +    /* Push start scope on scope stack and make it current */ + +    Status = AcpiDsScopeStackPush (Method, +        Method->Type, WalkState);      if (ACPI_FAILURE (Status))      {          return (Status);      } -    /* Parse the AML */ +    /* Parse the entire method AML including deferred operators */      WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;      WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; +      Status = AcpiPsParseAml (WalkState); +    AcpiDmParseDeferredOps (Op); +    /* Now we can disassemble the method */ + +    AcpiGbl_DbOpt_verbose = TRUE; +    AcpiGbl_DbOpt_verbose = FALSE;      AcpiDmDisassemble (NULL, Op, 0); +    AcpiGbl_DbOpt_verbose = TRUE; +      AcpiPsDeleteParseTree (Op); + +    /* Method cleanup */ + +    AcpiNsDeleteNamespaceSubtree (Method); +    AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId); +    AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);      return (AE_OK);  } | 
