diff options
Diffstat (limited to 'source/components/debugger/dbhistry.c')
-rw-r--r-- | source/components/debugger/dbhistry.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index ff11604..2daa01f 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -69,7 +69,7 @@ static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; static UINT16 AcpiGbl_LoHistory = 0; static UINT16 AcpiGbl_NumHistory = 0; static UINT16 AcpiGbl_NextHistoryIndex = 0; -static UINT32 AcpiGbl_NextCmdNum = 1; +UINT32 AcpiGbl_NextCmdNum = 1; /******************************************************************************* @@ -94,6 +94,11 @@ AcpiDbAddToHistory ( /* Put command into the next available slot */ CmdLen = (UINT16) ACPI_STRLEN (CommandLine); + if (!CmdLen) + { + return; + } + if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL) { BufferLen = (UINT16) ACPI_STRLEN ( @@ -203,8 +208,6 @@ char * AcpiDbGetFromHistory ( char *CommandNumArg) { - UINT32 i; - UINT16 HistoryIndex; UINT32 CmdNum; @@ -218,6 +221,31 @@ AcpiDbGetFromHistory ( CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0); } + return (AcpiDbGetHistoryByIndex (CmdNum)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbGetHistoryByIndex + * + * PARAMETERS: CmdNum - Index of the desired history entry. + * Values are 0...(AcpiGbl_NextCmdNum - 1) + * + * RETURN: Pointer to the retrieved command. Null on error. + * + * DESCRIPTION: Get a command from the history buffer + * + ******************************************************************************/ + +char * +AcpiDbGetHistoryByIndex ( + UINT32 CmdNum) +{ + UINT32 i; + UINT16 HistoryIndex; + + /* Search history buffer */ HistoryIndex = AcpiGbl_LoHistory; @@ -230,6 +258,7 @@ AcpiDbGetFromHistory ( return (AcpiGbl_HistoryBuffer[HistoryIndex].Command); } + /* History buffer is circular */ HistoryIndex++; if (HistoryIndex >= HISTORY_SIZE) |