target.c, valprint.c: Use unfiltered forms of f/printf, et. al.
until we can figure out a better way to do paging.
+Mon Sep 28 22:03:41 1992 Stu Grossman (grossman at cygnus.com)
+
+ * breakpoint.c, exec.c, language.c, main.c, printcmd.c, symfile.c,
+ target.c, valprint.c: Use unfiltered forms of f/printf, et. al.
+ until we can figure out a better way to do paging.
+
Sat Sep 26 02:07:31 1992 John Gilmore (gnu@cygnus.com)
* findvar.c (supply_register): Add CLEAN_UP_REGISTER_VALUE hook.
/* FIXME -- do this from the list, with HELP. */
if (!language || !language[0]) {
- printf_filtered ("The currently understood settings are:\n\n\
+ printf("The currently understood settings are:\n\n\
local or auto Automatic setting based on source file\n\
c Use the C language\n\
c++ Use the C++ language\n\
int from_tty;
{
if (type_check != current_language->la_type_check)
- printf_filtered(
+ printf(
"Warning: the current type check setting does not match the language.\n");
}
{
if (range_check != current_language->la_range_check)
- printf_filtered(
+ printf(
"Warning: the current range check setting does not match the language.\n");
}
int quietly;
{
/* FIXME: quietly is ignored at the moment. */
- printf_filtered("Current Language: %s\n",language);
+ printf("Current Language: %s\n",language);
show_language_command((char *)0, 1);
- printf_filtered("Type checking: %s\n",type);
+ printf("Type checking: %s\n",type);
show_type_command((char *)0, 1);
- printf_filtered("Range checking: %s\n",range);
+ printf("Range checking: %s\n",range);
show_range_command((char *)0, 1);
}
\f
char *string;
if (type_check==type_check_warn)
- fprintf_filtered(stderr,warning_pre_print);
+ fprintf(stderr,warning_pre_print);
else
target_terminal_ours();
va_start (args);
string = va_arg (args, char *);
- vfprintf_filtered (stderr, string, args);
- fprintf_filtered (stderr, "\n");
+ vfprintf (stderr, string, args);
+ fprintf (stderr, "\n");
va_end (args);
if (type_check==type_check_on)
return_to_top_level();
char *string;
if (range_check==range_check_warn)
- fprintf_filtered(stderr,warning_pre_print);
+ fprintf(stderr,warning_pre_print);
else
target_terminal_ours();
va_start (args);
string = va_arg (args, char *);
- vfprintf_filtered (stderr, string, args);
- fprintf_filtered (stderr, "\n");
+ vfprintf (stderr, string, args);
+ fprintf (stderr, "\n");
va_end (args);
if (range_check==range_check_on)
return_to_top_level();
char *ignore;
int from_tty;
{
- printf_filtered(
+ printf(
"\"set check\" must be followed by the name of a check subcommand.\n");
help_list(setchecklist, "set check ", -1, stdout);
}
{
if (lang->la_magic != LANG_MAGIC)
{
- fprintf_filtered(stderr, "Magic number of %s language struct wrong\n",
+ fprintf(stderr, "Magic number of %s language struct wrong\n",
lang->la_name);
abort();
}
static void
do_nothing PARAMS ((int));
+static int
+quit_cover PARAMS ((char *));
+
static void
disconnect PARAMS ((int));
disconnect (signo)
int signo;
{
- kill_inferior_fast ();
- signal (signo, SIG_DFL);
+ catch_errors (quit_cover, NULL, "Could not kill inferior process");
+ signal (SIGHUP, SIG_DFL);
kill (getpid (), SIGHUP);
}
+
+/* Just a little helper function for disconnect(). */
+
+static int
+quit_cover (s)
+char *s;
+{
+ caution = 0; /* Throw caution to the wind -- we're exiting.
+ This prevents asking the user dumb questions. */
+ quit_command((char *)0, 0);
+ return 0;
+}
\f
/* Clean up on error during a "source" command (or execution of a
user-defined command). */
ADDITIONAL_OPTION_CASES
#endif
case '?':
- fprintf_filtered (stderr,
+ fprintf (stderr,
"Use `%s +help' for a complete list of options.\n",
argv[0]);
exit (1);
corearg = argv[optind];
break;
case 3:
- fprintf_filtered (stderr,
+ fprintf (stderr,
"Excess command line arguments ignored. (%s%s)\n",
argv[optind], (optind == argc - 1) ? "" : " ...");
break;
#else
signal (STOP_SIGNAL, stop_sig);
#endif
- printf_filtered ("%s", prompt);
+ printf ("%s", prompt);
fflush (stdout);
/* Forget about any previous command -- null line now will do nothing. */
if (expanded)
{
/* Print the changes. */
- printf_filtered ("%s\n", history_value);
+ printf ("%s\n", history_value);
/* If there was an error, call this function again. */
if (expanded < 0)
char *arg;
int from_tty;
{
- printf_filtered ("\"info\" must be followed by the name of an info command.\n");
+ printf ("\"info\" must be followed by the name of an info command.\n");
help_list (infolist, "info ", -1, stdout);
}
if (from_tty)
{
- printf_filtered ("Type commands for definition of \"%s\".\n\
+ printf ("Type commands for definition of \"%s\".\n\
End with a line saying just \"end\".\n", comname);
fflush (stdout);
}
error ("Command \"%s\" is built-in.", comname);
if (from_tty)
- printf_filtered ("Type documentation for \"%s\".\n\
+ printf ("Type documentation for \"%s\".\n\
End with a line saying just \"end\".\n", comname);
doclines = read_command_lines ();
static void
print_gnu_advertisement()
{
- printf_filtered ("\
+ printf ("\
GDB is free software and you are welcome to distribute copies of it\n\
under certain conditions; type \"show copying\" to see the conditions.\n\
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
void
print_prompt ()
{
- printf_filtered ("%s", prompt);
+ printf ("%s", prompt);
fflush (stdout);
}
\f
{
if (query ("The program is running. Quit anyway? "))
{
- target_kill ();
+ if (attach_flag)
+ target_detach (args, from_tty);
+ else
+ target_kill ();
}
else
error ("Not confirmed.");
getcwd (dirbuf, sizeof (dirbuf));
if (strcmp (dirbuf, current_directory))
- printf_filtered ("Working directory %s\n (canonically %s).\n",
+ printf ("Working directory %s\n (canonically %s).\n",
current_directory, dirbuf);
else
- printf_filtered ("Working directory %s.\n", current_directory);
+ printf ("Working directory %s.\n", current_directory);
}
static void
char *args;
int from_tty;
{
- printf_filtered ("\"set history\" must be followed by the name of a history subcommand.\n");
+ printf ("\"set history\" must be followed by the name of a history subcommand.\n");
help_list (sethistlist, "set history ", -1, stdout);
}
static int
nomemory PARAMS ((CORE_ADDR, char *, int, int));
+static int
+return_zero PARAMS ((void));
+
static void
ignore PARAMS ((void));
+
static void
target_command PARAMS ((char *, int));
+static struct target_ops *
+find_default_run_target PARAMS ((char *));
+
/* Pointer to array of target architecture structures; the size of the
array; the current index into the array; the allocated size of the
array. */
current target. */
struct target_ops dummy_target = {"None", "None", "",
- 0, 0, 0, 0, /* open, close, attach, detach */
+ 0, 0, /* open, close */
+ find_default_attach, 0, /* attach, detach */
0, 0, /* resume, wait */
0, 0, 0, /* registers */
0, 0, /* memory */
0, 0, 0, 0, 0, /* terminal */
0, 0, /* kill, load */
0, /* lookup_symbol */
- 0, 0, /* create_inferior, mourn_inferior */
+ find_default_create_inferior, /* create_inferior */
+ 0, /* mourn_inferior */
+ 0, /* can_run */
dummy_stratum, 0, /* stratum, next */
0, 0, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
char *arg;
int from_tty;
{
- fputs_filtered ("Argument required (target name).\n", stdout);
+ fputs_filtered ("Argument required (target name). Try `help target'\n",
+ stdout);
}
/* Add a possible target architecture to the list. */
{
if (t->to_magic != OPS_MAGIC)
{
- fprintf_filtered(stderr, "Magic number of %s target struct wrong\n",
+ fprintf(stderr, "Magic number of %s target struct wrong\n",
t->to_shortname);
abort();
}
char *args;
int from_tty;
{
- printf_filtered("No saved terminal information.\n");
+ printf("No saved terminal information.\n");
}
#if 0
{
if (target_has_execution)
{
- printf_filtered ("You are already running a program:\n");
+ printf ("You are already running a program:\n");
target_files_info ();
if (query ("Kill it? ")) {
target_kill ();
the struct definition, but not all the places that initialize one. */
if (t->to_magic != OPS_MAGIC)
{
- fprintf_filtered(stderr, "Magic number of %s target struct wrong\n",
+ fprintf(stderr, "Magic number of %s target struct wrong\n",
t->to_shortname);
abort();
}
de_fault (to_lookup_symbol, nosymbol);
de_fault (to_create_inferior, maybe_kill_then_create_inferior);
de_fault (to_mourn_inferior, (void (*)())noprocess);
+ de_fault (to_can_run, return_zero);
de_fault (to_next, 0);
de_fault (to_has_all_memory, 0);
de_fault (to_has_memory, 0);
int has_all_mem = 0;
if (symfile_objfile != NULL)
- printf_filtered ("Symbols from \"%s\".\n", symfile_objfile->name);
+ printf ("Symbols from \"%s\".\n", symfile_objfile->name);
#ifdef FILES_INFO_HOOK
if (FILES_INFO_HOOK ())
if ((int)(t->to_stratum) <= (int)dummy_stratum)
continue;
if (has_all_mem)
- printf_filtered("\tWhile running this, gdb does not access memory from...\n");
- printf_filtered("%s:\n", t->to_longname);
+ printf("\tWhile running this, gdb does not access memory from...\n");
+ printf("%s:\n", t->to_longname);
(t->to_files_info)(t);
has_all_mem = t->to_has_all_memory;
}
}
}
+/* Look through the list of possible targets for a target that can
+ execute a run or attach command without any other data. This is
+ used to locate the default process stratum.
+
+ Result is always valid (error() is called for errors). */
+
+static struct target_ops *
+find_default_run_target (do_mesg)
+ char *do_mesg;
+{
+ struct target_ops **t;
+ struct target_ops *runable;
+ int count;
+
+ count = 0;
+
+ for (t = target_structs; t < target_structs + target_struct_size;
+ ++t)
+ {
+ if (target_can_run(*t))
+ {
+ runable = *t;
+ ++count;
+ }
+ }
+
+ if (count != 1)
+ error ("Don't know how to %s. Try \"help target\".", do_mesg);
+
+ return runable;
+}
+
+void
+find_default_attach (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ struct target_ops *t;
+
+ t = find_default_run_target("attach");
+ (t->to_attach) (args, from_tty);
+ return;
+}
+
+void
+find_default_create_inferior (exec_file, allargs, env)
+ char *exec_file;
+ char *allargs;
+ char **env;
+{
+ struct target_ops *t;
+
+ t = find_default_run_target("run");
+ (t->to_create_inferior) (exec_file, allargs, env);
+ return;
+}
+
+static int
+return_zero ()
+{
+ return 0;
+}
+
static char targ_desc[] =
"Names of targets and files being debugged.\n\
Shows the entire stack of targets currently in use (including the exec-file,\n\