This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: Remove unused synchronous code



The new event loop has been the default since 1999-06-23.  This is almost 1 1/2 yrs.
This means that if you do not start GDB with "--noasync" you've been using it all along.
The code itself is almost 2 yrs. old and has been proven robust.  It is a nice piece
of code if you haven't had the opportunity to look at it (Elena Zannoni wrote it,
or at least most of it).

It happens that the provisions for fall-back (run synchronously) are getting in the
way, making the code illegible and requiring duplicate efforts (you should still make
sure that the old way works -- have you tested with --noasync after applying your
patches?).

This patch removes the stale (currently unused) non-asynchronous code.

OK to commit?

Fernando



ChangeLog:


        Remove old synchronous command loop that has not been used (as default)
        since 1999-06-23.
        * main.c (event_loop_p): Remove definition.
        (long_options[]): Remove "async" and "noasync" options.
        * defs.h: Remove declaration of event_loop_p.
        * breakpoint.c (until_break_command): Assume event_loop_p true.
        * event-top.c (_initialize_event_loop): Ditto.
        * infcmd.c (run_command, continue_command, step_1, jump_command,
        until_command, finish_command, interrupt_target_command_wrapper): Ditto.        * infrun.c (proceed):
Ditto.
        * remote.c (remote_async_resume, extended_remote_async_create_inferior):        Ditto.
        * top.c (return_to_top_level, gdb_init, execute_command,
        command_line_input, get_prompt_1, get_prompt, set_prompt, init_main):
        Ditto.
        * tracepoint.c (read_actions): Ditto.
        * utils.c (prompt_for_continue): Ditto.
        * mi/mi-main.c (mi_command_loop, _initialize_mi_main): Ditto.



-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.21
diff -c -p -r1.21 breakpoint.c
*** breakpoint.c        2000/12/01 00:41:27     1.21
--- breakpoint.c        2000/12/01 20:47:19
*************** until_break_command (char *arg, int from
*** 5577,5595 ****
  
    breakpoint = set_momentary_breakpoint (sal, selected_frame, bp_until);
  
!   if (!event_loop_p || !target_can_async_p ())
      old_chain = make_cleanup_delete_breakpoint (breakpoint);
    else
      old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
  
!   /* If we are running asynchronously, and the target supports async
!      execution, we are not waiting for the target to stop, in the call
!      tp proceed, below. This means that we cannot delete the
!      brekpoints until the target has actually stopped. The only place
       where we get a chance to do that is in fetch_inferior_event, so
       we must set things up for that. */
  
!   if (event_loop_p && target_can_async_p ())
      {
        /* In this case the arg for the continuation is just the point
           in the exec_cleanups chain from where to start doing
--- 5577,5594 ----
  
    breakpoint = set_momentary_breakpoint (sal, selected_frame, bp_until);
  
!   if (!target_can_async_p ())
      old_chain = make_cleanup_delete_breakpoint (breakpoint);
    else
      old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
  
!   /* If the target supports async execution, we are not waiting for the target
!      to stop, in the call to proceed, below. This means that we cannot delete
!      the brekpoints until the target has actually stopped. The only place
       where we get a chance to do that is in fetch_inferior_event, so
       we must set things up for that. */
  
!   if (target_can_async_p ())
      {
        /* In this case the arg for the continuation is just the point
           in the exec_cleanups chain from where to start doing
*************** until_break_command (char *arg, int from
*** 5610,5625 ****
        sal = find_pc_line (prev_frame->pc, 0);
        sal.pc = prev_frame->pc;
        breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
!       if (!event_loop_p || !target_can_async_p ())
        make_cleanup_delete_breakpoint (breakpoint);
        else
        make_exec_cleanup_delete_breakpoint (breakpoint);
      }
  
    proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
!   /* Do the cleanups now, anly if we are not running asynchronously,
!      of if we are, but the target is still synchronous. */
!   if (!event_loop_p || !target_can_async_p ())
      do_cleanups (old_chain);
  }
  
--- 5609,5623 ----
        sal = find_pc_line (prev_frame->pc, 0);
        sal.pc = prev_frame->pc;
        breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
!       if (!target_can_async_p ())
        make_cleanup_delete_breakpoint (breakpoint);
        else
        make_exec_cleanup_delete_breakpoint (breakpoint);
      }
  
    proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
!   /* Do the cleanups now if the target is still synchronous. */
!   if (!target_can_async_p ())
      do_cleanups (old_chain);
  }
  
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.32
diff -c -p -r1.32 defs.h
*** defs.h      2000/11/20 02:06:18     1.32
--- defs.h      2000/12/01 20:47:20
*************** extern char *interpreter_p;
*** 1160,1169 ****
  struct target_waitstatus;
  struct cmd_list_element;
  
