blob: 105441e44cae5a5ef3ded16bd191bad1c7188a4c [file] [log] [blame]
wdenk78f66222002-08-27 10:27:51 +00001/*
2 * BedBug Functions
3 */
4#ifndef _CMD_BEDBUG_H
5#define _CMD_BEDBUG_H
6
7#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
8
9#define CMD_TBL_DIS MK_CMD_TBL_ENTRY( \
10 "ds", 2, 3, 1, do_bedbug_dis, \
11 "ds - disassemble memory\n", \
12 "ds <address> [# instructions]\n" \
13 ),
14
15#define CMD_TBL_ASM MK_CMD_TBL_ENTRY( \
16 "as", 2, 2, 0, do_bedbug_asm, \
17 "as - assemble memory\n", \
18 "as <address>\n" \
19 ),
20
21#define CMD_TBL_BREAK MK_CMD_TBL_ENTRY( \
22 "break", 2, 3, 0, do_bedbug_break, \
23 "break - set or clear a breakpoint\n", \
24 " - Set or clear a breakpoint\n" \
25 "break <address> - Break at an address\n" \
26 "break off <bp#> - Disable breakpoint.\n" \
27 "break show - List breakpoints.\n" \
28 ),
29
30#define CMD_TBL_CONTINUE MK_CMD_TBL_ENTRY( \
31 "continue", 4, 1, 0, do_bedbug_continue, \
32 "continue- continue from a breakpoint\n", \
33 " - continue from a breakpoint.\n" \
34 ),
35
36#define CMD_TBL_STEP MK_CMD_TBL_ENTRY( \
37 "step", 4, 1, 1, do_bedbug_step, \
38 "step - single step execution.\n", \
39 " - single step execution.\n" \
40 ),
41
42#define CMD_TBL_NEXT MK_CMD_TBL_ENTRY( \
43 "next", 4, 1, 1, do_bedbug_next, \
44 "next - single step execution, stepping over subroutines.\n",\
45 " - single step execution, stepping over subroutines.\n" \
46 ),
47
48#define CMD_TBL_STACK MK_CMD_TBL_ENTRY( \
49 "where", 5, 1, 1, do_bedbug_stack, \
50 "where - Print the running stack.\n", \
51 " - Print the running stack.\n" \
52 ),
53
54#define CMD_TBL_RDUMP MK_CMD_TBL_ENTRY( \
55 "rdump", 5, 1, 1, do_bedbug_rdump, \
56 "rdump - Show registers.\n", \
57 " - Show registers.\n" \
58 ),
59
60extern int do_bedbug_dis (cmd_tbl_t *, int, int, char *[]);
61extern int do_bedbug_asm (cmd_tbl_t *, int, int, char *[]);
62extern int do_bedbug_break (cmd_tbl_t *, int, int, char *[]);
63extern int do_bedbug_continue (cmd_tbl_t *, int, int, char *[]);
64extern int do_bedbug_step (cmd_tbl_t *, int, int, char *[]);
65extern int do_bedbug_next (cmd_tbl_t *, int, int, char *[]);
66extern int do_bedbug_stack (cmd_tbl_t *, int, int, char *[]);
67extern int do_bedbug_rdump (cmd_tbl_t *, int, int, char *[]);
68
69/* Supporting routines */
70extern int bedbug_puts (const char *);
71extern void bedbug_init (void);
72extern void do_bedbug_breakpoint (struct pt_regs *);
73extern void bedbug_main_loop (unsigned long, struct pt_regs *);
74
75
76typedef struct {
77 int hw_debug_enabled;
78 int stopped;
79 int current_bp;
80 struct pt_regs *regs;
81
82 void (*do_break) (cmd_tbl_t *, int, int, char *[]);
83 void (*break_isr) (struct pt_regs *);
84 int (*find_empty) (void);
85 int (*set) (int, unsigned long);
86 int (*clear) (int);
87} CPU_DEBUG_CTX;
88
89#else /* ! CFG_CMD_BEDBUG */
90
91#define CMD_TBL_DIS
92#define CMD_TBL_ASM
93#define CMD_TBL_BREAK
94#define CMD_TBL_CONTINUE
95#define CMD_TBL_STEP
96#define CMD_TBL_NEXT
97#define CMD_TBL_STACK
98#define CMD_TBL_RDUMP
99
100#endif /* CFG_CMD_BEDBUG */
101#endif /* _CMD_BEDBUG_H */
102
103
104/*
105 * Copyright (c) 2001 William L. Pitts
106 * All rights reserved.
107 *
108 * Redistribution and use in source and binary forms are freely
109 * permitted provided that the above copyright notice and this
110 * paragraph and the following disclaimer are duplicated in all
111 * such forms.
112 *
113 * This software is provided "AS IS" and without any express or
114 * implied warranties, including, without limitation, the implied
115 * warranties of merchantability and fitness for a particular
116 * purpose.
117 */