| 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 |
#include "command/help/break.h" |
| 28 |
#include "command/help/chdir.h" |
| 29 |
#include "command/help/comment.h" |
| 30 |
#include "command/help/continue.h" |
| 31 |
#include "command/help/delete.h" |
| 32 |
#include "command/help/down.h" |
| 33 |
#include "command/help/edit.h" |
| 34 |
#include "command/help/expand.h" |
| 35 |
#include "command/help/finish.h" |
| 36 |
#include "command/help/frame.h" |
| 37 |
#include "command/help/help.h" |
| 38 |
#include "command/help/info.h" |
| 39 |
#include "command/help/load.h" |
| 40 |
#include "command/help/list.h" |
| 41 |
#include "command/help/next.h" |
| 42 |
#include "command/help/print.h" |
| 43 |
#include "command/help/pwd.h" |
| 44 |
#include "command/help/quit.h" |
| 45 |
#include "command/help/run.h" |
| 46 |
#include "command/help/set.h" |
| 47 |
#include "command/help/setq.h" |
| 48 |
#include "command/help/setqx.h" |
| 49 |
#include "command/help/shell.h" |
| 50 |
#include "command/help/show.h" |
| 51 |
#include "command/help/source.h" |
| 52 |
#include "command/help/skip.h" |
| 53 |
#include "command/help/step.h" |
| 54 |
#include "command/help/target.h" |
| 55 |
#include "command/help/up.h" |
| 56 |
#include "command/help/where.h" |
| 57 |
#include "command/help/write.h" |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
long_cmd_t dbg_commands[] = { |
| 64 |
{ "break", 'b' }, |
| 65 |
{ "cd", 'C' }, |
| 66 |
{ "comment", '#' }, |
| 67 |
{ "continue", 'c' }, |
| 68 |
{ "delete", 'd' }, |
| 69 |
{ "down", 'D' }, |
| 70 |
{ "edit" , 'e' }, |
| 71 |
{ "expand" , 'x' }, |
| 72 |
{ "finish" , 'F' }, |
| 73 |
{ "frame" , 'f' }, |
| 74 |
{ "help" , 'h' }, |
| 75 |
{ "info" , 'i' }, |
| 76 |
{ "list" , 'l' }, |
| 77 |
{ "load" , 'M' }, |
| 78 |
{ "next" , 'n' }, |
| 79 |
{ "print" , 'p' }, |
| 80 |
{ "pwd" , 'P' }, |
| 81 |
{ "quit" , 'q' }, |
| 82 |
{ "run" , 'R' }, |
| 83 |
{ "set" , '=' }, |
| 84 |
{ "setq" , '"' }, |
| 85 |
{ "setqx" , '`' }, |
| 86 |
{ "shell" , '!' }, |
| 87 |
{ "show" , 'S' }, |
| 88 |
{ "skip" , 'k' }, |
| 89 |
{ "source" , '<' }, |
| 90 |
{ "step" , 's' }, |
| 91 |
{ "target" , 't' }, |
| 92 |
{ "up" , 'u' }, |
| 93 |
{ "where" , 'T' }, |
| 94 |
{ "write" , 'w' }, |
| 95 |
{ (char *)NULL, ' '} |
| 96 |
}; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
alias_cmd_t aliases[] = { |
| 101 |
{ "shell", "!!" }, |
| 102 |
{ "help", "?" }, |
| 103 |
{ "break", "L" }, |
| 104 |
{ "where", "backtrace" }, |
| 105 |
{ "where", "bt" }, |
| 106 |
{ "quit", "exit" }, |
| 107 |
{ "run", "restart" }, |
| 108 |
{ "quit", "return" }, |
| 109 |
{ (char *)NULL, (char *) NULL} |
| 110 |
}; |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
static void |
| 115 |
dbg_cmd_break_init(unsigned int c) |
| 116 |
{ |
| 117 |
short_command[c].func = &dbg_cmd_break; |
| 118 |
short_command[c].use = _("break [*target*|*linenum*] [all|run|prereq|end]*"); |
| 119 |
} |
| 120 |
|
| 121 |
static void |
| 122 |
dbg_cmd_chdir_init(unsigned int c) |
| 123 |
{ |
| 124 |
short_command[c].func = &dbg_cmd_chdir; |
| 125 |
short_command[c].use = _("cd *dir*"); |
| 126 |
} |
| 127 |
|
| 128 |
static void |
| 129 |
dbg_cmd_comment_init(unsigned int c) |
| 130 |
{ |
| 131 |
short_command[c].func = &dbg_cmd_comment; |
| 132 |
short_command[c].use = _("comment *text*"); |
| 133 |
} |
| 134 |
|
| 135 |
static void |
| 136 |
dbg_cmd_continue_init(unsigned int c) |
| 137 |
{ |
| 138 |
short_command[c].func = &dbg_cmd_continue; |
| 139 |
short_command[c].use = _("continue [*target* [all|run|prereq|end]*]"); |
| 140 |
} |
| 141 |
|
| 142 |
static void |
| 143 |
dbg_cmd_delete_init(unsigned int c) |
| 144 |
{ |
| 145 |
short_command[c].func = &dbg_cmd_delete; |
| 146 |
short_command[c].use = _("delete *breakpoint-numbers*..."); |
| 147 |
} |
| 148 |
|
| 149 |
|
| 150 |
static void |
| 151 |
dbg_cmd_edit_init(unsigned int c) |
| 152 |
{ |
| 153 |
short_command[c].func = &dbg_cmd_edit; |
| 154 |
short_command[c].use = _("edit"); |
| 155 |
} |
| 156 |
|
| 157 |
static void |
| 158 |
dbg_cmd_expand_init(unsigned int c) |
| 159 |
{ |
| 160 |
short_command[c].func = &dbg_cmd_expand; |
| 161 |
short_command[c].use = _("expand *string*"); |
| 162 |
} |
| 163 |
|
| 164 |
static void |
| 165 |
dbg_cmd_down_init(unsigned int c) |
| 166 |
{ |
| 167 |
short_command[c].func = &dbg_cmd_down; |
| 168 |
short_command[c].use = _("down [*amount*]"); |
| 169 |
} |
| 170 |
|
| 171 |
static void |
| 172 |
dbg_cmd_finish_init(unsigned int c) |
| 173 |
{ |
| 174 |
short_command[c].func = &dbg_cmd_finish; |
| 175 |
short_command[c].use = _("finish [*amount*]"); |
| 176 |
} |
| 177 |
|
| 178 |
static void |
| 179 |
dbg_cmd_frame_init(unsigned int c) |
| 180 |
{ |
| 181 |
short_command[c].func = &dbg_cmd_frame; |
| 182 |
short_command[c].use = _("frame *n*"); |
| 183 |
} |
| 184 |
|
| 185 |
static void |
| 186 |
dbg_cmd_help_init(unsigned int c) |
| 187 |
{ |
| 188 |
short_command[c].func = &dbg_cmd_help; |
| 189 |
short_command[c].use = _("help [*command*]"); |
| 190 |
} |
| 191 |
|
| 192 |
static void |
| 193 |
dbg_cmd_list_init(unsigned int c) |
| 194 |
{ |
| 195 |
short_command[c].func = &dbg_cmd_list; |
| 196 |
short_command[c].use = _("list [*target*|*line-number*]"); |
| 197 |
} |
| 198 |
|
| 199 |
static void |
| 200 |
dbg_cmd_next_init(unsigned int c) |
| 201 |
{ |
| 202 |
|
| 203 |
short_command[c].func = &dbg_cmd_next; |
| 204 |
short_command[c].use = _("next [*amount*]"); |
| 205 |
} |
| 206 |
|
| 207 |
static void |
| 208 |
dbg_cmd_info_init(unsigned int c) |
| 209 |
{ |
| 210 |
short_command[c].func = &dbg_cmd_info; |
| 211 |
short_command[c].use = _("info [*subcommand*]"); |
| 212 |
} |
| 213 |
|
| 214 |
static void |
| 215 |
dbg_cmd_load_init(unsigned int c) |
| 216 |
{ |
| 217 |
short_command[c].func = &dbg_cmd_load; |
| 218 |
short_command[c].use = _("load *file-glob*"); |
| 219 |
} |
| 220 |
|
| 221 |
static void |
| 222 |
dbg_cmd_pwd_init(unsigned int c) |
| 223 |
{ |
| 224 |
short_command[c].func = &dbg_cmd_pwd; |
| 225 |
short_command[c].use = _("pwd"); |
| 226 |
} |
| 227 |
|
| 228 |
static void |
| 229 |
dbg_cmd_print_init(unsigned int c) |
| 230 |
{ |
| 231 |
short_command[c].func = &dbg_cmd_print; |
| 232 |
short_command[c].use = _("print {*variable* [*attrs*...]}"); |
| 233 |
} |
| 234 |
|
| 235 |
static void |
| 236 |
dbg_cmd_quit_init(unsigned int c) |
| 237 |
{ |
| 238 |
short_command[c].func = &dbg_cmd_quit; |
| 239 |
short_command[c].use = _("quit [*exit-status*]"); |
| 240 |
} |
| 241 |
|
| 242 |
static void |
| 243 |
dbg_cmd_run_init(unsigned int c) |
| 244 |
{ |
| 245 |
short_command[c].func = &dbg_cmd_run; |
| 246 |
short_command[c].use = _("run [*args*]"); |
| 247 |
short_command[c].doc = |
| 248 |
_("Run Makefile from the beginning.\n" |
| 249 |
"You may specify arguments to give it.\n" |
| 250 |
"With no arguments, uses arguments last specified (with \"run\")"); |
| 251 |
} |
| 252 |
|
| 253 |
static void |
| 254 |
dbg_cmd_set_init(unsigned int c) |
| 255 |
{ |
| 256 |
|
| 257 |
short_command[c].func = &dbg_cmd_set; |
| 258 |
short_command[c].use = |
| 259 |
_("set *option* {on|off|toggle}"); |
| 260 |
} |
| 261 |
|
| 262 |
static void |
| 263 |
dbg_cmd_setq_init(unsigned int c) |
| 264 |
{ |
| 265 |
short_command[c].func = &dbg_cmd_setq; |
| 266 |
short_command[c].use = _("setq *variable* *value*"); |
| 267 |
} |
| 268 |
|
| 269 |
static void |
| 270 |
dbg_cmd_setqx_init(unsigned int c) |
| 271 |
{ |
| 272 |
short_command[c].func = &dbg_cmd_setqx; |
| 273 |
short_command[c].use = _("setqx *variable* *value"); |
| 274 |
} |
| 275 |
|
| 276 |
static void |
| 277 |
dbg_cmd_shell_init(unsigned int c) |
| 278 |
{ |
| 279 |
short_command[c].func = &dbg_cmd_shell; |
| 280 |
short_command[c].use = _("shell *string*"); |
| 281 |
} |
| 282 |
|
| 283 |
static void |
| 284 |
dbg_cmd_show_init(unsigned int c) |
| 285 |
{ |
| 286 |
short_command[c].func = &dbg_cmd_show; |
| 287 |
short_command[c].use = _("show [*subcommand]"); |
| 288 |
} |
| 289 |
|
| 290 |
static void |
| 291 |
dbg_cmd_skip_init(unsigned int c) |
| 292 |
{ |
| 293 |
short_command[c].func = &dbg_cmd_skip; |
| 294 |
short_command[c].use = _("skip"); |
| 295 |
} |
| 296 |
|
| 297 |
static void |
| 298 |
dbg_cmd_source_init(unsigned int c) |
| 299 |
{ |
| 300 |
short_command[c].func = &dbg_cmd_source; |
| 301 |
short_command[c].use = _("source *file-glob*"); |
| 302 |
} |
| 303 |
|
| 304 |
static void |
| 305 |
dbg_cmd_step_init(unsigned int c) |
| 306 |
{ |
| 307 |
short_command[c].func = &dbg_cmd_step; |
| 308 |
short_command[c].use = _("step [*amount*]"); |
| 309 |
} |
| 310 |
|
| 311 |
static void |
| 312 |
dbg_cmd_target_init(unsigned int c) |
| 313 |
{ |
| 314 |
short_command[c].func = &dbg_cmd_target; |
| 315 |
short_command[c].use = _("target [*target-name] [info1 [info2...]]"); |
| 316 |
} |
| 317 |
|
| 318 |
static void |
| 319 |
dbg_cmd_up_init(unsigned int c) |
| 320 |
{ |
| 321 |
short_command[c].func = &dbg_cmd_up; |
| 322 |
short_command[c].use = _("up [*amount*]"); |
| 323 |
} |
| 324 |
|
| 325 |
static void |
| 326 |
dbg_cmd_where_init(unsigned int c) |
| 327 |
{ |
| 328 |
short_command[c].func = &dbg_cmd_where; |
| 329 |
short_command[c].use = _("where"); |
| 330 |
} |
| 331 |
|
| 332 |
static void |
| 333 |
dbg_cmd_write_init(unsigned int c) |
| 334 |
{ |
| 335 |
short_command[c].func = &dbg_cmd_write; |
| 336 |
short_command[c].use = _("write [*target* [*filename*]]"); |
| 337 |
} |
| 338 |
|
| 339 |
#define DBG_CMD_INIT(CMD, LETTER, NEEDS_RUNNING) \ |
| 340 |
dbg_cmd_ ## CMD ## _init(LETTER); \ |
| 341 |
short_command[LETTER].doc = _(CMD ## _HELP_TEXT); \ |
| 342 |
short_command[LETTER].needs_running = NEEDS_RUNNING; \ |
| 343 |
short_command[LETTER].id = id++ |
| 344 |
|
| 345 |
static void |
| 346 |
cmd_initialize(void) |
| 347 |
{ |
| 348 |
int id=0; |
| 349 |
DBG_CMD_INIT(break, 'b', false); |
| 350 |
DBG_CMD_INIT(chdir, 'C', false); |
| 351 |
DBG_CMD_INIT(comment, '#', false); |
| 352 |
DBG_CMD_INIT(continue, 'c', true); |
| 353 |
DBG_CMD_INIT(delete, 'd', false); |
| 354 |
DBG_CMD_INIT(down, 'D', false); |
| 355 |
DBG_CMD_INIT(edit, 'e', false); |
| 356 |
DBG_CMD_INIT(expand, 'x', false); |
| 357 |
DBG_CMD_INIT(finish, 'F', true); |
| 358 |
DBG_CMD_INIT(frame, 'f', false); |
| 359 |
DBG_CMD_INIT(help, 'h', false); |
| 360 |
DBG_CMD_INIT(info, 'i', false); |
| 361 |
DBG_CMD_INIT(list, 'l', false); |
| 362 |
DBG_CMD_INIT(load, 'M', false); |
| 363 |
DBG_CMD_INIT(next, 'n', true); |
| 364 |
DBG_CMD_INIT(print, 'p', false); |
| 365 |
DBG_CMD_INIT(pwd, 'P', false); |
| 366 |
DBG_CMD_INIT(quit, 'q', false); |
| 367 |
DBG_CMD_INIT(run, 'R', false); |
| 368 |
DBG_CMD_INIT(set, '=', false); |
| 369 |
DBG_CMD_INIT(setq, '"', false); |
| 370 |
DBG_CMD_INIT(setqx, '`', false); |
| 371 |
DBG_CMD_INIT(shell, '!', false); |
| 372 |
DBG_CMD_INIT(show, 'S', false); |
| 373 |
DBG_CMD_INIT(skip, 'k', true); |
| 374 |
DBG_CMD_INIT(source, '<', false); |
| 375 |
DBG_CMD_INIT(step, 's', true); |
| 376 |
DBG_CMD_INIT(target, 't', false); |
| 377 |
DBG_CMD_INIT(up, 'u', false); |
| 378 |
DBG_CMD_INIT(where, 'T', false); |
| 379 |
DBG_CMD_INIT(write, 'w', false); |
| 380 |
} |