1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2015, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdebug.h>
51 #define _COMPONENT ACPI_CA_DEBUGGER
52 ACPI_MODULE_NAME ("dbinput")
54 /* Local prototypes */
69 AcpiDbDisplayCommandInfo (
78 AcpiDbMatchCommandHelp (
80 const ACPI_DB_COMMAND_HELP *Help);
84 * Top-level debugger commands.
86 * This list of commands must match the string table below it
88 enum AcpiExDebuggerCommands
156 #define CMD_FIRST_VALID 2
159 /* Second parameter is the required argument count */
161 static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
231 * Help for all debugger commands. First argument is the number of lines
232 * of help to output for the command.
234 static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
236 {0, "\nGeneral-Purpose Commands:", "\n"},
237 {1, " Allocations", "Display list of current memory allocations\n"},
238 {2, " Dump <Address>|<Namepath>", "\n"},
239 {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
240 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
241 {1, " Handlers", "Info about global handlers\n"},
242 {1, " Help [Command]", "This help screen or individual command\n"},
243 {1, " History", "Display command history buffer\n"},
244 {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
245 {1, " Locks", "Current status of internal mutexes\n"},
246 {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
247 {1, " Quit or Exit", "Exit this command\n"},
248 {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"},
249 {1, " Allocations", "Display list of current memory allocations\n"},
250 {1, " Memory", "Dump internal memory lists\n"},
251 {1, " Misc", "Namespace search and mutex stats\n"},
252 {1, " Objects", "Summary of namespace objects\n"},
253 {1, " Sizes", "Sizes for each of the internal objects\n"},
254 {1, " Stack", "Display CPU stack usage\n"},
255 {1, " Tables", "Info about current ACPI table(s)\n"},
256 {1, " Tables", "Display info about loaded ACPI tables\n"},
257 {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
258 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
259 {1, " !!", "Execute last command again\n"},
261 {0, "\nNamespace Access Commands:", "\n"},
262 {1, " Businfo", "Display system bus info\n"},
263 {1, " Disassemble <Method>", "Disassemble a control method\n"},
264 {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
265 {1, " Integrity", "Validate namespace integrity\n"},
266 {1, " Methods", "Display list of loaded control methods\n"},
267 {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
268 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
269 {1, " Objects <ObjectType>", "Display all objects of the given type\n"},
270 {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
271 {1, " Paths", "Display full pathnames of namespace objects\n"},
272 {1, " Predefined", "Check all predefined names\n"},
273 {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
274 {1, " References <Addr>", "Find all references to object at addr\n"},
275 {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
276 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
277 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
278 {1, " Terminate", "Delete namespace and all internal objects\n"},
279 {1, " Type <Object>", "Display object type\n"},
281 {0, "\nControl Method Execution Commands:","\n"},
282 {1, " Arguments (or Args)", "Display method arguments\n"},
283 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
284 {1, " Call", "Run to next control method invocation\n"},
285 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
286 {6, " Evaluate", "Synonym for Execute\n"},
287 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
288 {1, " Hex Integer", "Integer method argument\n"},
289 {1, " \"Ascii String\"", "String method argument\n"},
290 {1, " (Hex Byte List)", "Buffer method argument\n"},
291 {1, " [Package Element List]", "Package method argument\n"},
292 {1, " Go", "Allow method to run to completion\n"},
293 {1, " Information", "Display info about the current method\n"},
294 {1, " Into", "Step into (not over) a method call\n"},
295 {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
296 {1, " Locals", "Display method local variables\n"},
297 {1, " Results", "Display method result stack\n"},
298 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
299 {1, " Stop", "Terminate control method\n"},
300 {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
301 {1, " Trace <method name>", "Trace method execution\n"},
302 {1, " Tree", "Display control method calling tree\n"},
303 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
305 {0, "\nHardware Related Commands:", "\n"},
306 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
307 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
308 {1, " Gpes", "Display info on all GPEs\n"},
309 {1, " Sci", "Generate an SCI\n"},
310 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
312 {0, "\nFile I/O Commands:", "\n"},
313 {1, " Close", "Close debug output file\n"},
314 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
315 {1, " Open <Output Filename>", "Open a file for debug output\n"},
317 {0, "\nDebug Test Commands:", "\n"},
318 {3, " Test <TestName>", "Invoke a debug test\n"},
319 {1, " Objects", "Read/write/compare all namespace data objects\n"},
320 {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"},
325 /*******************************************************************************
327 * FUNCTION: AcpiDbMatchCommandHelp
329 * PARAMETERS: Command - Command string to match
330 * Help - Help table entry to attempt match
332 * RETURN: TRUE if command matched, FALSE otherwise
334 * DESCRIPTION: Attempt to match a command in the help table in order to
335 * print help information for a single command.
337 ******************************************************************************/
340 AcpiDbMatchCommandHelp (
342 const ACPI_DB_COMMAND_HELP *Help)
344 char *Invocation = Help->Invocation;
348 /* Valid commands in the help table begin with a couple of spaces */
350 if (*Invocation != ' ')
355 while (*Invocation == ' ')
360 /* Match command name (full command or substring) */
362 while ((*Command) && (*Invocation) && (*Invocation != ' '))
364 if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation))
373 /* Print the appropriate number of help lines */
375 LineCount = Help->LineCount;
378 AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description);
387 /*******************************************************************************
389 * FUNCTION: AcpiDbDisplayCommandInfo
391 * PARAMETERS: Command - Command string to match
392 * DisplayAll - Display all matching commands, or just
393 * the first one (substring match)
397 * DESCRIPTION: Display help information for a Debugger command.
399 ******************************************************************************/
402 AcpiDbDisplayCommandInfo (
406 const ACPI_DB_COMMAND_HELP *Next;
410 Next = AcpiGbl_DbCommandHelp;
411 while (Next->Invocation)
413 Matched = AcpiDbMatchCommandHelp (Command, Next);
414 if (!DisplayAll && Matched)
424 /*******************************************************************************
426 * FUNCTION: AcpiDbDisplayHelp
428 * PARAMETERS: Command - Optional command string to display help.
429 * if not specified, all debugger command
430 * help strings are displayed
434 * DESCRIPTION: Display help for a single debugger command, or all of them.
436 ******************************************************************************/
442 const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp;
447 /* No argument to help, display help for all commands */
449 while (Next->Invocation)
451 AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description);
457 /* Display help for all commands that match the subtring */
459 AcpiDbDisplayCommandInfo (Command, TRUE);
464 /*******************************************************************************
466 * FUNCTION: AcpiDbGetNextToken
468 * PARAMETERS: String - Command buffer
469 * Next - Return value, end of next token
471 * RETURN: Pointer to the start of the next token.
473 * DESCRIPTION: Command line parsing. Get the next token on the command line
475 ******************************************************************************/
481 ACPI_OBJECT_TYPE *ReturnType)
485 ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER;
488 /* At end of buffer? */
490 if (!String || !(*String))
495 /* Remove any spaces at the beginning */
499 while (*String && (*String == ' '))
514 /* This is a quoted string, scan until closing quote */
518 Type = ACPI_TYPE_STRING;
520 /* Find end of string */
522 while (*String && (*String != '"'))
530 /* This is the start of a buffer, scan until closing paren */
534 Type = ACPI_TYPE_BUFFER;
536 /* Find end of buffer */
538 while (*String && (*String != ')'))
546 /* This is the start of a package, scan until closing bracket */
551 Type = ACPI_TYPE_PACKAGE;
553 /* Find end of package (closing bracket) */
557 /* Handle String package elements */
561 /* Find end of string */
564 while (*String && (*String != '"'))
573 else if (*String == '[')
575 Depth++; /* A nested package declaration */
577 else if (*String == ']')
580 if (Depth == 0) /* Found final package closing bracket */
594 /* Find end of token */
596 while (*String && (*String != ' '))
618 /*******************************************************************************
620 * FUNCTION: AcpiDbGetLine
622 * PARAMETERS: InputBuffer - Command line buffer
624 * RETURN: Count of arguments to the command
626 * DESCRIPTION: Get the next command line from the user. Gets entire line
627 * up to the next newline
629 ******************************************************************************/
641 if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
644 AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n",
645 sizeof (AcpiGbl_DbParsedBuf));
649 This = AcpiGbl_DbParsedBuf;
650 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
652 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next,
653 &AcpiGbl_DbArgTypes[i]);
654 if (!AcpiGbl_DbArgs[i])
662 /* Uppercase the actual command */
664 if (AcpiGbl_DbArgs[0])
666 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
672 Count--; /* Number of args only */
679 /*******************************************************************************
681 * FUNCTION: AcpiDbMatchCommand
683 * PARAMETERS: UserCommand - User command line
685 * RETURN: Index into command array, -1 if not found
687 * DESCRIPTION: Search command array for a command match
689 ******************************************************************************/
698 if (!UserCommand || UserCommand[0] == 0)
703 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
705 if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
706 AcpiGbl_DbCommands[i].Name)
712 /* Command not recognized */
714 return (CMD_NOT_FOUND);
718 /*******************************************************************************
720 * FUNCTION: AcpiDbCommandDispatch
722 * PARAMETERS: InputBuffer - Command line buffer
723 * WalkState - Current walk
724 * Op - Current (executing) parse op
728 * DESCRIPTION: Command dispatcher.
730 ******************************************************************************/
733 AcpiDbCommandDispatch (
735 ACPI_WALK_STATE *WalkState,
736 ACPI_PARSE_OBJECT *Op)
742 ACPI_STATUS Status = AE_CTRL_TRUE;
745 /* If AcpiTerminate has been called, terminate this thread */
747 if (AcpiGbl_DbTerminateThreads)
749 return (AE_CTRL_TERMINATE);
753 /* Add all commands that come here to the history buffer */
755 AcpiDbAddToHistory (InputBuffer);
757 ParamCount = AcpiDbGetLine (InputBuffer);
758 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
761 /* Verify that we have the minimum number of params */
763 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
765 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
766 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
767 AcpiGbl_DbCommands[CommandIndex].MinArgs);
769 AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
770 return (AE_CTRL_TRUE);
773 /* Decode and dispatch the command */
775 switch (CommandIndex)
785 case CMD_ALLOCATIONS:
787 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
788 AcpiUtDumpAllocations ((UINT32) -1, NULL);
795 AcpiDbDisplayArguments ();
800 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
810 AcpiDbSetMethodCallBreakpoint (Op);
816 AcpiDbCloseDebugFile ();
821 AcpiDbExecute (AcpiGbl_DbArgs[1],
822 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
825 case CMD_DISASSEMBLE:
828 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
833 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
837 #if (!ACPI_REDUCED_HARDWARE)
839 Status = AcpiEnable();
840 if (ACPI_FAILURE(Status))
842 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
845 #endif /* !ACPI_REDUCED_HARDWARE */
850 AcpiOsPrintf ("Event command not implemented\n");
856 AcpiDbExecute (AcpiGbl_DbArgs[1],
857 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
862 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
867 AcpiGbl_CmSingleStep = FALSE;
872 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
877 AcpiDbDisplayGpes ();
882 AcpiDbDisplayHandlers ();
888 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
893 AcpiDbDisplayHistory ();
896 case CMD_HISTORY_EXE: /* ! command */
898 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
901 return (AE_CTRL_TRUE);
904 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
907 case CMD_HISTORY_LAST: /* !! command */
909 CommandLine = AcpiDbGetFromHistory (NULL);
912 return (AE_CTRL_TRUE);
915 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
918 case CMD_INFORMATION:
920 AcpiDbDisplayMethodInfo (Op);
925 AcpiDbCheckIntegrity ();
932 AcpiGbl_CmSingleStep = TRUE;
941 AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
942 AcpiGbl_DbDebugLevel);
943 AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
944 AcpiGbl_DbConsoleDebugLevel);
946 else if (ParamCount == 2)
948 Temp = AcpiGbl_DbConsoleDebugLevel;
949 AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
952 "Debug Level for console output was %8.8lX, now %8.8lX\n",
953 Temp, AcpiGbl_DbConsoleDebugLevel);
957 Temp = AcpiGbl_DbDebugLevel;
958 AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
960 "Debug Level for file output was %8.8lX, now %8.8lX\n",
961 Temp, AcpiGbl_DbDebugLevel);
967 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
972 Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE);
977 AcpiDbDisplayLocks ();
982 AcpiDbDisplayLocals ();
987 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
992 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
997 Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
998 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
1003 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
1004 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1009 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
1014 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1019 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1024 AcpiDbDumpNamespacePaths ();
1027 case CMD_PREDEFINED:
1029 AcpiDbCheckPredefinedNames ();
1034 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
1037 case CMD_REFERENCES:
1039 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
1044 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
1049 AcpiDbDisplayResults ();
1054 AcpiDbGenerateSci ();
1059 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1065 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
1070 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
1075 return (AE_NOT_IMPLEMENTED);
1079 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
1084 AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
1089 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1090 AcpiUtSubsystemShutdown ();
1093 * TBD: [Restructure] Need some way to re-initialize without
1094 * re-creating the semaphores!
1097 /* AcpiInitialize (NULL); */
1102 AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
1107 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1113 (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
1118 AcpiDbDisplayCallingTree ();
1123 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
1128 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
1136 AcpiOsPrintf ("Method execution terminated\n");
1137 return (AE_CTRL_TERMINATE);
1140 if (!AcpiGbl_DbOutputToFile)
1142 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
1145 AcpiDbCloseDebugFile ();
1146 AcpiGbl_DbTerminateThreads = TRUE;
1147 return (AE_CTRL_TERMINATE);
1152 AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
1153 return (AE_CTRL_TRUE);
1156 if (ACPI_SUCCESS (Status))
1158 Status = AE_CTRL_TRUE;
1165 /*******************************************************************************
1167 * FUNCTION: AcpiDbExecuteThread
1169 * PARAMETERS: Context - Not used
1173 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1174 * simply dispatches it.
1176 ******************************************************************************/
1178 void ACPI_SYSTEM_XFACE
1179 AcpiDbExecuteThread (
1182 ACPI_STATUS Status = AE_OK;
1183 ACPI_STATUS MStatus;
1186 while (Status != AE_CTRL_TERMINATE)
1188 AcpiGbl_MethodExecuting = FALSE;
1189 AcpiGbl_StepToNextCall = FALSE;
1191 MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
1192 if (ACPI_FAILURE (MStatus))
1197 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1199 MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1200 if (ACPI_FAILURE (MStatus))
1208 /*******************************************************************************
1210 * FUNCTION: AcpiDbSingleThread
1216 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1217 * simply dispatches it.
1219 ******************************************************************************/
1222 AcpiDbSingleThread (
1226 AcpiGbl_MethodExecuting = FALSE;
1227 AcpiGbl_StepToNextCall = FALSE;
1229 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1233 /*******************************************************************************
1235 * FUNCTION: AcpiDbUserCommands
1237 * PARAMETERS: Prompt - User prompt (depends on mode)
1238 * Op - Current executing parse op
1242 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1243 * matched and dispatched here.
1245 ******************************************************************************/
1248 AcpiDbUserCommands (
1250 ACPI_PARSE_OBJECT *Op)
1252 ACPI_STATUS Status = AE_OK;
1255 AcpiOsPrintf ("\n");
1257 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1259 while (!AcpiGbl_DbTerminateThreads)
1261 /* Force output to console until a command is entered */
1263 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1265 /* Different prompt if method is executing */
1267 if (!AcpiGbl_MethodExecuting)
1269 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1273 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1276 /* Get the user input line */
1278 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1279 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1280 if (ACPI_FAILURE (Status))
1282 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1286 /* Check for single or multithreaded debug */
1288 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1291 * Signal the debug thread that we have a command to execute,
1292 * and wait for the command to complete.
1294 Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
1295 if (ACPI_FAILURE (Status))
1300 Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1301 if (ACPI_FAILURE (Status))
1308 /* Just call to the command line interpreter */
1310 AcpiDbSingleThread ();
1315 * Only this thread (the original thread) should actually terminate the
1316 * subsystem, because all the semaphores are deleted during termination
1318 Status = AcpiTerminate ();
1322 #endif /* ACPI_DEBUGGER */