blob: 549c9056ddcae2e4672466ab2ff90d0a56531cf6 [file] [log] [blame]
wdenk47d1a6e2002-11-03 00:01:44 +00001/*
2 * BedBug Functions
3 */
4
5#include <common.h>
Simon Glassdec3c012014-04-10 20:01:25 -06006#include <cli.h>
wdenk47d1a6e2002-11-03 00:01:44 +00007#include <command.h>
Simon Glassa73bda42015-11-08 23:47:45 -07008#include <console.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06009#include <asm/global_data.h>
Simon Glass6b9f0102020-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>
wdenk57b2d802003-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 Denk6405a152006-03-31 18:32:53 +020018DECLARE_GLOBAL_DATA_PTR;
19
Wolfgang Denk6405a152006-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 Denk6405a152006-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 Glassbe6aafc2014-04-10 20:01:27 -060026
Wolfgang Denk6405a152006-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 Denk6405a152006-03-31 18:32:53 +020033int bedbug_puts (const char *str)
wdenk47d1a6e2002-11-03 00:01:44 +000034{
Wolfgang Denk6405a152006-03-31 18:32:53 +020035 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000036
Wolfgang Denk6405a152006-03-31 18:32:53 +020037 printf ("%s\r\n", str);
38 return 0;
39} /* bedbug_puts */
wdenk47d1a6e2002-11-03 00:01:44 +000040
41
Simon Glassbe6aafc2014-04-10 20:01:27 -060042
wdenk47d1a6e2002-11-03 00:01:44 +000043/* ======================================================================
44 * Initialize the bug_ctx structure used by the bedbug debugger. This is
45 * specific to the CPU since each has different debug registers and
46 * settings.
47 * ====================================================================== */
48
Ovidiu Panait8b371962020-04-20 10:31:45 +030049int bedbug_init(void)
wdenk47d1a6e2002-11-03 00:01:44 +000050{
Wolfgang Denk6405a152006-03-31 18:32:53 +020051 /* -------------------------------------------------- */
Ovidiu Panait8b371962020-04-20 10:31:45 +030052 return 0;
Wolfgang Denk6405a152006-03-31 18:32:53 +020053} /* bedbug_init */
Simon Glassbe6aafc2014-04-10 20:01:27 -060054
wdenk47d1a6e2002-11-03 00:01:44 +000055
56
wdenk47d1a6e2002-11-03 00:01:44 +000057/* ======================================================================
58 * Entry point from the interpreter to the disassembler. Repeated calls
59 * will resume from the last disassembled address.
60 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -060061int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,
62 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +000063{
Wolfgang Denk6405a152006-03-31 18:32:53 +020064 ulong addr; /* Address to start disassembly from */
65 ulong len; /* # of instructions to disassemble */
66
67 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +000068
Wolfgang Denk6405a152006-03-31 18:32:53 +020069 /* Setup to go from the last address if none is given */
70 addr = dis_last_addr;
71 len = dis_last_len;
wdenk47d1a6e2002-11-03 00:01:44 +000072
Wolfgang Denk3b683112010-07-17 01:06:04 +020073 if (argc < 2)
Simon Glassa06dfc72011-12-10 08:44:01 +000074 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +000075
Wolfgang Denk6405a152006-03-31 18:32:53 +020076 if ((flag & CMD_FLAG_REPEAT) == 0) {
77 /* New command */
Simon Glass3ff49ec2021-07-24 09:03:29 -060078 addr = hextoul(argv[1], NULL);
wdenk47d1a6e2002-11-03 00:01:44 +000079
Wolfgang Denk6405a152006-03-31 18:32:53 +020080 /* If an extra param is given then it is the length */
81 if (argc > 2)
Simon Glass3ff49ec2021-07-24 09:03:29 -060082 len = hextoul(argv[2], NULL);
Wolfgang Denk6405a152006-03-31 18:32:53 +020083 }
wdenk47d1a6e2002-11-03 00:01:44 +000084
Wolfgang Denk6405a152006-03-31 18:32:53 +020085 /* Run the disassembler */
86 disppc ((unsigned char *) addr, 0, len, bedbug_puts, F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +000087
Wolfgang Denk6405a152006-03-31 18:32:53 +020088 dis_last_addr = addr + (len * 4);
89 dis_last_len = len;
90 return 0;
91} /* do_bedbug_dis */
92
93U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
Peter Tyserdfb72b82009-01-27 18:03:12 -060094 "disassemble memory",
Wolfgang Denkc54781c2009-05-24 17:06:54 +020095 "ds <address> [# instructions]");
Simon Glassbe6aafc2014-04-10 20:01:27 -060096
wdenk47d1a6e2002-11-03 00:01:44 +000097/* ======================================================================
98 * Entry point from the interpreter to the assembler. Assembles
99 * instructions in consecutive memory locations until a '.' (period) is
100 * entered on a line by itself.
101 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600102int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,
103 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000104{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200105 long mem_addr; /* Address to assemble into */
106 unsigned long instr; /* Machine code for text */
107 char prompt[15]; /* Prompt string for user input */
108 int asm_err; /* Error code from the assembler */
109
110 /* -------------------------------------------------- */
111 int rcode = 0;
112
Wolfgang Denk3b683112010-07-17 01:06:04 +0200113 if (argc < 2)
Simon Glassa06dfc72011-12-10 08:44:01 +0000114 return CMD_RET_USAGE;
wdenk47d1a6e2002-11-03 00:01:44 +0000115
Wolfgang Denk6405a152006-03-31 18:32:53 +0200116 printf ("\nEnter '.' when done\n");
Simon Glass3ff49ec2021-07-24 09:03:29 -0600117 mem_addr = hextoul(argv[1], NULL);
wdenk47d1a6e2002-11-03 00:01:44 +0000118
Wolfgang Denk6405a152006-03-31 18:32:53 +0200119 while (1) {
120 putc ('\n');
121 disppc ((unsigned char *) mem_addr, 0, 1, bedbug_puts,
122 F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000123
Wolfgang Denk6405a152006-03-31 18:32:53 +0200124 sprintf (prompt, "%08lx: ", mem_addr);
Simon Glassbe6aafc2014-04-10 20:01:27 -0600125 cli_readline(prompt);
wdenk47d1a6e2002-11-03 00:01:44 +0000126
Wolfgang Denk6405a152006-03-31 18:32:53 +0200127 if (console_buffer[0] && strcmp (console_buffer, ".")) {
128 if ((instr =
129 asmppc (mem_addr, console_buffer,
130 &asm_err)) != 0) {
131 *(unsigned long *) mem_addr = instr;
132 mem_addr += 4;
133 } else {
134 printf ("*** Error: %s ***\n",
135 asm_error_str (asm_err));
136 rcode = 1;
137 }
138 } else {
139 break;
140 }
141 }
142 return rcode;
143} /* do_bedbug_asm */
wdenk47d1a6e2002-11-03 00:01:44 +0000144
Wolfgang Denk6405a152006-03-31 18:32:53 +0200145U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200146 "assemble memory", "as <address>");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600147
wdenk47d1a6e2002-11-03 00:01:44 +0000148/* ======================================================================
149 * Used to set a break point from the interpreter. Simply calls into the
150 * CPU-specific break point set routine.
151 * ====================================================================== */
152
Simon Glassed38aef2020-05-10 11:40:03 -0600153int do_bedbug_break(struct cmd_tbl *cmdtp, int flag, int argc,
154 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000155{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200156 /* -------------------------------------------------- */
157 if (bug_ctx.do_break)
158 (*bug_ctx.do_break) (cmdtp, flag, argc, argv);
159 return 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000160
Wolfgang Denk6405a152006-03-31 18:32:53 +0200161} /* do_bedbug_break */
162
163U_BOOT_CMD (break, 3, 0, do_bedbug_break,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600164 "set or clear a breakpoint",
Wolfgang Denk6405a152006-03-31 18:32:53 +0200165 " - Set or clear a breakpoint\n"
166 "break <address> - Break at an address\n"
167 "break off <bp#> - Disable breakpoint.\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200168 "break show - List breakpoints.");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600169
wdenk47d1a6e2002-11-03 00:01:44 +0000170/* ======================================================================
171 * Called from the debug interrupt routine. Simply calls the CPU-specific
172 * breakpoint handling routine.
173 * ====================================================================== */
174
175void do_bedbug_breakpoint (struct pt_regs *regs)
176{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200177 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000178
Wolfgang Denk6405a152006-03-31 18:32:53 +0200179 if (bug_ctx.break_isr)
180 (*bug_ctx.break_isr) (regs);
wdenk47d1a6e2002-11-03 00:01:44 +0000181
Wolfgang Denk6405a152006-03-31 18:32:53 +0200182 return;
183} /* do_bedbug_breakpoint */
wdenk47d1a6e2002-11-03 00:01:44 +0000184
185
Simon Glassbe6aafc2014-04-10 20:01:27 -0600186
wdenk47d1a6e2002-11-03 00:01:44 +0000187/* ======================================================================
188 * Called from the CPU-specific breakpoint handling routine. Enter a
189 * mini main loop until the stopped flag is cleared from the breakpoint
190 * context.
191 *
192 * This handles the parts of the debugger that are common to all CPU's.
193 * ====================================================================== */
194
Wolfgang Denk6405a152006-03-31 18:32:53 +0200195void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
wdenk47d1a6e2002-11-03 00:01:44 +0000196{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200197 int len; /* Length of command line */
198 int flag; /* Command flags */
199 int rc = 0; /* Result from run_command */
200 char prompt_str[20]; /* Prompt string */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200201 static char lastcommand[CONFIG_SYS_CBSIZE] = { 0 }; /* previous command */
Wolfgang Denk6405a152006-03-31 18:32:53 +0200202 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000203
Wolfgang Denk6405a152006-03-31 18:32:53 +0200204 if (bug_ctx.clear)
205 (*bug_ctx.clear) (bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000206
Wolfgang Denk6405a152006-03-31 18:32:53 +0200207 printf ("Breakpoint %d: ", bug_ctx.current_bp);
208 disppc ((unsigned char *) addr, 0, 1, bedbug_puts, F_RADHEX);
wdenk47d1a6e2002-11-03 00:01:44 +0000209
Wolfgang Denk6405a152006-03-31 18:32:53 +0200210 bug_ctx.stopped = 1;
211 bug_ctx.regs = regs;
wdenk47d1a6e2002-11-03 00:01:44 +0000212
Wolfgang Denk6405a152006-03-31 18:32:53 +0200213 sprintf (prompt_str, "BEDBUG.%d =>", bug_ctx.current_bp);
wdenk47d1a6e2002-11-03 00:01:44 +0000214
Wolfgang Denk6405a152006-03-31 18:32:53 +0200215 /* A miniature main loop */
216 while (bug_ctx.stopped) {
Simon Glassbe6aafc2014-04-10 20:01:27 -0600217 len = cli_readline(prompt_str);
wdenk47d1a6e2002-11-03 00:01:44 +0000218
Wolfgang Denk6405a152006-03-31 18:32:53 +0200219 flag = 0; /* assume no special flags for now */
wdenk47d1a6e2002-11-03 00:01:44 +0000220
Wolfgang Denk6405a152006-03-31 18:32:53 +0200221 if (len > 0)
222 strcpy (lastcommand, console_buffer);
223 else if (len == 0)
224 flag |= CMD_FLAG_REPEAT;
wdenk47d1a6e2002-11-03 00:01:44 +0000225
Wolfgang Denk6405a152006-03-31 18:32:53 +0200226 if (len == -1)
227 printf ("<INTERRUPT>\n");
228 else
Thomas Betker02717562014-06-05 20:07:58 +0200229 rc = run_command_repeatable(lastcommand, flag);
wdenk47d1a6e2002-11-03 00:01:44 +0000230
Wolfgang Denk6405a152006-03-31 18:32:53 +0200231 if (rc <= 0) {
232 /* invalid command or not repeatable, forget it */
233 lastcommand[0] = 0;
234 }
235 }
wdenk47d1a6e2002-11-03 00:01:44 +0000236
Wolfgang Denk6405a152006-03-31 18:32:53 +0200237 bug_ctx.regs = NULL;
238 bug_ctx.current_bp = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000239
Wolfgang Denk6405a152006-03-31 18:32:53 +0200240 return;
241} /* bedbug_main_loop */
wdenk47d1a6e2002-11-03 00:01:44 +0000242
243
Simon Glassbe6aafc2014-04-10 20:01:27 -0600244
wdenk47d1a6e2002-11-03 00:01:44 +0000245/* ======================================================================
246 * Interpreter command to continue from a breakpoint. Just clears the
247 * stopped flag in the context so that the breakpoint routine will
248 * return.
249 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600250int do_bedbug_continue(struct cmd_tbl *cmdtp, int flag, int argc,
251 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000252{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200253 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000254
Wolfgang Denk6405a152006-03-31 18:32:53 +0200255 if (!bug_ctx.stopped) {
256 printf ("Not at a breakpoint\n");
257 return 1;
258 }
wdenk47d1a6e2002-11-03 00:01:44 +0000259
Wolfgang Denk6405a152006-03-31 18:32:53 +0200260 bug_ctx.stopped = 0;
261 return 0;
262} /* do_bedbug_continue */
263
264U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600265 "continue from a breakpoint",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200266 "");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600267
wdenk47d1a6e2002-11-03 00:01:44 +0000268/* ======================================================================
269 * Interpreter command to continue to the next instruction, stepping into
270 * subroutines. Works by calling the find_next_addr() routine to compute
271 * the address passes control to the CPU-specific set breakpoint routine
272 * for the current breakpoint number.
273 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600274int do_bedbug_step(struct cmd_tbl *cmdtp, int flag, int argc,
275 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000276{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200277 unsigned long addr; /* Address to stop at */
wdenk47d1a6e2002-11-03 00:01:44 +0000278
Wolfgang Denk6405a152006-03-31 18:32:53 +0200279 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000280
Wolfgang Denk6405a152006-03-31 18:32:53 +0200281 if (!bug_ctx.stopped) {
282 printf ("Not at a breakpoint\n");
283 return 1;
284 }
wdenk47d1a6e2002-11-03 00:01:44 +0000285
York Sun4a598092013-04-01 11:29:11 -0700286 if (!find_next_address((unsigned char *) &addr, false, bug_ctx.regs))
Wolfgang Denk6405a152006-03-31 18:32:53 +0200287 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000288
Wolfgang Denk6405a152006-03-31 18:32:53 +0200289 if (bug_ctx.set)
290 (*bug_ctx.set) (bug_ctx.current_bp, addr);
291
292 bug_ctx.stopped = 0;
293 return 0;
294} /* do_bedbug_step */
295
296U_BOOT_CMD (step, 1, 1, do_bedbug_step,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600297 "single step execution.",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200298 "");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600299
wdenk47d1a6e2002-11-03 00:01:44 +0000300/* ======================================================================
301 * Interpreter command to continue to the next instruction, stepping over
302 * subroutines. Works by calling the find_next_addr() routine to compute
303 * the address passes control to the CPU-specific set breakpoint routine
304 * for the current breakpoint number.
305 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600306int do_bedbug_next(struct cmd_tbl *cmdtp, int flag, int argc,
307 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000308{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200309 unsigned long addr; /* Address to stop at */
310
311 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000312
Wolfgang Denk6405a152006-03-31 18:32:53 +0200313 if (!bug_ctx.stopped) {
314 printf ("Not at a breakpoint\n");
315 return 1;
316 }
wdenk47d1a6e2002-11-03 00:01:44 +0000317
York Sun4a598092013-04-01 11:29:11 -0700318 if (!find_next_address((unsigned char *) &addr, true, bug_ctx.regs))
Wolfgang Denk6405a152006-03-31 18:32:53 +0200319 return 1;
wdenk47d1a6e2002-11-03 00:01:44 +0000320
Wolfgang Denk6405a152006-03-31 18:32:53 +0200321 if (bug_ctx.set)
322 (*bug_ctx.set) (bug_ctx.current_bp, addr);
wdenk47d1a6e2002-11-03 00:01:44 +0000323
Wolfgang Denk6405a152006-03-31 18:32:53 +0200324 bug_ctx.stopped = 0;
325 return 0;
326} /* do_bedbug_next */
327
328U_BOOT_CMD (next, 1, 1, do_bedbug_next,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600329 "single step execution, stepping over subroutines.",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200330 "");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600331
wdenk47d1a6e2002-11-03 00:01:44 +0000332/* ======================================================================
333 * Interpreter command to print the current stack. This assumes an EABI
334 * architecture, so it starts with GPR R1 and works back up the stack.
335 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600336int do_bedbug_stack(struct cmd_tbl *cmdtp, int flag, int argc,
337 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000338{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200339 unsigned long sp; /* Stack pointer */
340 unsigned long func; /* LR from stack */
341 int depth; /* Stack iteration level */
342 int skip = 1; /* Flag to skip the first entry */
343 unsigned long top; /* Top of memory address */
wdenk47d1a6e2002-11-03 00:01:44 +0000344
Wolfgang Denk6405a152006-03-31 18:32:53 +0200345 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000346
Wolfgang Denk6405a152006-03-31 18:32:53 +0200347 if (!bug_ctx.stopped) {
348 printf ("Not at a breakpoint\n");
349 return 1;
350 }
wdenk47d1a6e2002-11-03 00:01:44 +0000351
Stefan Roesea13a2aa2020-08-12 13:16:36 +0200352 top = gd->ram_start + gd->ram_size;
Wolfgang Denk6405a152006-03-31 18:32:53 +0200353 depth = 0;
wdenk47d1a6e2002-11-03 00:01:44 +0000354
Wolfgang Denk6405a152006-03-31 18:32:53 +0200355 printf ("Depth PC\n");
356 printf ("----- --------\n");
357 printf ("%5d %08lx\n", depth++, bug_ctx.regs->nip);
wdenk47d1a6e2002-11-03 00:01:44 +0000358
Wolfgang Denk6405a152006-03-31 18:32:53 +0200359 sp = bug_ctx.regs->gpr[1];
360 func = *(unsigned long *) (sp + 4);
wdenk47d1a6e2002-11-03 00:01:44 +0000361
Wolfgang Denk6405a152006-03-31 18:32:53 +0200362 while ((func < top) && (sp < top)) {
363 if (!skip)
364 printf ("%5d %08lx\n", depth++, func);
365 else
366 --skip;
wdenk47d1a6e2002-11-03 00:01:44 +0000367
Wolfgang Denk6405a152006-03-31 18:32:53 +0200368 sp = *(unsigned long *) sp;
369 func = *(unsigned long *) (sp + 4);
370 }
371 return 0;
372} /* do_bedbug_stack */
373
374U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600375 "Print the running stack.",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200376 "");
Simon Glassbe6aafc2014-04-10 20:01:27 -0600377
wdenk47d1a6e2002-11-03 00:01:44 +0000378/* ======================================================================
379 * Interpreter command to dump the registers. Calls the CPU-specific
380 * show registers routine.
381 * ====================================================================== */
Simon Glassed38aef2020-05-10 11:40:03 -0600382int do_bedbug_rdump(struct cmd_tbl *cmdtp, int flag, int argc,
383 char *const argv[])
wdenk47d1a6e2002-11-03 00:01:44 +0000384{
Wolfgang Denk6405a152006-03-31 18:32:53 +0200385 /* -------------------------------------------------- */
wdenk47d1a6e2002-11-03 00:01:44 +0000386
Wolfgang Denk6405a152006-03-31 18:32:53 +0200387 if (!bug_ctx.stopped) {
388 printf ("Not at a breakpoint\n");
389 return 1;
390 }
wdenk47d1a6e2002-11-03 00:01:44 +0000391
Wolfgang Denk6405a152006-03-31 18:32:53 +0200392 show_regs (bug_ctx.regs);
393 return 0;
394} /* do_bedbug_rdump */
395
396U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200397 "Show registers.", "");
wdenk47d1a6e2002-11-03 00:01:44 +0000398/* ====================================================================== */
wdenk47d1a6e2002-11-03 00:01:44 +0000399
400
401/*
402 * Copyright (c) 2001 William L. Pitts
403 * All rights reserved.
404 *
405 * Redistribution and use in source and binary forms are freely
406 * permitted provided that the above copyright notice and this
407 * paragraph and the following disclaimer are duplicated in all
408 * such forms.
409 *
410 * This software is provided "AS IS" and without any express or
411 * implied warranties, including, without limitation, the implied
412 * warranties of merchantability and fitness for a particular
413 * purpose.
414 */