#include "terminal.h" /* For job_control. */
#include "annotate.h"
#include "top.h"
+#include "version.h"
/* readline include files */
#include <readline/readline.h>
#undef savestring
#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#include "event-loop.h"
+#include "event-top.h"
#include "gdb_string.h"
#include "gdb_stat.h"
#include <ctype.h>
static void source_cleanup PARAMS ((FILE *));
-/* If this definition isn't overridden by the header files, assume
- that isatty and fileno exist on this system. */
-#ifndef ISATTY
-#define ISATTY(FP) (isatty (fileno (FP)))
+/* Default command line prompt. This is overriden in some configs. */
+
+#ifndef DEFAULT_PROMPT
+#define DEFAULT_PROMPT "(gdb) "
#endif
/* Initialization file name for gdb. This is overridden in some configs. */
int use_windows = 1;
-/* Version number of GDB, as a string. */
-
-extern char *version;
-
-/* Canonical host name as a string. */
-
-extern char *host_name;
-
-/* Canonical target name as a string. */
-
-extern char *target_name;
-
extern char lang_frame_mismatch_warn[]; /* language.c */
/* Flag for whether we want all the "from_tty" gubbish printed. */
void (*delete_breakpoint_hook) PARAMS ((struct breakpoint * bpt));
void (*modify_breakpoint_hook) PARAMS ((struct breakpoint * bpt));
+/* Called as appropriate to notify the interface that we have attached
+ to or detached from an already running process. */
+
+void (*attach_hook) PARAMS ((void));
+void (*detach_hook) PARAMS ((void));
+
/* Called during long calculations to allow GUI to repair window damage, and to
check for stop buttons, etc... */
that several registers have changed (see value_assign). */
void (*register_changed_hook) PARAMS ((int regno));
-/* Tell the GUI that the disassembly flavor has changed */
-void (*disassembly_flavor_hook) PARAMS((char *args, int from_tty));
-
/* Tell the GUI someone changed LEN bytes of memory at ADDR */
void (*memory_changed_hook) PARAMS ((CORE_ADDR addr, int len));
loop, but can be caught via catch_errors. */
NORETURN void
- return_to_top_level (reason)
+return_to_top_level (reason)
enum return_reason reason;
{
quit_flag = 0;
disable_current_display ();
do_cleanups (ALL_CLEANUPS);
- if (async_p && target_has_async)
+ if (event_loop_p && target_can_async_p ())
do_exec_cleanups (ALL_CLEANUPS);
+ if (event_loop_p && sync_execution)
+ do_exec_error_cleanups (ALL_CLEANUPS);
if (annotation_level > 1)
switch (reason)
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 (async_p)
+ if (event_loop_p)
async_init_signals ();
else
init_signals ();
/* If the target is running, we allow only a limited set of
commands. */
- if (async_p && target_has_async && target_executing)
+ if (event_loop_p && target_can_async_p () && target_executing)
if (!strcmp (c->name, "help")
&& !strcmp (c->name, "pwd")
&& !strcmp (c->name, "show")
#ifdef STOP_SIGNAL
if (job_control)
{
- if (async_p)
+ if (event_loop_p)
signal (STOP_SIGNAL, handle_stop_sig);
else
signal (STOP_SIGNAL, stop_sig);
{
char *local_prompt;
- if (async_p)
+ if (event_loop_p)
local_prompt = PROMPT (0);
else
local_prompt = gdb_prompt_string;
else
{
if (available >= 16 /*? */ ) /* overflow protect */
- sprintf (outp, "%d", (long) longval);
+ sprintf (outp, "%ld", (long) longval);
}
break;
}
else
{
/* Prompt could not be formatted. */
- if (async_p)
+ if (event_loop_p)
return PROMPT (0);
else
return gdb_prompt_string;
if (prompt != NULL)
free (prompt);
*/
- if (async_p)
+ if (event_loop_p)
PROMPT (0) = savestring (s, strlen (s));
else
gdb_prompt_string = savestring (s, strlen (s));
/* If we are running the asynchronous version,
we initialize the prompts differently. */
- if (!async_p)
+ if (!event_loop_p)
{
-#ifdef DEFAULT_PROMPT
gdb_prompt_string = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
-#else
- gdb_prompt_string = savestring ("(gdb) ", 6);
-#endif
}
else
{
whatever the DEFAULT_PROMPT is. */
the_prompts.top = 0;
PREFIX (0) = "";
-#ifdef DEFAULT_PROMPT
PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
-#else
- PROMPT (0) = savestring ("(gdb) ", 6);
-#endif
SUFFIX (0) = "";
/* Set things up for annotation_level > 1, if the user ever decides
to use it. */
async version is run. NOTE: this difference is going to
disappear as we make the event loop be the default engine of
gdb. */
- if (!async_p)
+ if (!event_loop_p)
{
add_show_from_set
(add_set_cmd ("prompt", class_support, var_string,
/* The set editing command is different depending whether or not the
async version is run. NOTE: this difference is going to disappear
as we make the event loop be the default engine of gdb. */
- if (!async_p)
+ if (!event_loop_p)
{
add_show_from_set
(add_set_cmd ("editing", class_support, var_boolean, (char *) &command_editing_p,
the async version is run. NOTE: this difference is going to
disappear as we make the event loop be the default engine of
gdb. */
- if (!async_p)
+ if (!event_loop_p)
{
c = add_set_cmd ("annotate", class_obscure, var_zinteger,
(char *) &annotation_level, "Set annotation_level.\n\
add_show_from_set (c, &showlist);
c->function.sfunc = set_async_annotation_level;
}
+ if (event_loop_p)
+ {
+ add_show_from_set
+ (add_set_cmd ("exec-done-display", class_support, var_boolean, (char *) &exec_done_display_p,
+ "Set notification of completion for asynchronous execution commands.\n\
+Use \"on\" to enable the notification, and \"off\" to disable it.", &setlist),
+ &showlist);
+ }
}