aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/language.c28
-rw-r--r--gdb/main.c48
-rw-r--r--gdb/target.c95
4 files changed, 138 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2c80adf..31651c4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+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.
diff --git a/gdb/language.c b/gdb/language.c
index 32ed779..2ecb150 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -156,7 +156,7 @@ set_language_command (ignore, from_tty)
/* 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\
@@ -204,7 +204,7 @@ show_type_command(ignore, from_tty)
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");
}
@@ -250,7 +250,7 @@ show_range_command(ignore, from_tty)
{
if (range_check != current_language->la_range_check)
- printf_filtered(
+ printf(
"Warning: the current range check setting does not match the language.\n");
}
@@ -399,11 +399,11 @@ language_info (quietly)
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);
}
@@ -929,14 +929,14 @@ type_error (va_alist)
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();
@@ -950,14 +950,14 @@ range_error (va_alist)
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();
@@ -986,7 +986,7 @@ set_check (ignore, from_tty)
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);
}
@@ -1007,7 +1007,7 @@ add_language (lang)
{
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();
}
diff --git a/gdb/main.c b/gdb/main.c
index 4b68f7f..825a6b6 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -149,6 +149,9 @@ info_command PARAMS ((char *, int));
static void
do_nothing PARAMS ((int));
+static int
+quit_cover PARAMS ((char *));
+
static void
disconnect PARAMS ((int));
@@ -381,10 +384,22 @@ static void
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;
+}
/* Clean up on error during a "source" command (or execution of a
user-defined command). */
@@ -596,7 +611,7 @@ main (argc, argv)
ADDITIONAL_OPTION_CASES
#endif
case '?':
- fprintf_filtered (stderr,
+ fprintf (stderr,
"Use `%s +help' for a complete list of options.\n",
argv[0]);
exit (1);
@@ -653,7 +668,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
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;
@@ -1302,7 +1317,7 @@ int signo;
#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. */
@@ -1448,7 +1463,7 @@ command_line_input (prrompt, repeat)
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)
@@ -1646,7 +1661,7 @@ info_command (arg, from_tty)
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);
}
@@ -1762,7 +1777,7 @@ define_command (comname, from_tty)
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);
}
@@ -1795,7 +1810,7 @@ document_command (comname, from_tty)
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 ();
@@ -1826,7 +1841,7 @@ End with a line saying just \"end\".\n", comname);
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\
@@ -1859,7 +1874,7 @@ show_version (args, from_tty)
void
print_prompt ()
{
- printf_filtered ("%s", prompt);
+ printf ("%s", prompt);
fflush (stdout);
}
@@ -1872,7 +1887,10 @@ quit_command (args, from_tty)
{
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.");
@@ -1902,10 +1920,10 @@ pwd_command (args, from_tty)
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
@@ -2142,7 +2160,7 @@ set_history (args, from_tty)
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);
}
diff --git a/gdb/target.c b/gdb/target.c
index 667ee65..5af8aae 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -58,11 +58,18 @@ tcomplain PARAMS ((void));
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. */
@@ -76,7 +83,8 @@ unsigned target_struct_allocsize;
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 */
@@ -84,7 +92,9 @@ struct target_ops dummy_target = {"None", "None", "",
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 */
@@ -112,7 +122,8 @@ target_command (arg, from_tty)
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. */
@@ -123,7 +134,7 @@ add_target (t)
{
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();
}
@@ -202,7 +213,7 @@ default_terminal_info (args, from_tty)
char *args;
int from_tty;
{
- printf_filtered("No saved terminal information.\n");
+ printf("No saved terminal information.\n");
}
#if 0
@@ -245,7 +256,7 @@ kill_or_be_killed (from_tty)
{
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 ();
@@ -290,7 +301,7 @@ cleanup_target (t)
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();
}
@@ -323,6 +334,7 @@ cleanup_target (t)
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);
@@ -545,7 +557,7 @@ target_info (args, from_tty)
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 ())
@@ -559,8 +571,8 @@ target_info (args, from_tty)
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;
}
@@ -584,6 +596,69 @@ target_preopen (from_tty)
}
}
+/* 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\