summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/debugger/dbhistry.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/debugger/dbhistry.c')
-rw-r--r--sys/contrib/dev/acpica/components/debugger/dbhistry.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/sys/contrib/dev/acpica/components/debugger/dbhistry.c b/sys/contrib/dev/acpica/components/debugger/dbhistry.c
index 0e05e14..4a97ba4 100644
--- a/sys/contrib/dev/acpica/components/debugger/dbhistry.c
+++ b/sys/contrib/dev/acpica/components/debugger/dbhistry.c
@@ -54,12 +54,12 @@
#define HI_NO_HISTORY 0
#define HI_RECORD_HISTORY 1
-#define HISTORY_SIZE 20
+#define HISTORY_SIZE 40
typedef struct HistoryInfo
{
- char Command[80];
+ char *Command;
UINT32 CmdNum;
} HISTORY_INFO;
@@ -88,13 +88,35 @@ void
AcpiDbAddToHistory (
char *CommandLine)
{
+ UINT16 CmdLen;
+ UINT16 BufferLen;
/* Put command into the next available slot */
+ CmdLen = (UINT16) ACPI_STRLEN (CommandLine);
+ if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
+ {
+ BufferLen = (UINT16) ACPI_STRLEN (
+ AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command);
+ if (CmdLen > BufferLen)
+ {
+ AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].
+ Command);
+ AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
+ AcpiOsAllocate (CmdLen + 1);
+ }
+ }
+ else
+ {
+ AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =
+ AcpiOsAllocate (CmdLen + 1);
+ }
+
ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,
CommandLine);
- AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum;
+ AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum =
+ AcpiGbl_NextCmdNum;
/* Adjust indexes */
@@ -148,8 +170,12 @@ AcpiDbDisplayHistory (
for (i = 0; i < AcpiGbl_NumHistory; i++)
{
- AcpiOsPrintf ("%ld %s\n", AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum,
- AcpiGbl_HistoryBuffer[HistoryIndex].Command);
+ if (AcpiGbl_HistoryBuffer[HistoryIndex].Command)
+ {
+ AcpiOsPrintf ("%3ld %s\n",
+ AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum,
+ AcpiGbl_HistoryBuffer[HistoryIndex].Command);
+ }
HistoryIndex++;
if (HistoryIndex >= HISTORY_SIZE)
@@ -199,7 +225,7 @@ AcpiDbGetFromHistory (
{
if (AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum == CmdNum)
{
- /* Found the commnad, return it */
+ /* Found the command, return it */
return (AcpiGbl_HistoryBuffer[HistoryIndex].Command);
}
OpenPOWER on IntegriCloud