#include <sys/stat.h>
#include <ctype.h>
+extern void initialize_targets PARAMS ((void));
+
+extern void initialize_utils PARAMS ((void));
+
/* Prototypes for local functions */
static char * line_completion_function PARAMS ((char *, int, char *, int));
#define GDBINIT_FILENAME ".gdbinit"
#endif
char gdbinit[] = GDBINIT_FILENAME;
+
int inhibit_gdbinit = 0;
-/* Disable windows if non-zero */
+/* If nonzero, and GDB has been configured to be able to use windows,
+ attempt to open them upon startup. */
-int use_windows = 1; /* Defaults to on for now */
+int use_windows = 1;
/* Version number of GDB, as a string. */
int caution = 1; /* Default is yes, sigh. */
-/*
- * Define all cmd_list_element's
- */
+/* Define all cmd_list_elements. */
/* Chain containing all defined commands. */
void (*create_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
void (*delete_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
-void (*enable_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
-void (*disable_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
+void (*modify_breakpoint_hook) PARAMS ((struct breakpoint *bpt));
/* Called during long calculations to allow GUI to repair window damage, and to
check for stop buttons, etc... */
void (*call_command_hook) PARAMS ((struct cmd_list_element *c, char *cmd,
int from_tty));
-/* An alternate way to read memory for disassembly. This is used to provide a
- switch that allows disassembly to come from an exec file rather than a
- remote target. This is a speed hack. */
-int (*dis_asm_read_memory_hook) PARAMS ((bfd_vma memaddr, bfd_byte *myaddr,
- int len, disassemble_info *info));
/* Takes control from error (). Typically used to prevent longjmps out of the
middle of the GUI. Usually used in conjunction with a catch routine. */
int val;
struct cleanup *saved_cleanup_chain;
char *saved_error_pre_print;
+ char *saved_quit_pre_print;
saved_cleanup_chain = save_cleanups ();
saved_error_pre_print = error_pre_print;
+ saved_quit_pre_print = quit_pre_print;
if (mask & RETURN_MASK_ERROR)
- memcpy ((char *)saved_error, (char *)error_return, sizeof (jmp_buf));
+ {
+ memcpy ((char *)saved_error, (char *)error_return, sizeof (jmp_buf));
+ error_pre_print = errstring;
+ }
if (mask & RETURN_MASK_QUIT)
- memcpy (saved_quit, quit_return, sizeof (jmp_buf));
- error_pre_print = errstring;
+ {
+ memcpy (saved_quit, quit_return, sizeof (jmp_buf));
+ quit_pre_print = errstring;
+ }
if (setjmp (tmp_jmp) == 0)
{
restore_cleanups (saved_cleanup_chain);
- error_pre_print = saved_error_pre_print;
if (mask & RETURN_MASK_ERROR)
- memcpy (error_return, saved_error, sizeof (jmp_buf));
+ {
+ memcpy (error_return, saved_error, sizeof (jmp_buf));
+ error_pre_print = saved_error_pre_print;
+ }
if (mask & RETURN_MASK_QUIT)
- memcpy (quit_return, saved_quit, sizeof (jmp_buf));
+ {
+ memcpy (quit_return, saved_quit, sizeof (jmp_buf));
+ quit_pre_print = saved_quit_pre_print;
+ }
return val;
}
locate_arg (p)
char *p;
{
- while (p = strchr (p, '$'))
+ while ((p = strchr (p, '$')))
{
if (strncmp (p, "$arg", 4) == 0 && isdigit (p[4]))
return p;
/* First we need to know how much memory to allocate for the new line. */
save_line = line;
len = 0;
- while (p = locate_arg (line))
+ while ((p = locate_arg (line)))
{
len += p - line;
i = p[4] - '0';
/* Save pointer to beginning of new line. */
save_line = new_line;
- while (p = locate_arg (line))
+ while ((p = locate_arg (line)))
{
int i, len;
new_line += p - line;
i = p[4] - '0';
- if (len = user_args->a[i].len)
+ len = user_args->a[i].len;
+ if (len)
{
memcpy (new_line, user_args->a[i].arg, len);
new_line += len;
character position to be off, since the newline we read from
the user is not accounted for. */
fputs_unfiltered (prrompt, gdb_stdout);
-/* start-sanitize-mpw */
#ifdef MPW
/* Move to a new line so the entered line doesn't have a prompt
on the front of it. */
fputs_unfiltered ("\n", gdb_stdout);
#endif /* MPW */
-/* end-sanitize-mpw */
gdb_flush (gdb_stdout);
}
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
+ else if (c->enums)
+ {
+ list = complete_on_enum (c->enums, p, word);
+ rl_completer_word_break_characters =
+ gdb_completer_command_word_break_characters;
+ }
else
{
/* It is a normal command; what comes after it is
e.g. "info adsfkdj". */
list = NULL;
}
+ else if (c->enums)
+ {
+ list = complete_on_enum (c->enums, p, word);
+ }
else
{
/* It is a normal command. */
{
warning ("Your new `%s' command does not hook any existing command.",
comname);
- if (!query ("Proceed? ", (char *)0))
+ if (!query ("Proceed? "))
error ("Not confirmed.");
}
}
fprintf_filtered (stream, "), ");
wrap_here("");
- fprintf_filtered (stream, "Copyright 1994 Free Software Foundation, Inc.");
+ fprintf_filtered (stream, "Copyright 1995 Free Software Foundation, Inc.");
}
/* ARGSUSED */
perror_with_name (dir);
len = strlen (dir);
- dir = savestring (dir, len - (len > 1 && dir[len-1] == '/'));
- if (dir[0] == '/')
+ dir = savestring (dir, len - (len > 1 && SLASH_P(dir[len-1])));
+ if (ROOTED_P(dir))
current_directory = dir;
else
{
- if (current_directory[0] == '/' && current_directory[1] == '\0')
+ if (SLASH_P (current_directory[0]) && current_directory[1] == '\0')
current_directory = concat (current_directory, dir, NULL);
else
- current_directory = concat (current_directory, "/", dir, NULL);
+ current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
free (dir);
}
found_real_path = 0;
for (p = current_directory; *p;)
{
- if (p[0] == '/' && p[1] == '.' && (p[2] == 0 || p[2] == '/'))
+ if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2])))
strcpy (p, p + 2);
- else if (p[0] == '/' && p[1] == '.' && p[2] == '.'
- && (p[3] == 0 || p[3] == '/'))
+ else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.'
+ && (p[3] == 0 || SLASH_P (p[3])))
{
if (found_real_path)
{
/* Search backwards for the directory just before the "/.."
and obliterate it and the "/..". */
char *q = p;
- while (q != current_directory && q[-1] != '/')
+ while (q != current_directory && ! SLASH_P (q[-1]))
--q;
if (q == current_directory)
add_info ("set", show_command, "Show all GDB settings.");
add_cmd ("commands", no_class, show_commands,
- "Show the the history of commands you typed.\n\
+ "Show the history of commands you typed.\n\
You can supply a command number to start with, or a `+' to start after\n\
the previous command number shown.",
&showlist);
add_com ("while", class_support, while_command,
"Execute nested commands WHILE the conditional expression is non zero.\n\
-The conditional expression must follow the word `while' and must in turn be\
-followed by a new line. The nested commands must be entered one per line,\
+The conditional expression must follow the word `while' and must in turn be\n\
+followed by a new line. The nested commands must be entered one per line,\n\
and should be terminated by the word `end'.");
add_com ("if", class_support, if_command,
"Execute nested commands once IF the conditional expression is non zero.\n\
-The conditional expression must follow the word `if' and must in turn be\
-followed by a new line. The nested commands must be entered one per line,\
-and should be terminated by the word 'else' or `end'. If an else clause\
+The conditional expression must follow the word `if' and must in turn be\n\
+followed by a new line. The nested commands must be entered one per line,\n\
+and should be terminated by the word 'else' or `end'. If an else clause\n\
is used, the same rules apply to its nested commands as to the first ones.");
/* If target is open when baud changes, it doesn't take effect until the