* Use of target_activity_function/target_activity_fd
@ 2008-12-11 13:32 Tristan Gingold
2008-12-11 17:03 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Tristan Gingold @ 2008-12-11 13:32 UTC (permalink / raw)
To: gdb-patches
Hi,
the hook target_activity_function is unused according to grep. Is it
expected or should this unused code
be removed ?
Tristan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use of target_activity_function/target_activity_fd
2008-12-11 13:32 Use of target_activity_function/target_activity_fd Tristan Gingold
@ 2008-12-11 17:03 ` Pedro Alves
2008-12-15 13:43 ` [RFA]: Remove target_activity_function/target_activity_fd Tristan Gingold
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2008-12-11 17:03 UTC (permalink / raw)
To: gdb-patches; +Cc: Tristan Gingold
On Thursday 11 December 2008 13:31:36, Tristan Gingold wrote:
> Hi,
>
> the hook target_activity_function is unused according to grep. Is it
> expected or should this unused code
> be removed ?
I've wondered this myself before. It was added in 94,
Thu May 19 09:56:20 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* target.c, target.h: New variables target_activity_function and
target_activity_fd.
* inflow.c, inferior.h: New functions set_sigio_trap and
clear_sigio_trap.
* inftarg.c (child_wait), procfs.c (wait_fd): Call them.
This was added between GDB 4.9 and 5.0. I don't think code setting
a target_activity_function has ever made it the the public GDB, at least
according to the ChangeLog. 5.0 doesn't have any either, so maybe this
was for some Cygnus customer project; maybe someone that worked
there at the time remembers it. Insight also doesn't make use of it.
In any case, given that at least two people have lost time trying
to understand what good was this for, I say we nuke it, and get rid
of *_sigio_trap in the process as well, which has calls that have been
propagated to several targets by now.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFA]: Remove target_activity_function/target_activity_fd.
2008-12-11 17:03 ` Pedro Alves
@ 2008-12-15 13:43 ` Tristan Gingold
2008-12-15 18:07 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Tristan Gingold @ 2008-12-15 13:43 UTC (permalink / raw)
To: gdb-patches; +Cc: Pedro Alves
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
Hi,
> In any case, given that at least two people have lost time trying
> to understand what good was this for, I say we nuke it, and get rid
> of *_sigio_trap in the process as well, which has calls that have been
> propagated to several targets by now.
the attached patch remove this unused piece of code.
Recompiled on x86/gnu-linux and no more instances found by grep.
Tristan.
2008-12-15 Tristan Gingold <gingold@adacore.com>
* inflow.c: Remove old_sigio, handle_sigio, old_fcntl_flags,
set_sigio_trap, clear_sigio_trap definitions.
* inferior.h: Remove set_sigio_trap and clear_sigio_trap declarations.
* inf-ptrace.c (inf_ptrace_wait): Remove call to set_sigio_trap
and clear_sigio_trap.
* inf-ttrace.c (inf_ttrace_wait): Ditto.
* linux-nat.c (linux_nat_wait): Ditto.
* spu-linux-nat.c (spu_child_wait): Ditto.
* rs6000-nat.c (rs6000_wait): Ditto.
* target.c: Remove target_activity_function and target_activity_fd.
* target.h: Remove target_activity_function and target_activity_fd
declarations.
[-- Attachment #2: sigio.diff --]
[-- Type: application/octet-stream, Size: 7616 bytes --]
? sigio.diff
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.51
diff -u -p -r1.51 inf-ptrace.c
--- inf-ptrace.c 11 Dec 2008 19:19:12 -0000 1.51
+++ inf-ptrace.c 15 Dec 2008 13:28:44 -0000
@@ -389,7 +389,6 @@ inf_ptrace_wait (ptid_t ptid, struct tar
do
{
set_sigint_trap ();
- set_sigio_trap ();
do
{
@@ -398,7 +397,6 @@ inf_ptrace_wait (ptid_t ptid, struct tar
}
while (pid == -1 && errno == EINTR);
- clear_sigio_trap ();
clear_sigint_trap ();
if (pid == -1)
Index: inf-ttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
retrieving revision 1.38
diff -u -p -r1.38 inf-ttrace.c
--- inf-ttrace.c 9 Nov 2008 11:27:17 -0000 1.38
+++ inf-ttrace.c 15 Dec 2008 13:28:45 -0000
@@ -930,7 +930,6 @@ inf_ttrace_wait (ptid_t ptid, struct tar
do
{
set_sigint_trap ();
- set_sigio_trap ();
if (ttrace_wait (pid, lwpid, TTRACE_WAITOK, &tts, sizeof tts) == -1)
perror_with_name (("ttrace_wait"));
@@ -949,7 +948,6 @@ inf_ttrace_wait (ptid_t ptid, struct tar
tts.tts_event = TTEVT_NONE;
}
- clear_sigio_trap ();
clear_sigint_trap ();
}
while (tts.tts_event == TTEVT_NONE);
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.116
diff -u -p -r1.116 inferior.h
--- inferior.h 20 Nov 2008 00:35:23 -0000 1.116
+++ inferior.h 15 Dec 2008 13:28:45 -0000
@@ -97,10 +97,6 @@ extern void set_sigint_trap (void);
extern void clear_sigint_trap (void);
-extern void set_sigio_trap (void);
-
-extern void clear_sigio_trap (void);
-
/* Set/get file name for default use for standard in/out in the inferior. */
extern void set_inferior_io_terminal (const char *terminal_name);
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.43
diff -u -p -r1.43 inflow.c
--- inflow.c 27 Oct 2008 22:37:20 -0000 1.43
+++ inflow.c 15 Dec 2008 13:28:45 -0000
@@ -651,68 +651,6 @@ clear_sigint_trap (void)
}
}
\f
-#if defined (SIGIO) && defined (FASYNC) && defined (FD_SET) && defined (F_SETOWN)
-static void (*old_sigio) ();
-
-static void
-handle_sigio (int signo)
-{
- int numfds;
- fd_set readfds;
-
- signal (SIGIO, handle_sigio);
-
- FD_ZERO (&readfds);
- FD_SET (target_activity_fd, &readfds);
- numfds = gdb_select (target_activity_fd + 1, &readfds, NULL, NULL, NULL);
- if (numfds >= 0 && FD_ISSET (target_activity_fd, &readfds))
- {
-#ifndef _WIN32
- if ((*target_activity_function) ())
- kill (PIDGET (inferior_ptid), SIGINT);
-#endif
- }
-}
-
-static int old_fcntl_flags;
-
-void
-set_sigio_trap (void)
-{
- if (target_activity_function)
- {
- old_sigio = (void (*)()) signal (SIGIO, handle_sigio);
- fcntl (target_activity_fd, F_SETOWN, getpid ());
- old_fcntl_flags = fcntl (target_activity_fd, F_GETFL, 0);
- fcntl (target_activity_fd, F_SETFL, old_fcntl_flags | FASYNC);
- }
-}
-
-void
-clear_sigio_trap (void)
-{
- if (target_activity_function)
- {
- signal (SIGIO, old_sigio);
- fcntl (target_activity_fd, F_SETFL, old_fcntl_flags);
- }
-}
-#else /* No SIGIO. */
-void
-set_sigio_trap (void)
-{
- if (target_activity_function)
- internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
-}
-
-void
-clear_sigio_trap (void)
-{
- if (target_activity_function)
- internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
-}
-#endif /* No SIGIO. */
-\f
/* Create a new session if the inferior will run in a different tty.
A session is UNIX's way of grouping processes that share a controlling
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.111
diff -u -p -r1.111 linux-nat.c
--- linux-nat.c 2 Dec 2008 07:57:36 -0000 1.111
+++ linux-nat.c 15 Dec 2008 13:28:45 -0000
@@ -2868,7 +2868,6 @@ retry:
{
/* Causes SIGINT to be passed on to the attached process. */
set_sigint_trap ();
- set_sigio_trap ();
}
while (status == 0)
@@ -2937,10 +2936,7 @@ retry:
}
if (!target_can_async_p ())
- {
- clear_sigio_trap ();
- clear_sigint_trap ();
- }
+ clear_sigint_trap ();
gdb_assert (lp);
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.82
diff -u -p -r1.82 rs6000-nat.c
--- rs6000-nat.c 11 Dec 2008 19:19:12 -0000 1.82
+++ rs6000-nat.c 15 Dec 2008 13:28:45 -0000
@@ -525,7 +525,6 @@ rs6000_wait (ptid_t ptid, struct target_
do
{
set_sigint_trap ();
- set_sigio_trap ();
do
{
@@ -534,7 +533,6 @@ rs6000_wait (ptid_t ptid, struct target_
}
while (pid == -1 && errno == EINTR);
- clear_sigio_trap ();
clear_sigint_trap ();
if (pid == -1)
Index: spu-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-linux-nat.c,v
retrieving revision 1.15
diff -u -p -r1.15 spu-linux-nat.c
--- spu-linux-nat.c 11 Dec 2008 19:19:12 -0000 1.15
+++ spu-linux-nat.c 15 Dec 2008 13:28:45 -0000
@@ -414,7 +414,6 @@ spu_child_wait (ptid_t ptid, struct targ
{
set_sigint_trap (); /* Causes SIGINT to be passed on to the
attached process. */
- set_sigio_trap ();
pid = waitpid (PIDGET (ptid), &status, 0);
if (pid == -1 && errno == ECHILD)
@@ -431,7 +430,6 @@ spu_child_wait (ptid_t ptid, struct targ
save_errno = EINTR;
}
- clear_sigio_trap ();
clear_sigint_trap ();
}
while (pid == -1 && save_errno == EINTR);
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.192
diff -u -p -r1.192 target.c
--- target.c 2 Dec 2008 07:57:36 -0000 1.192
+++ target.c 15 Dec 2008 13:28:46 -0000
@@ -2475,10 +2475,6 @@ store_waitstatus (struct target_waitstat
}
}
\f
-/* Returns zero to leave the inferior alone, one to interrupt it. */
-int (*target_activity_function) (void);
-int target_activity_fd;
-\f
/* Convert a normal process ID to a string. Returns the string in a
static buffer. */
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.137
diff -u -p -r1.137 target.h
--- target.h 2 Dec 2008 15:52:15 -0000 1.137
+++ target.h 15 Dec 2008 13:28:46 -0000
@@ -299,15 +299,6 @@ extern void get_target_memory (struct ta
extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
CORE_ADDR addr, int len);
\f
-
-/* If certain kinds of activity happen, target_wait should perform
- callbacks. */
-/* Right now we just call (*TARGET_ACTIVITY_FUNCTION) if I/O is possible
- on TARGET_ACTIVITY_FD. */
-extern int target_activity_fd;
-/* Returns zero to leave the inferior alone, one to interrupt it. */
-extern int (*target_activity_function) (void);
-\f
struct thread_info; /* fwd decl for parameter list below: */
struct target_ops
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA]: Remove target_activity_function/target_activity_fd.
2008-12-15 13:43 ` [RFA]: Remove target_activity_function/target_activity_fd Tristan Gingold
@ 2008-12-15 18:07 ` Pedro Alves
2008-12-16 11:30 ` Tristan Gingold
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2008-12-15 18:07 UTC (permalink / raw)
To: gdb-patches; +Cc: Tristan Gingold
On Monday 15 December 2008 13:43:03, Tristan Gingold wrote:
> 2008-12-15 Tristan Gingold <gingold@adacore.com>
>
> * inflow.c: Remove old_sigio, handle_sigio, old_fcntl_flags,
> set_sigio_trap, clear_sigio_trap definitions.
> * inferior.h: Remove set_sigio_trap and clear_sigio_trap declarations.
> * inf-ptrace.c (inf_ptrace_wait): Remove call to set_sigio_trap
> and clear_sigio_trap.
> * inf-ttrace.c (inf_ttrace_wait): Ditto.
> * linux-nat.c (linux_nat_wait): Ditto.
> * spu-linux-nat.c (spu_child_wait): Ditto.
> * rs6000-nat.c (rs6000_wait): Ditto.
> * target.c: Remove target_activity_function and target_activity_fd.
> * target.h: Remove target_activity_function and target_activity_fd
> declarations.
Ok.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA]: Remove target_activity_function/target_activity_fd.
2008-12-15 18:07 ` Pedro Alves
@ 2008-12-16 11:30 ` Tristan Gingold
0 siblings, 0 replies; 5+ messages in thread
From: Tristan Gingold @ 2008-12-16 11:30 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Dec 15, 2008, at 7:06 PM, Pedro Alves wrote:
> On Monday 15 December 2008 13:43:03, Tristan Gingold wrote:
>
>> 2008-12-15 Tristan Gingold <gingold@adacore.com>
>>
>> * inflow.c: Remove old_sigio, handle_sigio, old_fcntl_flags,
>> set_sigio_trap, clear_sigio_trap definitions.
>> * inferior.h: Remove set_sigio_trap and clear_sigio_trap
>> declarations.
>> * inf-ptrace.c (inf_ptrace_wait): Remove call to set_sigio_trap
>> and clear_sigio_trap.
>> * inf-ttrace.c (inf_ttrace_wait): Ditto.
>> * linux-nat.c (linux_nat_wait): Ditto.
>> * spu-linux-nat.c (spu_child_wait): Ditto.
>> * rs6000-nat.c (rs6000_wait): Ditto.
>> * target.c: Remove target_activity_function and target_activity_fd.
>> * target.h: Remove target_activity_function and target_activity_fd
>> declarations.
>
> Ok.
Thanks, committed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-12-16 11:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-11 13:32 Use of target_activity_function/target_activity_fd Tristan Gingold
2008-12-11 17:03 ` Pedro Alves
2008-12-15 13:43 ` [RFA]: Remove target_activity_function/target_activity_fd Tristan Gingold
2008-12-15 18:07 ` Pedro Alves
2008-12-16 11:30 ` Tristan Gingold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox