*/
#include <common.h>
+#include <cli.h>
#include <command.h>
#include <linux/ctype.h>
#include <net.h>
extern void show_regs __P ((struct pt_regs *));
extern int run_command __P ((const char *, int));
-extern char console_buffer[];
ulong dis_last_addr = 0; /* Last address disassembled */
ulong dis_last_len = 20; /* Default disassembler length */
CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
-\f
+
/* ======================================================================
* U-Boot's puts function does not append a newline, so the bedbug stuff
printf ("%s\r\n", str);
return 0;
} /* bedbug_puts */
-\f
+
/* ======================================================================
return;
} /* bedbug_init */
-\f
+
/* ======================================================================
* Entry point from the interpreter to the disassembler. Repeated calls
* will resume from the last disassembled address.
* ====================================================================== */
-int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
ulong addr; /* Address to start disassembly from */
ulong len; /* # of instructions to disassemble */
addr = dis_last_addr;
len = dis_last_len;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return CMD_RET_USAGE;
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
"disassemble memory",
- "ds <address> [# instructions]\n");
-\f
+ "ds <address> [# instructions]");
+
/* ======================================================================
* Entry point from the interpreter to the assembler. Assembles
* instructions in consecutive memory locations until a '.' (period) is
* entered on a line by itself.
* ====================================================================== */
-int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
long mem_addr; /* Address to assemble into */
unsigned long instr; /* Machine code for text */
/* -------------------------------------------------- */
int rcode = 0;
- if (argc < 2) {
- cmd_usage(cmdtp);
- return 1;
- }
+ if (argc < 2)
+ return CMD_RET_USAGE;
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
F_RADHEX);
sprintf (prompt, "%08lx: ", mem_addr);
- readline (prompt);
+ cli_readline(prompt);
if (console_buffer[0] && strcmp (console_buffer, ".")) {
if ((instr =
} /* do_bedbug_asm */
U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
- "assemble memory", "as <address>\n");
-\f
+ "assemble memory", "as <address>");
+
/* ======================================================================
* Used to set a break point from the interpreter. Simply calls into the
* CPU-specific break point set routine.
* ====================================================================== */
-int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
/* -------------------------------------------------- */
if (bug_ctx.do_break)
" - Set or clear a breakpoint\n"
"break <address> - Break at an address\n"
"break off <bp#> - Disable breakpoint.\n"
- "break show - List breakpoints.\n");
-\f
+ "break show - List breakpoints.");
+
/* ======================================================================
* Called from the debug interrupt routine. Simply calls the CPU-specific
* breakpoint handling routine.
return;
} /* do_bedbug_breakpoint */
-\f
+
/* ======================================================================
/* A miniature main loop */
while (bug_ctx.stopped) {
- len = readline (prompt_str);
+ len = cli_readline(prompt_str);
flag = 0; /* assume no special flags for now */
if (len == -1)
printf ("<INTERRUPT>\n");
else
- rc = run_command (lastcommand, flag);
+ rc = run_command_repeatable(lastcommand, flag);
if (rc <= 0) {
/* invalid command or not repeatable, forget it */
return;
} /* bedbug_main_loop */
-\f
+
/* ======================================================================
* stopped flag in the context so that the breakpoint routine will
* return.
* ====================================================================== */
-int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
/* -------------------------------------------------- */
U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
"continue from a breakpoint",
- " - continue from a breakpoint.\n");
-\f
+ "");
+
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping into
* subroutines. Works by calling the find_next_addr() routine to compute
* the address passes control to the CPU-specific set breakpoint routine
* for the current breakpoint number.
* ====================================================================== */
-int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr; /* Address to stop at */
return 1;
}
- if (!find_next_address ((unsigned char *) &addr, FALSE, bug_ctx.regs))
+ if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
return 1;
if (bug_ctx.set)
U_BOOT_CMD (step, 1, 1, do_bedbug_step,
"single step execution.",
- " - single step execution.\n");
-\f
+ "");
+
/* ======================================================================
* Interpreter command to continue to the next instruction, stepping over
* subroutines. Works by calling the find_next_addr() routine to compute
* the address passes control to the CPU-specific set breakpoint routine
* for the current breakpoint number.
* ====================================================================== */
-int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr; /* Address to stop at */
return 1;
}
- if (!find_next_address ((unsigned char *) &addr, TRUE, bug_ctx.regs))
+ if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
return 1;
if (bug_ctx.set)
U_BOOT_CMD (next, 1, 1, do_bedbug_next,
"single step execution, stepping over subroutines.",
- " - single step execution, stepping over subroutines.\n");
-\f
+ "");
+
/* ======================================================================
* Interpreter command to print the current stack. This assumes an EABI
* architecture, so it starts with GPR R1 and works back up the stack.
* ====================================================================== */
-int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
unsigned long sp; /* Stack pointer */
unsigned long func; /* LR from stack */
U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
"Print the running stack.",
- " - Print the running stack.\n");
-\f
+ "");
+
/* ======================================================================
* Interpreter command to dump the registers. Calls the CPU-specific
* show registers routine.
* ====================================================================== */
-int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
/* -------------------------------------------------- */
} /* do_bedbug_rdump */
U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
- "Show registers.", " - Show registers.\n");
+ "Show registers.", "");
/* ====================================================================== */