summaryrefslogtreecommitdiffstats
path: root/include/cmd_bedbug.h
blob: 105441e44cae5a5ef3ded16bd191bad1c7188a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * BedBug Functions
 */
#ifndef _CMD_BEDBUG_H
#define _CMD_BEDBUG_H

#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)

#define CMD_TBL_DIS     MK_CMD_TBL_ENTRY(                               \
        "ds",           2,      3,      1,      do_bedbug_dis,          \
        "ds      - disassemble memory\n",                               \
        "ds <address> [# instructions]\n"                               \
        ),

#define CMD_TBL_ASM     MK_CMD_TBL_ENTRY(                               \
        "as",           2,      2,      0,      do_bedbug_asm,          \
        "as      - assemble memory\n",                                  \
        "as <address>\n"                                                \
        ),

#define CMD_TBL_BREAK   MK_CMD_TBL_ENTRY(                               \
        "break",        2,      3,      0,      do_bedbug_break,        \
        "break   - set or clear a breakpoint\n",                        \
        " - Set or clear a breakpoint\n"                                \
        "break <address> - Break at an address\n"                       \
        "break off <bp#> - Disable breakpoint.\n"                       \
        "break show      - List breakpoints.\n"                         \
        ),

#define CMD_TBL_CONTINUE        MK_CMD_TBL_ENTRY(                       \
        "continue",     4,      1,      0,      do_bedbug_continue,     \
        "continue- continue from a breakpoint\n",                       \
        " - continue from a breakpoint.\n"                              \
        ),

#define CMD_TBL_STEP        MK_CMD_TBL_ENTRY(                           \
        "step", 4,      1,      1,      do_bedbug_step,                 \
        "step    - single step execution.\n",                           \
        " - single step execution.\n"                                   \
        ),

#define CMD_TBL_NEXT        MK_CMD_TBL_ENTRY(                           \
        "next", 4,      1,      1,      do_bedbug_next,                 \
        "next    - single step execution, stepping over subroutines.\n",\
        " - single step execution, stepping over subroutines.\n"        \
        ),

#define CMD_TBL_STACK        MK_CMD_TBL_ENTRY(                          \
        "where", 5,     1,      1,      do_bedbug_stack,                \
        "where   - Print the running stack.\n",                         \
        " - Print the running stack.\n"                                 \
        ),

#define CMD_TBL_RDUMP        MK_CMD_TBL_ENTRY(                          \
        "rdump", 5,     1,      1,      do_bedbug_rdump,                \
        "rdump   - Show registers.\n",                                  \
        " - Show registers.\n"                                          \
        ),

extern int do_bedbug_dis      (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_asm      (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_break    (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_continue (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_step     (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_next     (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_stack    (cmd_tbl_t *, int, int, char *[]);
extern int do_bedbug_rdump    (cmd_tbl_t *, int, int, char *[]);

/* Supporting routines */
extern int bedbug_puts (const char *);
extern void bedbug_init (void);
extern void do_bedbug_breakpoint (struct pt_regs *);
extern void bedbug_main_loop (unsigned long, struct pt_regs *);


typedef struct {
	int hw_debug_enabled;
	int stopped;
	int current_bp;
	struct pt_regs *regs;

	void (*do_break) (cmd_tbl_t *, int, int, char *[]);
	void (*break_isr) (struct pt_regs *);
	int (*find_empty) (void);
	int (*set) (int, unsigned long);
	int (*clear) (int);
} CPU_DEBUG_CTX;

#else /* ! CFG_CMD_BEDBUG */

#define CMD_TBL_DIS
#define CMD_TBL_ASM
#define CMD_TBL_BREAK
#define CMD_TBL_CONTINUE
#define CMD_TBL_STEP
#define CMD_TBL_NEXT
#define CMD_TBL_STACK
#define CMD_TBL_RDUMP

#endif /* CFG_CMD_BEDBUG */
#endif /* _CMD_BEDBUG_H */


/*
 * Copyright (c) 2001 William L. Pitts
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are freely
 * permitted provided that the above copyright notice and this
 * paragraph and the following disclaimer are duplicated in all
 * such forms.
 *
 * This software is provided "AS IS" and without any express or
 * implied warranties, including, without limitation, the implied
 * warranties of merchantability and fitness for a particular
 * purpose.
 */