/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#include "acdebug.h"
#ifdef ACPI_APPLICATION
#include "acapps.h"
#endif
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbinput")
/* Local prototypes */
static u32 acpi_db_get_line(char *input_buffer);
static u32 acpi_db_match_command(char *user_command);
static void acpi_db_display_command_info(char *command, u8 display_all);
static void acpi_db_display_help(char *command);
static u8
acpi_db_match_command_help(char *command,
const struct acpi_db_command_help *help);
/*
* Top-level debugger commands.
*
* This list of commands must match the string table below it
*/
enum acpi_ex_debugger_commands {
CMD_NOT_FOUND = 0,
CMD_NULL,
CMD_ALLOCATIONS,
CMD_ARGS,
CMD_ARGUMENTS,
CMD_BREAKPOINT,
CMD_BUSINFO,
CMD_CALL,
CMD_DEBUG,
CMD_DISASSEMBLE,
CMD_DISASM,
CMD_DUMP,
CMD_EVALUATE,
CMD_EXECUTE,
CMD_EXIT,
CMD_FIND,
CMD_GO,
CMD_HANDLERS,
CMD_HELP,
CMD_HELP2,
CMD_HISTORY,
CMD_HISTORY_EXE,
CMD_HISTORY_LAST,
CMD_INFORMATION,
CMD_INTEGRITY,
CMD_INTO,
CMD_LEVEL,
CMD_LIST,
CMD_LOCALS,
CMD_LOCKS,
CMD_METHODS,
CMD_NAMESPACE,
CMD_NOTIFY,
CMD_OBJECTS,
CMD_OSI,
CMD_OWNER,
CMD_PATHS,
CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
CMD_SET,
CMD_STATS,
CMD_STOP,
CMD_TABLES,
CMD_TEMPLATE,
CMD_TRACE,
CMD_TREE,
CMD_TYPE,
#ifdef ACPI_APPLICATION
CMD_ENABLEACPI,
CMD_EVENT,
CMD_GPE,
CMD_GPES,
CMD_SCI,
CMD_SLEEP,
CMD_CLOSE,
CMD_LOAD,
CMD_OPEN,
CMD_UNLOAD,
CMD_TERMINATE,
CMD_THREADS,
CMD_TEST,
#endif
};
#define CMD_FIRST_VALID 2
/* Second parameter is the required argument count */
static const struct acpi_db_command_info acpi_gbl_db_commands[] = {
{"<NOT FOUND>", 0},
{"<NULL>", 0},
{"ALLOCATIONS", 0},
{"ARGS", 0},
{"ARGUMENTS", 0},
{"BREAKPOINT", 1},
{"BUSINFO", 0},
{"CALL", 0},
{"DEBUG", 1},
{"DISASSEMBLE", 1},
{"DISASM", 1},
{"DUMP", 1},
{"EVALUATE", 1},
{"EXECUTE", 1},
{"EXIT", 0},