diff options
Diffstat (limited to 'source/components/debugger/dbinput.c')
-rw-r--r-- | source/components/debugger/dbinput.c | 309 |
1 files changed, 226 insertions, 83 deletions
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 42452ac8749fd..2d48171c4a1dd 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -67,8 +67,18 @@ AcpiDbSingleThread ( void); static void +AcpiDbDisplayCommandInfo ( + char *Command, + BOOLEAN DisplayAll); + +static void AcpiDbDisplayHelp ( - void); + char *Command); + +static BOOLEAN +AcpiDbMatchCommandHelp ( + char *Command, + const ACPI_DB_COMMAND_HELP *Help); /* @@ -92,6 +102,7 @@ enum AcpiExDebuggerCommands CMD_DISASSEMBLE, CMD_DUMP, CMD_ENABLEACPI, + CMD_EVALUATE, CMD_EVENT, CMD_EXECUTE, CMD_EXIT, @@ -145,7 +156,7 @@ enum AcpiExDebuggerCommands /* Second parameter is the required argument count */ -static const COMMAND_INFO AcpiGbl_DbCommands[] = +static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = { {"<NOT FOUND>", 0}, {"<NULL>", 0}, @@ -161,6 +172,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"DISASSEMBLE", 1}, {"DUMP", 1}, {"ENABLEACPI", 0}, + {"EVALUATE", 1}, {"EVENT", 1}, {"EXECUTE", 1}, {"EXIT", 0}, @@ -197,7 +209,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"RESULTS", 0}, {"SET", 3}, {"SLEEP", 1}, - {"STATS", 0}, + {"STATS", 1}, {"STOP", 0}, {"TABLES", 0}, {"TEMPLATE", 1}, @@ -210,100 +222,229 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {NULL, 0} }; +/* + * Help for all debugger commands. First argument is the number of lines + * of help to output for the command. + */ +static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = +{ + {0, "\nGeneral-Purpose Commands:", "\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {2, " Dump <Address>|<Namepath>", "\n"}, + {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, + {1, " Handlers", "Info about global handlers\n"}, + {1, " Help [Command]", "This help screen or individual command\n"}, + {1, " History", "Display command history buffer\n"}, + {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"}, + {1, " Locks", "Current status of internal mutexes\n"}, + {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"}, + {1, " Quit or Exit", "Exit this command\n"}, + {9, " Stats [Allocations|Memory|Misc|", "\n"}, + {1, " Objects|Sizes|Stack|Tables]", "Display namespace and memory statistics\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {1, " Memory", "Dump internal memory lists\n"}, + {1, " Misc", "Namespace search and mutex stats\n"}, + {1, " Objects", "Summary of namespace objects\n"}, + {1, " Sizes", "Sizes for each of the internal objects\n"}, + {1, " Stack", "Display CPU stack usage\n"}, + {1, " Tables", "Info about current ACPI table(s)\n"}, + {1, " Tables", "Display info about loaded ACPI tables\n"}, + {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, + {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, + {1, " !!", "Execute last command again\n"}, + + {0, "\nNamespace Access Commands:", "\n"}, + {1, " Businfo", "Display system bus info\n"}, + {1, " Disassemble <Method>", "Disassemble a control method\n"}, + {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, + {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPEs\n"}, + {1, " Integrity", "Validate namespace integrity\n"}, + {1, " Methods", "Display list of loaded control methods\n"}, + {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, + {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, + {1, " Objects <ObjectType>", "Display all objects of the given type\n"}, + {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Predefined", "Check all predefined names\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 (* = all devices)\n"}, + {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, + {1, " Sleep <SleepState>", "Simulate sleep/wake sequence\n"}, + {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, + {1, " Terminate", "Delete namespace and all internal objects\n"}, + {1, " Type <Object>", "Display object type\n"}, + + {0, "\nControl Method Execution Commands:","\n"}, + {1, " Arguments (or Args)", "Display method arguments\n"}, + {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, + {1, " Call", "Run to next control method invocation\n"}, + {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"}, + {6, " Evaluate", "Synonym for Execute\n"}, + {5, " Execute <Namepath> [Arguments]", "Execute control method\n"}, + {1, " Hex Integer", "Integer method argument\n"}, + {1, " \"Ascii String\"", "String method argument\n"}, + {1, " (Byte List)", "Buffer method argument\n"}, + {1, " [Package Element List]", "Package method argument\n"}, + {1, " Go", "Allow method to run to completion\n"}, + {1, " Information", "Display info about the current method\n"}, + {1, " Into", "Step into (not over) a method call\n"}, + {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, + {1, " Locals", "Display method local variables\n"}, + {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, " Tree", "Display control method calling tree\n"}, + {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, + + {0, "\nFile I/O Commands:", "\n"}, + {1, " Close", "Close debug output file\n"}, + {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, + {1, " Open <Output Filename>", "Open a file for debug output\n"}, + {0, NULL, NULL} +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiDbMatchCommandHelp + * + * PARAMETERS: Command - Command string to match + * Help - Help table entry to attempt match + * + * RETURN: TRUE if command matched, FALSE otherwise + * + * DESCRIPTION: Attempt to match a command in the help table in order to + * print help information for a single command. + * + ******************************************************************************/ + +static BOOLEAN +AcpiDbMatchCommandHelp ( + char *Command, + const ACPI_DB_COMMAND_HELP *Help) +{ + char *Invocation = Help->Invocation; + UINT32 LineCount; + + + /* Valid commands in the help table begin with a couple of spaces */ + + if (*Invocation != ' ') + { + return (FALSE); + } + + while (*Invocation == ' ') + { + Invocation++; + } + + /* Match command name (full command or substring) */ + + while ((*Command) && (*Invocation) && (*Invocation != ' ')) + { + if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation)) + { + return (FALSE); + } + + Invocation++; + Command++; + } + + /* Print the appropriate number of help lines */ + + LineCount = Help->LineCount; + while (LineCount) + { + AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description); + Help++; + LineCount--; + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayCommandInfo + * + * PARAMETERS: Command - Command string to match + * DisplayAll - Display all matching commands, or just + * the first one (substring match) + * + * RETURN: None + * + * DESCRIPTION: Display help information for a Debugger command. + * + ******************************************************************************/ + +static void +AcpiDbDisplayCommandInfo ( + char *Command, + BOOLEAN DisplayAll) +{ + const ACPI_DB_COMMAND_HELP *Next; + BOOLEAN Matched; + + + Next = AcpiGbl_DbCommandHelp; + while (Next->Invocation) + { + Matched = AcpiDbMatchCommandHelp (Command, Next); + if (!DisplayAll && Matched) + { + return; + } + + Next++; + } +} + /******************************************************************************* * * FUNCTION: AcpiDbDisplayHelp * - * PARAMETERS: None + * PARAMETERS: Command - Optional command string to display help. + * if not specified, all debugger command + * help strings are displayed * * RETURN: None * - * DESCRIPTION: Print a usage message. + * DESCRIPTION: Display help for a single debugger command, or all of them. * ******************************************************************************/ static void AcpiDbDisplayHelp ( - void) + char *Command) { + const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp; + - AcpiOsPrintf ("\nGeneral-Purpose Commands:\n"); - AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); - AcpiOsPrintf (" Dump <Address>|<Namepath>\n"); - AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); - AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n"); - AcpiOsPrintf (" Handlers Info about global handlers\n"); - AcpiOsPrintf (" Help This help screen\n"); - AcpiOsPrintf (" History Display command history buffer\n"); - AcpiOsPrintf (" Level [<DebugLevel>] [console] Get/Set debug level for file or console\n"); - AcpiOsPrintf (" Locks Current status of internal mutexes\n"); - AcpiOsPrintf (" Osi [Install|Remove <name>] Display or modify global _OSI list\n"); - AcpiOsPrintf (" Quit or Exit Exit this command\n"); - AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n"); - AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); - AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); - AcpiOsPrintf (" Memory Dump internal memory lists\n"); - AcpiOsPrintf (" Misc Namespace search and mutex stats\n"); - AcpiOsPrintf (" Objects Summary of namespace objects\n"); - AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n"); - AcpiOsPrintf (" Stack Display CPU stack usage\n"); - AcpiOsPrintf (" Tables Info about current ACPI table(s)\n"); - AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n"); - AcpiOsPrintf (" Unload <Namepath> Unload an ACPI table via namespace object\n"); - AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n"); - AcpiOsPrintf (" !! Execute last command again\n"); - - AcpiOsPrintf ("\nNamespace Access Commands:\n"); - AcpiOsPrintf (" Businfo Display system bus info\n"); - AcpiOsPrintf (" Disassemble <Method> Disassemble a control method\n"); - AcpiOsPrintf (" Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n"); - AcpiOsPrintf (" Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n"); - AcpiOsPrintf (" Gpe <GpeNum> <GpeBlock> Simulate a GPE\n"); - AcpiOsPrintf (" Gpes Display info on all GPEs\n"); - AcpiOsPrintf (" Integrity Validate namespace integrity\n"); - AcpiOsPrintf (" Methods Display list of loaded control methods\n"); - AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); - AcpiOsPrintf (" Notify <Object> <Value> Send a notification on Object\n"); - AcpiOsPrintf (" Objects <ObjectType> Display all objects of the given type\n"); - AcpiOsPrintf (" Owner <OwnerId> [Depth] Display loaded namespace by object owner\n"); - AcpiOsPrintf (" Predefined Check all predefined names\n"); - AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n"); - AcpiOsPrintf (" References <Addr> Find all references to object at addr\n"); - AcpiOsPrintf (" Resources <DeviceName | *> Display Device resources (* = all devices)\n"); - AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n"); - AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n"); - AcpiOsPrintf (" Template <Object> Format/dump a Buffer/ResourceTemplate\n"); - AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n"); - AcpiOsPrintf (" Type <Object> Display object type\n"); - - AcpiOsPrintf ("\nControl Method Execution Commands:\n"); - AcpiOsPrintf (" Arguments (or Args) Display method arguments\n"); - AcpiOsPrintf (" Breakpoint <AmlOffset> Set an AML execution breakpoint\n"); - AcpiOsPrintf (" Call Run to next control method invocation\n"); - AcpiOsPrintf (" Debug <Namepath> [Arguments] Single Step a control method\n"); - AcpiOsPrintf (" Execute <Namepath> [Arguments] Execute control method\n"); - AcpiOsPrintf (" Hex Integer Integer method argument\n"); - AcpiOsPrintf (" \"Ascii String\" String method argument\n"); - AcpiOsPrintf (" (Byte List) Buffer method argument\n"); - AcpiOsPrintf (" [Package Element List] Package method argument\n"); - AcpiOsPrintf (" Go Allow method to run to completion\n"); - AcpiOsPrintf (" Information Display info about the current method\n"); - AcpiOsPrintf (" Into Step into (not over) a method call\n"); - AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n"); - AcpiOsPrintf (" Locals Display method local variables\n"); - AcpiOsPrintf (" Results Display method result stack\n"); - AcpiOsPrintf (" Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n"); - AcpiOsPrintf (" Stop Terminate control method\n"); - AcpiOsPrintf (" Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n"); - AcpiOsPrintf (" Trace <method name> Trace method execution\n"); - AcpiOsPrintf (" Tree Display control method calling tree\n"); - AcpiOsPrintf (" <Enter> Single step next AML opcode (over calls)\n"); - - AcpiOsPrintf ("\nFile I/O Commands:\n"); - AcpiOsPrintf (" Close Close debug output file\n"); - AcpiOsPrintf (" Load <Input Filename> Load ACPI table from a file\n"); - AcpiOsPrintf (" Open <Output Filename> Open a file for debug output\n"); + if (!Command) + { + /* No argument to help, display help for all commands */ + + while (Next->Invocation) + { + AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description); + Next++; + } + } + else + { + /* Display help for all commands that match the subtring */ + + AcpiDbDisplayCommandInfo (Command, TRUE); + } } @@ -601,6 +742,7 @@ AcpiDbCommandDispatch ( ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); + AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE); return (AE_CTRL_TRUE); } @@ -677,6 +819,7 @@ AcpiDbCommandDispatch ( AcpiOsPrintf ("Event command not implemented\n"); break; + case CMD_EVALUATE: case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); @@ -704,7 +847,7 @@ AcpiDbCommandDispatch ( case CMD_HELP: case CMD_HELP2: - AcpiDbDisplayHelp (); + AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); break; case CMD_HISTORY: |