blob: 0bd67fcf47c5410ffc7bcc7d790f17844b56e41a [file] [log] [blame]
wdenk47d1a6e2002-11-03 00:01:44 +00001/*
2 * BedBug Functions
3 */
4
5#include <common.h>
Simon Glass18d66532014-04-10 20:01:25 -06006#include <cli.h>
wdenk47d1a6e2002-11-03 00:01:44 +00007#include <command.h>
Simon Glass24b852a2015-11-08 23:47:45 -07008#include <console.h>
Simon Glass401d1c42020-10-30 21:38:53 -06009#include <asm/global_data.h>
Simon Glass25a58182020-05-10 11:40:06 -060010#include <asm/ptrace.h>
wdenk47d1a6e2002-11-03 00:01:44 +000011#include <linux/ctype.h>
12#include <net.h>
wdenk8bde7f72003-06-27 21:31:46 +000013#include <bedbug/type.h>
wdenk47d1a6e2002-11-03 00:01:44 +000014#include <bedbug/bedbug.h>
15#include <bedbug/regs.h>
16#include <bedbug/ppc.h>
wdenk47d1a6e2002-11-03 00:01:44 +000017
Wolfgang Denkd87080b2006-03-31 18:32:53 +020018DECLARE_GLOBAL_DATA_PTR;
19
Wolfgang Denkd87080b2006-03-31 18:32:53 +020020extern void show_regs __P ((struct pt_regs *));
21extern int run_command __P ((const char *, int));
wdenk47d1a6e2002-11-03 00:01:44 +000022
Wolfgang Denkd87080b2006-03-31 18:32:53 +020023ulong dis_last_addr = 0; /* Last address disassembled */
24ulong dis_last_len = 20; /* Default disassembler length */
25CPU_DEBUG_CTX bug_ctx; /* Bedbug context structure */
Simon Glasse1bf8242014-04-10 20:01:27 -060026
Wolfgang Denkd87080b2006-03-31 18:32:53 +020027
wdenk47d1a6e2002-11-03 00:01:44 +000028/* ======================================================================
29 * U-Boot's puts function does not append a newline, so the bedbug stuff
30 * will use this for the output of the dis/assembler.
31 * ====================================================================== */
32
Wolfgang Denkd87080b2006-03-31 18:32:53 +020033int bedbug_puts (const char *str)
wdenk47d1a6e2002-11-03 00:01:44 +000034{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020035 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000036
Wolfgang Denkd87080b2006-03-31 18:32:53 +020037 printf ("%s\r\n", str);
38 return 0;
39} /* bedbug_puts */
Simon Glasse1bf8242014-04-10 20:01:27 -060040
Wolfgang Denkd87080b2006-03-31 18:32:53 +020041
wdenk47d1a6e2002-11-03 00:01:44 +000042/* ======================================================================
43 * Initialize the bug_ctx structure used by the bedbug debugger. This is
44 * specific to the CPU since each has different debug registers and
45 * settings.
46 * ====================================================================== */
47
Ovidiu Panait5fb292f2020-04-20 10:31:45 +030048int bedbug_init(void)
wdenk47d1a6e2002-11-03 00:01:44 +000049{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020050 /* -------------------------------------------------- */
Ovidiu Panait5fb292f2020-04-20 10:31:45 +030051 return 0;
Wolfgang Denkd87080b2006-03-31 18:32:53 +020052} /* bedbug_init */
Simon Glasse1bf8242014-04-10 20:01:27 -060053
Wolfgang Denkd87080b2006-03-31 18:32:53 +020054
wdenk47d1a6e2002-11-03 00:01:44 +000055/* ======================================================================
56 * Entry point from the interpreter to the disassembler. Repeated calls
57 * will resume from the last disassembled address.
58 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -060059int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,
60 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +000061{
Wolfgang Denkd87080b2006-03-31 18:32:53 +020062 ulong addr; /* Address to start disassembly from */
63 ulong len; /* # of instructions to disassemble */
wdenk47d1a6e2002-11-03 00:01:44 +000064
Wolfgang Denkd87080b2006-03-31 18:32:53 +020065 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000066
Wolfgang Denkd87080b2006-03-31 18:32:53 +020067 /* Setup to go from the last address if none is given */
68 addr = dis_last_addr;
69 len = dis_last_len;
wdenk47d1a6e2002-11-03 00:01:44 +000070
Wolfgang Denk47e26b12010-07-17 01:06:04 +020071 if (argc < 2)
Simon Glass4c12eeb2011-12-10 08:44:01 +000072 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +000073
Wolfgang Denkd87080b2006-03-31 18:32:53 +020074 if ((flag & CMD_FLAG_REPEAT) == 0) {
75 /* New command */
Simon Glass7e5f4602021-07-24 09:03:29 -060076 addr = hextoul(argv[1], NULL);
wdenk47d1a6e2002-11-03 00:01:44 +000077
Wolfgang Denkd87080b2006-03-31 18:32:53 +020078 /* If an extra param is given then it is the length */
79 if (argc > 2)
Simon Glass7e5f4602021-07-24 09:03:29 -060080 len = hextoul(argv[2], NULL);
Wolfgang Denkd87080b2006-03-31 18:32:53 +020081 }
wdenk47d1a6e2002-11-03 00:01:44 +000082
Wolfgang Denkd87080b2006-03-31 18:32:53 +020083 /* Run the disassembler */
84 disppc ((unsigned char *) addr, 0, len, bedbug_puts, F_RADHEX);
85
86 dis_last_addr = addr + (len * 4);
87 dis_last_len = len;
88 return 0;
89} /* do_bedbug_dis */
90
91U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
Peter Tyser2fb26042009-01-27 18:03:12 -060092 "disassemble memory",
Wolfgang Denka89c33d2009-05-24 17:06:54 +020093 "ds <address> [# instructions]");
Simon Glasse1bf8242014-04-10 20:01:27 -060094
wdenk47d1a6e2002-11-03 00:01:44 +000095/* ======================================================================
96 * Entry point from the interpreter to the assembler. Assembles
97 * instructions in consecutive memory locations until a '.' (period) is
98 * entered on a line by itself.
99 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600100int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,
101 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000102{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200103 long mem_addr; /* Address to assemble into */
104 unsigned long instr; /* Machine code for text */
105 char prompt[15]; /* Prompt string for user input */
106 int asm_err; /* Error code from the assembler */
wdenk47d1a6e2002-11-03 00:01:44 +0000107
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200108 /* -------------------------------------------------- */
109 int rcode = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000110
Wolfgang Denk47e26b12010-07-17 01:06:04 +0200111 if (argc < 2)
Simon Glass4c12eeb2011-12-10 08:44:01 +0000112 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +0000113
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200114 printf ("\nEnter '.' when done\n");
Simon Glass7e5f4602021-07-24 09:03:29 -0600115 mem_addr = hextoul(argv[1], NULL);
wdenk47d1a6e2002-11-03 00:01:44 +0000116
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200117 while (1) {
118 putc ('\n');
119 disppc ((unsigned char *) mem_addr, 0, 1, bedbug_puts,
120 F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000121
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200122 sprintf (prompt, "%08lx: ", mem_addr);
Simon Glasse1bf8242014-04-10 20:01:27 -0600123 cli_readline(prompt);
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200124
125 if (console_buffer[0] && strcmp (console_buffer, ".")) {
126 if ((instr =
127 asmppc (mem_addr, console_buffer,
128 &asm_err)) != 0) {
129 *(unsigned long *) mem_addr = instr;
130 mem_addr += 4;
131 } else {
132 printf ("*** Error: %s ***\n",
133 asm_error_str (asm_err));
134 rcode = 1;
135 }
136 } else {
137 break;
138 }
139 }
140 return rcode;
141} /* do_bedbug_asm */
142
143U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200144 "assemble memory", "as <address>");
Simon Glasse1bf8242014-04-10 20:01:27 -0600145
wdenk47d1a6e2002-11-03 00:01:44 +0000146/* ======================================================================
147 * Used to set a break point from the interpreter. Simply calls into the
148 * CPU-specific break point set routine.
149 * ====================================================================== */
150
Simon Glass09140112020-05-10 11:40:03 -0600151int do_bedbug_break(struct cmd_tbl *cmdtp, int flag, int argc,
152 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000153{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200154 /* -------------------------------------------------- */
155 if (bug_ctx.do_break)
156 (*bug_ctx.do_break) (cmdtp, flag, argc, argv);
157 return 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000158
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200159} /* do_bedbug_break */
160
161U_BOOT_CMD (break, 3, 0, do_bedbug_break,
Peter Tyser2fb26042009-01-27 18:03:12 -0600162 "set or clear a breakpoint",
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200163 " - Set or clear a breakpoint\n"
164 "break <address> - Break at an address\n"
165 "break off <bp#> - Disable breakpoint.\n"
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200166 "break show - List breakpoints.");
Simon Glasse1bf8242014-04-10 20:01:27 -0600167
wdenk47d1a6e2002-11-03 00:01:44 +0000168/* ======================================================================
169 * Called from the debug interrupt routine. Simply calls the CPU-specific
170 * breakpoint handling routine.
171 * ====================================================================== */
172
173void do_bedbug_breakpoint (struct pt_regs *regs)
174{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200175 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000176
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200177 if (bug_ctx.break_isr)
178 (*bug_ctx.break_isr) (regs);
wdenk47d1a6e2002-11-03 00:01:44 +0000179
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200180 return;
181} /* do_bedbug_breakpoint */
Simon Glasse1bf8242014-04-10 20:01:27 -0600182
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200183
wdenk47d1a6e2002-11-03 00:01:44 +0000184/* ======================================================================
185 * Called from the CPU-specific breakpoint handling routine. Enter a
186 * mini main loop until the stopped flag is cleared from the breakpoint
187 * context.
188 *
189 * This handles the parts of the debugger that are common to all CPU's.
190 * ====================================================================== */
191
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200192void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
wdenk47d1a6e2002-11-03 00:01:44 +0000193{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200194 int len; /* Length of command line */
195 int flag; /* Command flags */
196 int rc = 0; /* Result from run_command */
197 char prompt_str[20]; /* Prompt string */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200198 static char lastcommand[CONFIG_SYS_CBSIZE] = { 0 }; /* previous command */
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200199 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000200
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200201 if (bug_ctx.clear)
202 (*bug_ctx.clear) (bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000203
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200204 printf ("Breakpoint %d: ", bug_ctx.current_bp);
205 disppc ((unsigned char *) addr, 0, 1, bedbug_puts, F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000206
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200207 bug_ctx.stopped = 1;
208 bug_ctx.regs = regs;
wdenk47d1a6e2002-11-03 00:01:44 +0000209
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200210 sprintf (prompt_str, "BEDBUG.%d =>", bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000211
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200212 /* A miniature main loop */
213 while (bug_ctx.stopped) {
Simon Glasse1bf8242014-04-10 20:01:27 -0600214 len = cli_readline(prompt_str);
wdenk47d1a6e2002-11-03 00:01:44 +0000215
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200216 flag = 0; /* assume no special flags for now */
wdenk47d1a6e2002-11-03 00:01:44 +0000217
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200218 if (len > 0)
219 strcpy (lastcommand, console_buffer);
220 else if (len == 0)
221 flag |= CMD_FLAG_REPEAT;
wdenk47d1a6e2002-11-03 00:01:44 +0000222
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200223 if (len == -1)
224 printf ("<INTERRUPT>\n");
225 else
Thomas Betker52715f82014-06-05 20:07:58 +0200226 rc = run_command_repeatable(lastcommand, flag);
wdenk47d1a6e2002-11-03 00:01:44 +0000227
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200228 if (rc <= 0) {
229 /* invalid command or not repeatable, forget it */
230 lastcommand[0] = 0;
231 }
232 }
wdenk47d1a6e2002-11-03 00:01:44 +0000233
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200234 bug_ctx.regs = NULL;
235 bug_ctx.current_bp = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000236
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200237 return;
238} /* bedbug_main_loop */
Simon Glasse1bf8242014-04-10 20:01:27 -0600239
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200240
wdenk47d1a6e2002-11-03 00:01:44 +0000241/* ======================================================================
242 * Interpreter command to continue from a breakpoint. Just clears the
243 * stopped flag in the context so that the breakpoint routine will
244 * return.
245 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600246int do_bedbug_continue(struct cmd_tbl *cmdtp, int flag, int argc,
247 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000248{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200249 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000250
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200251 if (!bug_ctx.stopped) {
252 printf ("Not at a breakpoint\n");
253 return 1;
254 }
wdenk47d1a6e2002-11-03 00:01:44 +0000255
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200256 bug_ctx.stopped = 0;
257 return 0;
258} /* do_bedbug_continue */
259
260U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
Peter Tyser2fb26042009-01-27 18:03:12 -0600261 "continue from a breakpoint",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200262 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600263
wdenk47d1a6e2002-11-03 00:01:44 +0000264/* ======================================================================
265 * Interpreter command to continue to the next instruction, stepping into
266 * subroutines. Works by calling the find_next_addr() routine to compute
267 * the address passes control to the CPU-specific set breakpoint routine
268 * for the current breakpoint number.
269 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600270int do_bedbug_step(struct cmd_tbl *cmdtp, int flag, int argc,
271 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000272{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200273 unsigned long addr; /* Address to stop at */
wdenk47d1a6e2002-11-03 00:01:44 +0000274
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200275 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000276
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200277 if (!bug_ctx.stopped) {
278 printf ("Not at a breakpoint\n");
279 return 1;
280 }
wdenk47d1a6e2002-11-03 00:01:44 +0000281
York Sun472d5462013-04-01 11:29:11 -0700282 if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200283 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000284
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200285 if (bug_ctx.set)
286 (*bug_ctx.set) (bug_ctx.current_bp, addr);
287
288 bug_ctx.stopped = 0;
289 return 0;
290} /* do_bedbug_step */
291
292U_BOOT_CMD (step, 1, 1, do_bedbug_step,
Peter Tyser2fb26042009-01-27 18:03:12 -0600293 "single step execution.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200294 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600295
wdenk47d1a6e2002-11-03 00:01:44 +0000296/* ======================================================================
297 * Interpreter command to continue to the next instruction, stepping over
298 * subroutines. Works by calling the find_next_addr() routine to compute
299 * the address passes control to the CPU-specific set breakpoint routine
300 * for the current breakpoint number.
301 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600302int do_bedbug_next(struct cmd_tbl *cmdtp, int flag, int argc,
303 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000304{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200305 unsigned long addr; /* Address to stop at */
wdenk47d1a6e2002-11-03 00:01:44 +0000306
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200307 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000308
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200309 if (!bug_ctx.stopped) {
310 printf ("Not at a breakpoint\n");
311 return 1;
312 }
wdenk47d1a6e2002-11-03 00:01:44 +0000313
York Sun472d5462013-04-01 11:29:11 -0700314 if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200315 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000316
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200317 if (bug_ctx.set)
318 (*bug_ctx.set) (bug_ctx.current_bp, addr);
319
320 bug_ctx.stopped = 0;
321 return 0;
322} /* do_bedbug_next */
323
324U_BOOT_CMD (next, 1, 1, do_bedbug_next,
Peter Tyser2fb26042009-01-27 18:03:12 -0600325 "single step execution, stepping over subroutines.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200326 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600327
wdenk47d1a6e2002-11-03 00:01:44 +0000328/* ======================================================================
329 * Interpreter command to print the current stack. This assumes an EABI
330 * architecture, so it starts with GPR R1 and works back up the stack.
331 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600332int do_bedbug_stack(struct cmd_tbl *cmdtp, int flag, int argc,
333 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000334{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200335 unsigned long sp; /* Stack pointer */
336 unsigned long func; /* LR from stack */
337 int depth; /* Stack iteration level */
338 int skip = 1; /* Flag to skip the first entry */
339 unsigned long top; /* Top of memory address */
wdenk47d1a6e2002-11-03 00:01:44 +0000340
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200341 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000342
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200343 if (!bug_ctx.stopped) {
344 printf ("Not at a breakpoint\n");
345 return 1;
346 }
wdenk47d1a6e2002-11-03 00:01:44 +0000347
Stefan Roesee207f222020-08-12 13:16:36 +0200348 top = gd->ram_start + gd->ram_size;
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200349 depth = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000350
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200351 printf ("Depth PC\n");
352 printf ("----- --------\n");
353 printf ("%5d %08lx\n", depth++, bug_ctx.regs->nip);
wdenk47d1a6e2002-11-03 00:01:44 +0000354
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200355 sp = bug_ctx.regs->gpr[1];
356 func = *(unsigned long *) (sp + 4);
wdenk47d1a6e2002-11-03 00:01:44 +0000357
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200358 while ((func < top) && (sp < top)) {
359 if (!skip)
360 printf ("%5d %08lx\n", depth++, func);
361 else
362 --skip;
wdenk47d1a6e2002-11-03 00:01:44 +0000363
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200364 sp = *(unsigned long *) sp;
365 func = *(unsigned long *) (sp + 4);
366 }
367 return 0;
368} /* do_bedbug_stack */
369
370U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
Peter Tyser2fb26042009-01-27 18:03:12 -0600371 "Print the running stack.",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200372 "");
Simon Glasse1bf8242014-04-10 20:01:27 -0600373
wdenk47d1a6e2002-11-03 00:01:44 +0000374/* ======================================================================
375 * Interpreter command to dump the registers. Calls the CPU-specific
376 * show registers routine.
377 * ====================================================================== */
Simon Glass09140112020-05-10 11:40:03 -0600378int do_bedbug_rdump(struct cmd_tbl *cmdtp, int flag, int argc,
379 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000380{
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200381 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000382
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200383 if (!bug_ctx.stopped) {
384 printf ("Not at a breakpoint\n");
385 return 1;
386 }
wdenk47d1a6e2002-11-03 00:01:44 +0000387
Wolfgang Denkd87080b2006-03-31 18:32:53 +0200388 show_regs (bug_ctx.regs);
389 return 0;
390} /* do_bedbug_rdump */
391
392U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200393 "Show registers.", "");
wdenk47d1a6e2002-11-03 00:01:44 +0000394/* ====================================================================== */
wdenk47d1a6e2002-11-03 00:01:44 +0000395
396
397/*
398 * Copyright (c) 2001 William L. Pitts
399 * All rights reserved.
400 *
401 * Redistribution and use in source and binary forms are freely
402 * permitted provided that the above copyright notice and this
403 * paragraph and the following disclaimer are duplicated in all
404 * such forms.
405 *
406 * This software is provided "AS IS" and without any express or
407 * implied warranties, including, without limitation, the implied
408 * warranties of merchantability and fitness for a particular
409 * purpose.
410 */