aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-07-15 20:45:32 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-07-15 20:45:32 +0000
commit64cdedadad4b8f7240c555e6944deddc10a2a200 (patch)
tree66b6771a3701e2a5abbb4a710b6a8d17947a562c /gdb/top.c
parent2cd58942b9bf50ccde261085d8a2b3e7ced88e5e (diff)
downloadgdb-64cdedadad4b8f7240c555e6944deddc10a2a200.zip
gdb-64cdedadad4b8f7240c555e6944deddc10a2a200.tar.gz
gdb-64cdedadad4b8f7240c555e6944deddc10a2a200.tar.bz2
2001-07-15 Elena Zannoni <ezannoni@redhat.com>
* top.c (quit_cover, float_handler): Move definition up before use. (gdb_init): Move to end of file, to avoid calls to not yet defined functions. Delete prototypes.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c199
1 files changed, 79 insertions, 120 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 3ebff33..6fc9275 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -73,47 +73,6 @@ extern void execute_user_command (struct cmd_list_element *c, char *args);
extern void do_setshow_command (char *, int, struct cmd_list_element *);
-/* Exported to CLI cli/cli-cmds.c. */
-
-void set_verbose (char *, int, struct cmd_list_element *);
-
-void show_history (char *, int);
-
-void set_history (char *, int);
-
-void show_commands (char *, int);
-
-void do_restore_instream_cleanup (void *stream);
-
-/* Prototypes for local functions */
-
-static void dont_repeat_command (char *, int);
-
-static void init_signals (void);
-
-#ifdef STOP_SIGNAL
-static void stop_sig (int);
-#endif
-
-static void init_main (void);
-
-static void float_handler (int);
-
-static void init_signals (void);
-
-static void set_history_size_command (char *, int, struct cmd_list_element *);
-
-static void do_nothing (int);
-
-#ifdef SIGHUP
-/* NOTE 1999-04-29: This function will be static again, once we modify
- gdb to use the event loop as the default command loop and we merge
- event-top.c into this file, top.c */
-/* static */ int quit_cover (PTR);
-
-static void disconnect (int);
-#endif
-
/* Default command line prompt. This is overriden in some configs. */
#ifndef DEFAULT_PROMPT
@@ -560,15 +519,6 @@ catch_command_errors (catch_command_errors_ftype * command,
/* Handler for SIGHUP. */
#ifdef SIGHUP
-static void
-disconnect (int signo)
-{
- catch_errors (quit_cover, NULL,
- "Could not kill the program being debugged", RETURN_MASK_ALL);
- signal (SIGHUP, SIG_DFL);
- kill (getpid (), SIGHUP);
-}
-
/* Just a little helper function for disconnect(). */
/* NOTE 1999-04-29: This function will be static again, once we modify
@@ -582,6 +532,15 @@ quit_cover (PTR s)
quit_command ((char *) 0, 0);
return 0;
}
+
+static void
+disconnect (int signo)
+{
+ catch_errors (quit_cover, NULL,
+ "Could not kill the program being debugged", RETURN_MASK_ALL);
+ signal (SIGHUP, SIG_DFL);
+ kill (getpid (), SIGHUP);
+}
#endif /* defined SIGHUP */
/* Line number we are currently in in a file which is being sourced. */
@@ -646,67 +605,6 @@ do_chdir_cleanup (void *old_dir)
}
#endif
-void
-gdb_init (char *argv0)
-{
- if (pre_init_ui_hook)
- pre_init_ui_hook ();
-
- /* Run the init function of each source file */
-
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
- current_directory = gdb_dirbuf;
-
-#ifdef __MSDOS__
- /* Make sure we return to the original directory upon exit, come
- what may, since the OS doesn't do that for us. */
- make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
-#endif
-
- init_cmd_lists (); /* This needs to be done first */
- initialize_targets (); /* Setup target_terminal macros for utils.c */
- initialize_utils (); /* Make errors and warnings possible */
- initialize_all_files ();
- initialize_current_architecture ();
- init_cli_cmds();
- init_main (); /* But that omits this file! Do it now */
-
- /* The signal handling mechanism is different depending whether or
- not the async version is run. NOTE: in the future we plan to make
- the event loop be the default engine of gdb, and this difference
- will disappear. */
- if (event_loop_p)
- async_init_signals ();
- else
- init_signals ();
-
- /* We need a default language for parsing expressions, so simple things like
- "set width 0" won't fail if no language is explicitly set in a config file
- or implicitly set by reading an executable during startup. */
- set_language (language_c);
- expected_language = current_language; /* don't warn about the change. */
-
-#ifdef UI_OUT
- /* Install the default UI */
- if (!init_ui_hook)
- {
- uiout = cli_out_new (gdb_stdout);
-
- /* All the interpreters should have had a look at things by now.
- Initialize the selected interpreter. */
- if (interpreter_p)
- {
- fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
- interpreter_p);
- exit (1);
- }
- }
-#endif
-
- if (init_ui_hook)
- init_ui_hook (argv0);
-}
-
/* Execute the line P as a command.
Pass FROM_TTY as second argument to the defining function. */
@@ -1056,6 +954,15 @@ stop_sig (int signo)
/* Initialize signal handlers. */
static void
+float_handler (int signo)
+{
+ /* This message is based on ANSI C, section 4.7. Note that integer
+ divide by zero causes this, so "float" is a misnomer. */
+ signal (SIGFPE, float_handler);
+ error ("Erroneous arithmetic operation.");
+}
+
+static void
do_nothing (int signo)
{
/* Under System V the default disposition of a signal is reinstated after
@@ -1868,15 +1775,6 @@ set_verbose (char *args, int from_tty, struct cmd_list_element *c)
}
}
-static void
-float_handler (int signo)
-{
- /* This message is based on ANSI C, section 4.7. Note that integer
- divide by zero causes this, so "float" is a misnomer. */
- signal (SIGFPE, float_handler);
- error ("Erroneous arithmetic operation.");
-}
-
/* Init the history buffer. Note that we are called after the init file(s)
* have been read so that the user can change the history file via his
* .gdbinit file (for instance). The GDBHISTFILE environment variable
@@ -2075,3 +1973,64 @@ Use \"on\" to enable the notification, and \"off\" to disable it.", &setlist),
&showlist);
}
}
+
+void
+gdb_init (char *argv0)
+{
+ if (pre_init_ui_hook)
+ pre_init_ui_hook ();
+
+ /* Run the init function of each source file */
+
+ getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ current_directory = gdb_dirbuf;
+
+#ifdef __MSDOS__
+ /* Make sure we return to the original directory upon exit, come
+ what may, since the OS doesn't do that for us. */
+ make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
+#endif
+
+ init_cmd_lists (); /* This needs to be done first */
+ initialize_targets (); /* Setup target_terminal macros for utils.c */
+ initialize_utils (); /* Make errors and warnings possible */
+ initialize_all_files ();
+ initialize_current_architecture ();
+ init_cli_cmds();
+ init_main (); /* But that omits this file! Do it now */
+
+ /* The signal handling mechanism is different depending whether or
+ not the async version is run. NOTE: in the future we plan to make
+ the event loop be the default engine of gdb, and this difference
+ will disappear. */
+ if (event_loop_p)
+ async_init_signals ();
+ else
+ init_signals ();
+
+ /* We need a default language for parsing expressions, so simple things like
+ "set width 0" won't fail if no language is explicitly set in a config file
+ or implicitly set by reading an executable during startup. */
+ set_language (language_c);
+ expected_language = current_language; /* don't warn about the change. */
+
+#ifdef UI_OUT
+ /* Install the default UI */
+ if (!init_ui_hook)
+ {
+ uiout = cli_out_new (gdb_stdout);
+
+ /* All the interpreters should have had a look at things by now.
+ Initialize the selected interpreter. */
+ if (interpreter_p)
+ {
+ fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
+ interpreter_p);
+ exit (1);
+ }
+ }
+#endif
+
+ if (init_ui_hook)
+ init_ui_hook (argv0);
+}