This is the mail archive of the gdb-prs@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]
Other format: [Raw text]

gdb/1422: Solaris only - ^C fails to stop inferior process that was attached


>Number:         1422
>Category:       gdb
>Synopsis:       Solaris only - ^C fails to stop inferior process that was attached
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 18 05:08:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Woody LaRue
>Release:        unknown-1.0
>Organization:
>Environment:
Solaris 7
gdb 5.3  (gdb 6.0 also exhibits this problem).
>Description:
This problem occurs on Solaris.  It does not occur on Linux.

After attaching to a process, ^C fails to interupt the process under debug.
>How-To-Repeat:
Start gdb

(gdb) attach <process-id to debug>
...
...
(gdb) continue
<hit ^C .. process under debug doesn't stop>
>Fix:
Modify the function proc_wait_for_stop as follows

int
proc_wait_for_stop (procinfo *pi)
{
  int win;

  /*
   * We should never have to apply this operation to any procinfo
   * except the one for the main process.  If that ever changes
   * for any reason, then take out the following clause and
   * replace it with one that makes sure the ctl_fd is open.
   */
 
  if (pi->tid != 0)
    pi = find_procinfo_or_die (pi->pid, 0);
#ifdef NEW_PROC_API
  {
    procfs_ctl_t cmd = PCWSTOP;

#if 1
/*
    wwl - 10/16/03 - larue@cadence.com

    This is necessary to fix a bug that is present in gdb 5.x and gdb 6.0
    where you can't ^C back to the gdb prompt.

    This bug only occurs in the following circumstances:
        1) Solaris (doesn't occur on Linux / havent tested on other platforms)
        2) When gdb is 'attached' to the process to be debuged (the
        problem doesn't occur if the target process is started from gdb.)

    The set_sigint_trap()/clear_sigint_trap() was done on linux (in lin-lwp.c) and evidently is need
ed on Solaris as well.  The linux code also contains a set_sigint_trap()/clear_sigint_trap() pair --
 maybe that is needed here as well, but I'm going for the minimum change to fix the ^C bug

*/

    set_sigint_trap();
#endif

    win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));

#if 1
/*  wwl - 10/16/03 comment preceding set_sigint_trap */

    clear_sigint_trap();
#endif

    /* We been runnin' and we stopped -- need to update status.  */
    pi->status_valid = 0;
  }
#else   /* ioctl method */
  win = (ioctl (pi->ctl_fd, PIOCWSTOP, &pi->prstatus) >= 0);
  /* Above call also refreshes the prstatus.  */
  if (win)
    {
      pi->status_valid = 1;
      PROC_PRETTYFPRINT_STATUS (proc_flags (pi),
                                proc_why (pi),
                                proc_what (pi),
                                proc_get_current_thread (pi));
    }
#endif

  return win;
}

>Release-Note:
>Audit-Trail:
>Unformatted:


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