/* * Assembly Language Debugger * * Copyright (C) 2000-2004 Patrick Alken * This program comes with absolutely NO WARRANTY * * Should you choose to use and/or modify this source code, please * do so under the terms of the GNU General Public License under which * this program is distributed. * * $Id: help.c,v 1.3 2004/10/10 05:29:50 pa33 Exp $ */ #include #include #include #include "alddefs.h" #include "command.h" #include "help.h" #include "print.h" /* * libString includes */ #include "Strn.h" static struct HelpCmd *GetHelpCommand(char *name, unsigned int *flags); static void PrintHelpCommand(struct aldWorkspace *ws, struct HelpCmd *hptr); static void PrintHelpCommands(struct aldWorkspace *ws, struct HelpCmd *array); static struct HelpCmd GeneralHelp[] = { { "attach", "Attach to a running process", "\n\ \n\ - process id to attach to", }, { "continue", "Continue execution of debugged process", "\n\ \n\ Alias: c", }, { "detach", "Detach from current process", "\n\ \n\ Detaches the debugger from the current process (see help attach)", }, { "disassemble", "Disassembles machine code into assembly language instructions", "[start [stop]] [-num ] [flags]\n\ \n\ [start [stop]] - Starting and stopping memory locations - All opcodes\n\ inside this range will be disassembled. For this to\n\ work, you must be working with an executable file.\n\ [-num ] - Number of instructions to disassemble (default: all)\n\ [flags] - Various flags\n\ \n\ Flags:\n\ -section - disassemble specific section - you can\n\ use the \"file secinfo\" command to get a list\n\ of available sections.\n\ \n\ The output of this command is as follows:\n\ \n\ \n\ - Virtual offset from beginning of file, or memory address\n\ - Machine language instruction\n\ - Assembly language instruction\n\ \n\ Disassembly begins at the address specified by \"set file-offset\",\n\ unless a start/stop memory address is given.\n\ \n\ Alias: d", }, { "display", "Display memory after single steps", "[start]|[register]|[section]|[symbol] [stop] [-num ] [-size ] [-output ]\n\ \n\ [start] - Memory address to start from\n\ [register] - Memory dump begins at register contents\n\ [section] - Memory dump begins at section start\n\ [symbol] - Memory dump begins at symbol start\n\ [stop] - Memory address to stop dump\n\ [-num ] - Number of elements to dump (default: 20)\n\ [-size ] - Size of each element in bytes (default: 1)\n\ [-output ] - Output format for each element (default: x)\n\ 'x' = hexadecimal\n\ 'o' = octal\n\ 'd' = decimal\n\ \n\ Example:\n\ display -n 50 -s 1 -o x 0xABCD\n\ After each single step, 50 bytes of memory starting at location\n\ 0xABCD will be printed.\n\ \n\ See also: ldisplay, undisplay" }, { "enter", "Change the contents of the program's memory", "
[value]\n\ \n\
- Memory address to change\n\ [value] - New value\n\ \n\ If no value is given, you will be prompted for values for\n\ successive memory addresses until a blank value is input.\n\ \n\ Alias: store", }, { "examine", "Examine the contents of the program's memory", "[start]|[register]|[section]|[symbol] [stop] [-num ] [-size ] [-output ]\n\ \n\ [start] - Memory address to start from\n\ [register] - Memory dump begins at register contents\n\ [section] - Memory dump begins at section start\n\ [symbol] - Memory dump begins at symbol start\n\ [stop] - Memory address to stop dump\n\ [-num ] - Number of elements to dump (default: 20)\n\ [-size ] - Size of each element in bytes (default: 1)\n\ [-output ] - Output format for each element (default: x)\n\ 'x' = hexadecimal\n\ 'o' = octal\n\ 'd' = decimal\n\ \n\ Example:\n\ examine -n 50 -s 1 -o x 0xABCD\n\ Dumps 50 elements each of size 1 byte in hexadecimal format,\n\ starting at location 0xABCD.\n\ \n\ If no starting address is given, the address specified in\n\ \"set entry-point\" is used. A register name, section name,\n\ or symbol name may be given in place of a starting address.\n\ \n\ Aliases: e, dump", }, { "file", "Outputs specified information on current file", "
\n\ \n\ header - Output information about the file's object header\n\ secinfo [name] - Output information about the file's sections. If\n\ [name] is given, output information about that\n\ specific section.\n\ syminfo [sym] - Output information about the file's symbols, if any.\n\ If [sym] is given, output information about that\n\ specific symbol.", }, { "help", "Displays commands, or gives specific help on commands", "[optional commands]", }, { "ldisplay", "Print list of memory addresses to be displayed after single stepping", "\n\ \n\ See also: display, undisplay" }, { "load", "Loads a new file into memory for debugging", "\n\ \n\ Previous file, if any, is unloaded first", }, { "next", "Step one instruction, stepping over any subroutines", "[num]\n\ \n\ [num] - number of instructions to step over (default: 1)\n\ \n\ Alias: n", }, { "quit", "Exit the debugger", "", }, { "register", "Display and/or manipulate the process' registers", "[-all] [name [value]]\n\ \n\ [-all] - display all registers\n\ [name] - name of a specific register\n\ [[value]] - if a name is given, it is set to this value\n\ \n\ With no arguments, the most common registers are displayed\n\ along with their values.", }, { "run", "Start program from beginning", "[arguments]\n\ \n\ [arguments] - runtime arguments to pass to program - if not supplied,\n\ the arguments given with \"set args\" are used.\n\ \n\ Alias: r", }, { "set", "Configure various settings", "[option] [value]\n\ \n\ Options:\n\ \n\ args\n\ disasm-show-syms\n\ entry-point\n\ file-offset\n\ output\n\ pause-print\n\ prompt\n\ step-display-regs\n\ step-display-fpregs\n\ step-display-mmxregs\n\ \n\ Type \"help set