- /* Should the asynchronous variant of the interpreter (using the
-    event-loop) be enabled? */
- extern int event_loop_p;
- 
  extern void (*init_ui_hook) (char *argv0);
  extern void (*command_loop_hook) (void);
  extern void (*show_load_progress) (const char *section,
--- 1160,1165 ----
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.9
diff -c -p -r1.9 event-top.c
*** event-top.c 2000/09/01 23:53:02     1.9
--- event-top.c 2000/12/01 20:47:20
*************** set_async_prompt (char *args, int from_t
*** 1130,1179 ****
  void
  _initialize_event_loop (void)
  {
!   if (event_loop_p)
      {
!       /* If the input stream is connected to a terminal, turn on
!          editing.  */
!       if (ISATTY (instream))
!       {
!         /* Tell gdb that we will be using the readline library. This
!            could be overwritten by a command in .gdbinit like 'set
!            editing on' or 'off'. */
!         async_command_editing_p = 1;
!         
!         /* When a character is detected on instream by select or
!            poll, readline will be invoked via this callback
!            function. */
!         call_readline = rl_callback_read_char_wrapper;
!       }
!       else
!       {
!         async_command_editing_p = 0;
!         call_readline = gdb_readline2;
!       }
  
!       /* When readline has read an end-of-line character, it passes
!          the complete line to gdb for processing. command_line_handler
!          is the function that does this. */
!       input_handler = command_line_handler;
  
!       /* Tell readline to use the same input stream that gdb uses. */
!       rl_instream = instream;
  
!       /* Get a file descriptor for the input stream, so that we can
!          register it with the event loop. */
!       input_fd = fileno (instream);
  
!       /* Tell gdb to use the cli_command_loop as the main loop. */
!       command_loop_hook = cli_command_loop;
  
!       /* Now we need to create the event sources for the input file
!          descriptor. */
!       /* At this point in time, this is the only event source that we
!          register with the even loop. Another source is going to be
!          the target program (inferior), but that must be registered
!          only when it actually exists (I.e. after we say 'run' or
!          after we connect to a remote target. */
!       add_file_handler (input_fd, stdin_event_handler, 0);
!     }
  }
--- 1130,1176 ----
  void
  _initialize_event_loop (void)
  {
!   /* If the input stream is connected to a terminal, turn on
!      editing.  */
!   if (ISATTY (instream))
      {
!       /* Tell gdb that we will be using the readline library. This
!          could be overwritten by a command in .gdbinit like 'set
!          editing on' or 'off'. */
!       async_command_editing_p = 1;
!   
!       /* When a character is detected on instream by select or
!          poll, readline will be invoked via this callback
!          function. */
!       call_readline = rl_callback_read_char_wrapper;
!     }
!   else
!     {
!       async_command_editing_p = 0;
!       call_readline = gdb_readline2;
!     }
  
!   /* When readline has read an end-of-line character, it passes
!      the complete line to gdb for processing. command_line_handler
!      is the function that does this. */
!   input_handler = command_line_handler;
  
!   /* Tell readline to use the same input stream that gdb uses. */
!   rl_instream = instream;
  
!   /* Get a file descriptor for the input stream, so that we can
!   register it with the event loop. */
!   input_fd = fileno (instream);
  
!   /* Tell gdb to use the cli_command_loop as the main loop. */
!   command_loop_hook = cli_command_loop;
  
!   /* Now we need to create the event sources for the input file
!      descriptor. */
!   /* At this point in time, this is the only event source that we
!      register with the even loop. Another source is going to be
!      the target program (inferior), but that must be registered
!      only when it actually exists (I.e. after we say 'run' or
!      after we connect to a remote target. */
!   add_file_handler (input_fd, stdin_event_handler, 0);
  }
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.13
diff -c -p -r1.13 infcmd.c
*** infcmd.c    2000/11/10 19:27:45     1.13
--- infcmd.c    2000/12/01 20:47:20
*************** Start it from the beginning? "))
*** 275,281 ****
  
    if (!args)
      {
!       if (event_loop_p && target_can_async_p ())
        async_disable_stdin ();
      }
    else
--- 275,281 ----
  
    if (!args)
      {
!       if (target_can_async_p ())
        async_disable_stdin ();
      }
    else
*************** Start it from the beginning? "))
*** 285,296 ****
  
        /* If we get a request for running in the bg but the target
           doesn't support it, error out. */
!       if (event_loop_p && async_exec && !target_can_async_p ())
        error ("Asynchronous execution not supported on this target.");
  
        /* If we don't get a request of running in the bg, then we need
           to simulate synchronous (fg) execution. */
!       if (event_loop_p && !async_exec && target_can_async_p ())
        {
          /* Simulate synchronous execution */
          async_disable_stdin ();
--- 285,296 ----
  
        /* If we get a request for running in the bg but the target
           doesn't support it, error out. */
!       if (async_exec && !target_can_async_p ())
        error ("Asynchronous execution not supported on this target.");
  
        /* If we don't get a request of running in the bg, then we need
           to simulate synchronous (fg) execution. */
!       if (!async_exec && target_can_async_p ())
        {
          /* Simulate synchronous execution */
          async_disable_stdin ();
*************** continue_command (char *proc_count_exp, 
*** 352,363 ****
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (event_loop_p && async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (event_loop_p && !async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
--- 352,363 ----
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (!async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
*************** step_1 (int skip_subroutines, int single
*** 450,461 ****
  
    /* If we get a request for running in the bg but the target
       doesn't support it, error out. */
!   if (event_loop_p && async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we don't get a request of running in the bg, then we need
       to simulate synchronous (fg) execution. */
!   if (event_loop_p && !async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
--- 450,461 ----
  
    /* If we get a request for running in the bg but the target
       doesn't support it, error out. */
!   if (async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we don't get a request of running in the bg, then we need
       to simulate synchronous (fg) execution. */
!   if (!async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
*************** step_1 (int skip_subroutines, int single
*** 466,479 ****
    if (!single_inst || skip_subroutines)               /* leave si command alone */
      {
        enable_longjmp_breakpoint ();
!       if (!event_loop_p || !target_can_async_p ())
        cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
        else
          make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
      }
  
    /* In synchronous case, all is well, just use the regular for loop. */
!   if (!event_loop_p || !target_can_async_p ())
      {
        for (; count > 0; count--)
        {
--- 466,479 ----
    if (!single_inst || skip_subroutines)               /* leave si command alone */
      {
        enable_longjmp_breakpoint ();
!       if (!target_can_async_p ())
        cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
        else
          make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
      }
  
    /* In synchronous case, all is well, just use the regular for loop. */
!   if (!target_can_async_p ())
      {
        for (; count > 0; count--)
        {
*************** which has no line number information.\n"
*** 539,545 ****
       and handle them one at the time, through step_once(). */
    else
      {
!       if (event_loop_p && target_can_async_p ())
        step_once (skip_subroutines, single_inst, count);
      }
  }
--- 539,545 ----
       and handle them one at the time, through step_once(). */
    else
      {
!       if (target_can_async_p ())
        step_once (skip_subroutines, single_inst, count);
      }
  }
*************** jump_command (char *arg, int from_tty)
*** 675,686 ****
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (event_loop_p && async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (event_loop_p && !async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
--- 675,686 ----
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (!async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
*************** until_command (char *arg, int from_tty)
*** 983,994 ****
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (event_loop_p && async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (event_loop_p && !async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
--- 983,994 ----
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (!async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
*************** finish_command (char *arg, int from_tty)
*** 1131,1142 ****
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (event_loop_p && async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (event_loop_p && !async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
--- 1131,1142 ----
  
    /* If we must run in the background, but the target can't do it,
       error out. */
!   if (async_exec && !target_can_async_p ())
      error ("Asynchronous execution not supported on this target.");
  
    /* If we are not asked to run in the bg, then prepare to run in the
       foreground, synchronously. */
!   if (!async_exec && target_can_async_p ())
      {
        /* Simulate synchronous execution */
        async_disable_stdin ();
*************** finish_command (char *arg, int from_tty)
*** 1160,1166 ****
  
    breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
  
!   if (!event_loop_p || !target_can_async_p ())
      old_chain = make_cleanup_delete_breakpoint (breakpoint);
    else
      old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
--- 1160,1166 ----
  
    breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
  
!   if (!target_can_async_p ())
      old_chain = make_cleanup_delete_breakpoint (breakpoint);
    else
      old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
*************** finish_command (char *arg, int from_tty)
*** 1177,1187 ****
        print_stack_frame (selected_frame, selected_frame_level, 0);
      }
  
!   /* If running asynchronously and the target support asynchronous
!      execution, set things up for the rest of the finish command to be
!      completed later on, when gdb has detected that the target has
!      stopped, in fetch_inferior_event. */
!   if (event_loop_p && target_can_async_p ())
      {
        arg1 =
        (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
--- 1177,1186 ----
        print_stack_frame (selected_frame, selected_frame_level, 0);
      }
  
!   /* If the target support asynchronous execution, set things up for the rest
!      of the finish command to be completed later on, when gdb has detected that
!      the target has stopped, in fetch_inferior_event. */
!   if (target_can_async_p ())
      {
        arg1 =
        (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
*************** finish_command (char *arg, int from_tty)
*** 1201,1210 ****
    proceed_to_finish = 1;      /* We want stop_registers, please... */
    proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
  
!   /* Do this only if not running asynchronously or if the target
!      cannot do async execution. Otherwise, complete this command when
!      the target actually stops, in fetch_inferior_event. */
!   if (!event_loop_p || !target_can_async_p ())
      {
  
        /* Did we stop at our breakpoint? */
--- 1200,1208 ----
    proceed_to_finish = 1;      /* We want stop_registers, please... */
    proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
  
!   /* Do this only if the target cannot do async execution. Otherwise, complete
!      this command when the target actually stops, in fetch_inferior_event. */
!   if (!target_can_async_p ())
      {
  
        /* Did we stop at our breakpoint? */
*************** interrupt_target_command_wrapper (char *
*** 1744,1750 ****
  static void
  interrupt_target_command (char *args, int from_tty)
  {
!   if (event_loop_p && target_can_async_p ())
      {
        dont_repeat ();         /* Not for the faint of heart */
        target_stop ();
--- 1742,1748 ----
  static void
  interrupt_target_command (char *args, int from_tty)
  {
!   if (target_can_async_p ())
      {
        dont_repeat ();         /* Not for the faint of heart */
        target_stop ();
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.22
diff -c -p -r1.22 infrun.c
*** infrun.c    2000/11/10 19:27:45     1.22
--- infrun.c    2000/12/01 20:47:21
*************** breakpoints and/or watchpoints.\n");
*** 1083,1091 ****
  
    /* Wait for it to stop (if not standalone)
       and in any case decode why it stopped, and act accordingly.  */
!   /* Do this only if we are not using the event loop, or if the target
!      does not support asynchronous execution. */
!   if (!event_loop_p || !target_can_async_p ())
      {
        wait_for_inferior ();
        normal_stop ();
--- 1083,1090 ----
  
    /* Wait for it to stop (if not standalone)
       and in any case decode why it stopped, and act accordingly.  */
!   /* Do this only if the target does not support asynchronous execution. */
!   if (!target_can_async_p ())
      {
        wait_for_inferior ();
        normal_stop ();
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.4
diff -c -p -r1.4 main.c
*** main.c      2000/10/23 22:49:28     1.4
--- main.c      2000/12/01 20:47:22
*************** int display_time;
*** 47,58 ****
  
  int display_space;
  
- /* Whether this is the async version or not.  The async version is
-    invoked on the command line with the -nw --async options.  In this
-    version, the usual command_loop is substituted by and event loop which
-    processes UI events asynchronously. */
- int event_loop_p = 1;
- 
  #ifdef UI_OUT
  /* Has an interpreter been specified and if so, which. */
  char *interpreter_p;
--- 47,52 ----
*************** captured_main (void *data)
*** 223,230 ****
         with no equivalent).  */
      static struct option long_options[] =
      {
-       {"async", no_argument, &event_loop_p, 1},
-       {"noasync", no_argument, &event_loop_p, 0},
  #if defined(TUI)
        {"tui", no_argument, &tui_version, 1},
  #endif
--- 217,222 ----
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.30
diff -c -p -r1.30 remote.c
*** remote.c    2000/11/27 02:18:44     1.30
--- remote.c    2000/12/01 20:47:23
*************** remote_async_resume (int pid, int step, 
*** 2355,2361 ****
    /* FIXME: ezannoni 1999-09-28: We may need to move this out of here
       into infcmd.c in order to allow inferior function calls to work
       NOT asynchronously. */
!   if (event_loop_p && target_can_async_p ())
      target_async (inferior_event_handler, 0);
    /* Tell the world that the target is now executing. */
    /* FIXME: cagney/1999-09-23: Is it the targets responsibility to set
--- 2355,2361 ----
    /* FIXME: ezannoni 1999-09-28: We may need to move this out of here
       into infcmd.c in order to allow inferior function calls to work
       NOT asynchronously. */
!   if (target_can_async_p ())
      target_async (inferior_event_handler, 0);
    /* Tell the world that the target is now executing. */
    /* FIXME: cagney/1999-09-23: Is it the targets responsibility to set
*************** extended_remote_async_create_inferior (c
*** 4177,4183 ****
  
    /* If running asynchronously, register the target file descriptor
       with the event loop. */
!   if (event_loop_p && target_can_async_p ())
      target_async (inferior_event_handler, 0);
  
    /* Now restart the remote server.  */
--- 4177,4183 ----
  
    /* If running asynchronously, register the target file descriptor
       with the event loop. */
!   if (target_can_async_p ())
      target_async (inferior_event_handler, 0);
  
    /* Now restart the remote server.  */
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.24
diff -c -p -r1.24 top.c
*** top.c       2000/12/01 18:01:38     1.24
--- top.c       2000/12/01 20:47:23
*************** return_to_top_level (enum return_reason 
*** 392,400 ****
  
    disable_current_display ();
    do_cleanups (ALL_CLEANUPS);
!   if (event_loop_p && target_can_async_p () && !target_executing)
      do_exec_cleanups (ALL_CLEANUPS);
!   if (event_loop_p && sync_execution)
      do_exec_error_cleanups (ALL_CLEANUPS);
  
    if (annotation_level > 1)
--- 392,400 ----
  
    disable_current_display ();
    do_cleanups (ALL_CLEANUPS);
!   if (target_can_async_p () && !target_executing)
      do_exec_cleanups (ALL_CLEANUPS);
!   if (sync_execution)
      do_exec_error_cleanups (ALL_CLEANUPS);
  
    if (annotation_level > 1)
*************** gdb_init (char *argv0)
*** 686,699 ****
    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
--- 686,692 ----
    init_cli_cmds();
    init_main ();                       /* But that omits this file!  Do it now */
  
!   async_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
*************** extern void serial_log_command (const ch
*** 757,763 ****
  
        /* If the target is running, we allow only a limited set of
           commands. */
!       if (event_loop_p && target_can_async_p () && target_executing)
        if (!strcmp (c->name, "help")
            && !strcmp (c->name, "pwd")
            && !strcmp (c->name, "show")
--- 750,756 ----
  
        /* If the target is running, we allow only a limited set of
           commands. */
!       if (target_can_async_p () && target_executing)
        if (!strcmp (c->name, "help")
            && !strcmp (c->name, "pwd")
            && !strcmp (c->name, "show")
*************** command_line_input (char *prompt_arg, in
*** 1203,1212 ****
  #ifdef STOP_SIGNAL
    if (job_control)
      {
!       if (event_loop_p)
!       signal (STOP_SIGNAL, handle_stop_sig);
!       else
!       signal (STOP_SIGNAL, stop_sig);
      }
  #endif
  
--- 1196,1202 ----
  #ifdef STOP_SIGNAL
    if (job_control)
      {
!       signal (STOP_SIGNAL, handle_stop_sig);
      }
  #endif
  
*************** get_prompt_1 (void *data)
*** 1442,1453 ****
  {
    char *formatted_prompt = data;
    char *local_prompt;
- 
-   if (event_loop_p)
-     local_prompt = PROMPT (0);
-   else
-     local_prompt = gdb_prompt_string;
  
  
    if (gdb_prompt_escape == 0)
      {
--- 1432,1439 ----
  {
    char *formatted_prompt = data;
    char *local_prompt;
  
+   local_prompt = PROMPT (0);
  
    if (gdb_prompt_escape == 0)
      {
*************** get_prompt (void)
*** 1679,1688 ****
    else
      {
        /* Prompt could not be formatted.  */
!       if (event_loop_p)
!       return PROMPT (0);
!       else
!       return gdb_prompt_string;
      }
  }
  
--- 1665,1671 ----
    else
      {
        /* Prompt could not be formatted.  */
!       return PROMPT (0);
      }
  }
  
*************** set_prompt (char *s)
*** 1694,1703 ****
     if (prompt != NULL)
     free (prompt);
   */
!   if (event_loop_p)
!     PROMPT (0) = savestring (s, strlen (s));
!   else
!     gdb_prompt_string = savestring (s, strlen (s));
  }
  
  
--- 1677,1683 ----
     if (prompt != NULL)
     free (prompt);
   */
!   PROMPT (0) = savestring (s, strlen (s));
  }
  
  
*************** init_main (void)
*** 1976,2001 ****
  {
    struct cmd_list_element *c;
  
!   /* If we are running the asynchronous version,
!      we initialize the prompts differently. */
!   if (!event_loop_p)
!     {
!       gdb_prompt_string = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
!     }
!   else
!     {
!       /* initialize the prompt stack to a simple "(gdb) " prompt or to
!          whatever the DEFAULT_PROMPT is. */
!       the_prompts.top = 0;
!       PREFIX (0) = "";
!       PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
!       SUFFIX (0) = "";
!       /* Set things up for annotation_level > 1, if the user ever decides
!          to use it. */
!       async_annotation_suffix = "prompt";
!       /* Set the variable associated with the setshow prompt command. */
!       new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0)));
!     }
    gdb_prompt_escape = 0;      /* default to none.  */
  
    /* Set the important stuff up for command editing.  */
--- 1956,1973 ----
  {
    struct cmd_list_element *c;
  
!   /* initialize the prompt stack to a simple "(gdb) " prompt or to
!      whatever the DEFAULT_PROMPT is. */
!   the_prompts.top = 0;
!   PREFIX (0) = "";
!   PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
!   SUFFIX (0) = "";
!   /* Set things up for annotation_level > 1, if the user ever decides
!      to use it. */
!   async_annotation_suffix = "prompt";
!   /* Set the variable associated with the setshow prompt command. */
!   new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0)));
! 
    gdb_prompt_escape = 0;      /* default to none.  */
  
    /* Set the important stuff up for command editing.  */
*************** init_main (void)
*** 2010,2035 ****
    rl_completer_quote_characters = get_gdb_completer_quote_characters ();
    rl_readline_name = "gdb";
  
!   /* The set prompt 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 (!event_loop_p)
!     {
!       add_show_from_set
!       (add_set_cmd ("prompt", class_support, var_string,
!                     (char *) &gdb_prompt_string, "Set gdb's prompt",
!                     &setlist),
!        &showlist);
!     }
!   else
!     {
!       c = add_set_cmd ("prompt", class_support, var_string,
!                      (char *) &new_async_prompt, "Set gdb's prompt",
!                      &setlist);
!       add_show_from_set (c, &showlist);
!       c->function.sfunc = set_async_prompt;
!     }
  
    add_show_from_set
      (add_set_cmd ("prompt-escape-char", class_support, var_zinteger,
--- 1982,1992 ----
    rl_completer_quote_characters = get_gdb_completer_quote_characters ();
    rl_readline_name = "gdb";
  
!   c = add_set_cmd ("prompt", class_support, var_string,
!                  (char *) &new_async_prompt, "Set gdb's prompt",
!                  &setlist);
!   add_show_from_set (c, &showlist);
!   c->function.sfunc = set_async_prompt;
  
    add_show_from_set
      (add_set_cmd ("prompt-escape-char", class_support, var_zinteger,
*************** init_main (void)
*** 2042,2071 ****
  Primarily used inside of user-defined commands that should not be repeated when\n\
  hitting return.");
  
!   /* 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 (!event_loop_p)
!     {
!       add_show_from_set
!       (add_set_cmd ("editing", class_support, var_boolean, (char *) &command_editing_p,
!                     "Set editing of command lines as they are typed.\n\
! Use \"on\" to enable the editing, and \"off\" to disable it.\n\
! Without an argument, command line editing is enabled.  To edit, use\n\
! EMACS-like or VI-like commands like control-P or ESC.", &setlist),
!        &showlist);
!     }
!   else
!     {
!       c = add_set_cmd ("editing", class_support, var_boolean, (char *) &async_command_editing_p,
!                      "Set editing of command lines as they are typed.\n\
  Use \"on\" to enable the editing, and \"off\" to disable it.\n\
  Without an argument, command line editing is enabled.  To edit, use\n\
  EMACS-like or VI-like commands like control-P or ESC.", &setlist);
  
!       add_show_from_set (c, &showlist);
!       c->function.sfunc = set_async_editing_command;
!     }
  
    add_show_from_set
      (add_set_cmd ("save", no_class, var_boolean, (char *) &write_history_p,
--- 1999,2012 ----
  Primarily used inside of user-defined commands that should not be repeated when\n\
  hitting return.");
  
!   c = add_set_cmd ("editing", class_support, var_boolean, (char *) &async_command_editing_p,
!                  "Set editing of command lines as they are typed.\n\
  Use \"on\" to enable the editing, and \"off\" to disable it.\n\
  Without an argument, command line editing is enabled.  To edit, use\n\
  EMACS-like or VI-like commands like control-P or ESC.", &setlist);
  
!   add_show_from_set (c, &showlist);
!   c->function.sfunc = set_async_editing_command;
  
    add_show_from_set
      (add_set_cmd ("save", no_class, var_boolean, (char *) &write_history_p,
*************** ie. the number of previous commands to k
*** 2093,2127 ****
                  &setlist),
       &showlist);
  
!   /* The set annotate 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 (!event_loop_p)
!     {
!       c = add_set_cmd ("annotate", class_obscure, var_zinteger,
!                      (char *) &annotation_level, "Set annotation_level.\n\
  0 == normal;     1 == fullname (for use when running under emacs)\n\
  2 == output annotated suitably for use by programs that control GDB.",
!                      &setlist);
!       c = add_show_from_set (c, &showlist);
!     }
!   else
!     {
!       c = add_set_cmd ("annotate", class_obscure, var_zinteger,
!                      (char *) &annotation_level, "Set annotation_level.\n\
! 0 == normal;     1 == fullname (for use when running under emacs)\n\
! 2 == output annotated suitably for use by programs that control GDB.",
!                      &setlist);
!       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);
-     }
  }
--- 2034,2050 ----
                  &setlist),
       &showlist);
  
!   c = add_set_cmd ("annotate", class_obscure, var_zinteger,
!                  (char *) &annotation_level, "Set annotation_level.\n\
  0 == normal;     1 == fullname (for use when running under emacs)\n\
  2 == output annotated suitably for use by programs that control GDB.",
!                  &setlist);
!   add_show_from_set (c, &showlist);
!   c->function.sfunc = set_async_annotation_level;
! 
!   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);
  }
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.14
diff -c -p -r1.14 tracepoint.c
*** tracepoint.c        2000/12/01 00:41:27     1.14
--- tracepoint.c        2000/12/01 20:47:24
*************** read_actions (struct tracepoint *t)
*** 816,825 ****
  #ifdef STOP_SIGNAL
    if (job_control)
      {
!       if (event_loop_p)
!       signal (STOP_SIGNAL, handle_stop_sig);
!       else
!       signal (STOP_SIGNAL, stop_sig);
      }
  #endif
    old_chain = make_cleanup_free_actions (t);
--- 816,822 ----
  #ifdef STOP_SIGNAL
    if (job_control)
      {
!       signal (STOP_SIGNAL, handle_stop_sig);
      }
  #endif
    old_chain = make_cleanup_free_actions (t);
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.23
diff -c -p -r1.23 utils.c
*** utils.c     2000/11/20 02:06:19     1.23
--- utils.c     2000/12/01 20:47:24
*************** prompt_for_continue (void)
*** 1631,1640 ****
        ++p;
        if (p[0] == 'q')
        {
!         if (!event_loop_p)
!           request_quit (SIGINT);
!         else
!           async_request_quit (0);
        }
        free (ignore);
      }
--- 1631,1637 ----
        ++p;
        if (p[0] == 'q')
        {
!         async_request_quit (0);
        }
        free (ignore);
      }
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.8
diff -c -p -r1.8 mi-main.c
*** mi-main.c   2000/11/20 02:06:19     1.8
--- mi-main.c   2000/12/01 20:47:25
*************** mi_command_loop (void)
*** 1456,1465 ****
    /* Tell the world that we're alive */
    fputs_unfiltered ("(gdb) \n", raw_stdout);
  
!   if (!event_loop_p)
!     simplified_command_loop (mi_input, mi_execute_command);
!   else
!     start_event_loop ();
  }
  
  static void
--- 1456,1462 ----
    /* Tell the world that we're alive */
    fputs_unfiltered ("(gdb) \n", raw_stdout);
  
!   start_event_loop ();
  }
  
  static void
*************** _initialize_mi_main (void)
*** 1489,1503 ****
        setup_architecture_data ();
        register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
        register_gdbarch_swap (NULL, 0, setup_architecture_data);
!       if (event_loop_p)
!       {
!         /* These overwrite some of the initialization done in
!            _intialize_event_loop. */
!         call_readline = gdb_readline2;
!         input_handler = mi_execute_command_wrapper;
!         add_file_handler (input_fd, stdin_event_handler, 0);
!         async_command_editing_p = 0;
!       }
      }
    /* FIXME: Should we notify main that we are here as a possible
       interpreter? */
--- 1486,1497 ----
        setup_architecture_data ();
        register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
        register_gdbarch_swap (NULL, 0, setup_architecture_data);
!       /* These overwrite some of the initialization done in
!          _intialize_event_loop. */
!       call_readline = gdb_readline2;
!       input_handler = mi_execute_command_wrapper;
!       add_file_handler (input_fd, stdin_event_handler, 0);
!       async_command_editing_p = 0;
      }
    /* FIXME: Should we notify main that we are here as a possible
       interpreter? */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]