/******************************************************************************\ ** ** This file is part of the Hades GBA Emulator, and is made available under ** the terms of the GNU General Public License version 2. ** ** Copyright (C) 2021-2026 - The Hades Authors ** \******************************************************************************/ #include #include #include #include #include "hades.h" #include "app/app.h" #include "app/lang.h" #include "app/dbg.h" #include "gba/gba.h" struct command g_commands[] = { [CMD_HELP] = { .name = "help", .aliases = (char const *[]){ "h", NULL }, .usage = "help [COMMAND]", .description = "Show a list of all commands, or show the usage of \"COMMAND\".", .func = debugger_cmd_help, }, [CMD_EXIT] = { .name = "exit", .usage = "exit", .description = "Exit Hades.", .func = debugger_cmd_exit, }, [CMD_CONTINUE] = { .name = "continue", .aliases = (char const *[]){ "c", NULL }, .usage = "continue", .description = "Continue the execution until a breakpoint is reached.", .func = debugger_cmd_continue, }, [CMD_STEP_IN] = { .name = "stepin", .aliases = (char const *[]){ "s", NULL }, .usage = "stepin [N=1]", .description = "Execute the next N instructions, following branching instructions.", .func = debugger_cmd_step_in, }, [CMD_STEP_OVER] = { .name = "stepover", .aliases = (char const *[]){ "so", NULL }, .usage = "stepover [N=1]", .description = "Execute the next N instructions, stepping over branching instructions.", .func = debugger_cmd_step_over, }, [CMD_REGISTERS] = { .name = "registers", .aliases = (char const *[]){ "r", NULL }, .usage = "registers", .description = "List the content of all registers.", .func = debugger_cmd_registers, }, [CMD_DISAS] = { .name = "disas", .usage = "disas [MODE] [ADDR=pc]", .description = "Disassemble the instructions around \"ADDR\".", .func = debugger_cmd_disas, }, [CMD_CONTEXT] = { .name = "context", .aliases = (char const *[]){ "d", NULL }, .usage = "context", .description = "Show the most important information of the current context (registers, stack, instructions, etc.).", .func = debugger_cmd_context, }, [CMD_CONTEXT_COMPACT] = { .name = "compact", .aliases = (char const *[]){ "dc", NULL }, .usage = "compact", .description = "Show the most important information of the current context (registers, current instruction, etc.) in a compact form.", .func = debugger_cmd_context_compact, }, [CMD_PRINT] = { .name = "print", .aliases = (char const *[]){ "p", NULL }, .usage = "print [QUANTITY] ", .description = "Print QUANTITY (Default: 1) memory located at EXPR of type TYPE (string, char, word, dword, etc.).", .func = debugger_cmd_print, }, [CMD_BREAK_HW] = { .name = "breakhw", .aliases = (char const *[]){ "break", "bhw", "bh", "b", NULL }, .usage = "breakhw | breakhw | breakhw delete ", .description = "Add or remove a hardware breakpoint.", .func = debugger_cmd_break_hw, }, [CMD_BREAK_SW] = { .name = "breaksw", .aliases = (char const *[]){ "bsw", "bs", NULL }, .usage = "breaksw | breaksw | breaksw delete ", .description = "Add or remove a software breakpoint.", .func = debugger_cmd_break_sw, }, [CMD_WATCH] = { .name = "watch", .aliases = (char const *[]){ "w", NULL }, .usage = "watch | watch | watch delete ", .description = "Add or remove a watchpoint.", .func = debugger_cmd_watch, }, [CMD_TRACE] = { .name = "trace", .aliases = (char const *[]){ "t", NULL }, .usage = "trace [N=1]", .description = "Execute the next N instructions, dumping the content of all registers in between them.", .func = debugger_cmd_trace, }, [CMD_VERBOSE] = { .name = "verbose", .aliases = (char const *[]){ "v", NULL }, .usage = "verbose [NAME|all]", .description = "Inverse the verbosity of module NAME.", .func = debugger_cmd_verbose, }, [CMD_RESET] = { .name = "reset", .usage = "reset", .description = "Reset the emulation", .func = debugger_cmd_reset, }, [CMD_FRAME] = { .name = "frame", .aliases = (char const *[]){ "f", NULL }, .usage = "frame [N=1]", .description = "Run until N frames are completed.", .func = debugger_cmd_frame, }, [CMD_IO] = { .name = "io", .usage = "io [REGISTER] [VALUE]", .description = "Print or set the value of an IO register.", .func = debugger_cmd_io, }, [CMD_KEY] = { .name = "key", .usage = "key KEY STATE", .description = "Set the state of any input key, including the GameShark/Action Replay button (\"gs\", \"ar\").", .func = debugger_cmd_key, }, [CMD_SCREENSHOT] = { .name = "screenshot", .aliases = (char const *[]){ "screen", NULL }, .usage = "screenshot [FILE]", .description = "Store a screenshot of the screen in FILE.", .func = debugger_cmd_screenshot }, [CMD_PPU] = { .name = "ppu", .usage = "ppu