[gnu.gdb.bug] attach/detach supported on HPUX 6.5

daven@HPQTDLJ.SQF.HP.COM (David Newton) (02/07/90)

Gdb 3.3 as distributed does not support the attach command to an executing
process. The following code (copied from sun3-dep.c with slight renaming of
ptrace arguments to match the HP include file) inserted into hp9k320-dep.c
after the code for function "kill-inferior" provides a functioning attach
command.

 | #ifdef ATTACH_DETACH
 | 
 | extern int attach_flag ;
 | 
 | /* Start debugging the process whose number is PID.  */
 | 
 | attach (pid)
 |      int pid;
 | {
 |   errno = 0;
 |   ptrace (PT_ATTACH, pid, 0, 0);
 |   if (errno)
 |     perror_with_name ("ptrace");
 |   attach_flag = 1;
 |   return pid;
 | }
 | 
 | /* Stop debugging the process whose number is PID
 |    and continue it with signal number SIGNAL.
 |    SIGNAL = 0 means just continue it.  */
 | 
 | void
 | detach (signal)
 |      int signal;
 | {
 |   errno = 0;
 |   ptrace (PT_DETACH, inferior_pid, 1, signal);
 |   if (errno)
 |     perror_with_name ("ptrace");
 |   attach_flag = 0;
 | }
 | #endif /* ATTACH_DETACH */


+---------------------------------+----------------------------------+
| David Newton                    | HPDESK: David Newton/HP1400/B1   |
| Hewlett Packard Ltd             | ARPA:   daven@hpsqf.sqf.hp.com   |
| Queensferry Telecomms Division  |                                  |
| South Queensferry               | UUCP:   ..!hplabs!hpsqf!daven    |
| West Lothian                    | JANET:  daven@hpqtdla.hp.co.uk   |
| Scotland EH30 9TG.              | PHONE:  +44-31-331-7234          |
+---------------------------------+----------------------------------+