This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [PATCH]: minor fix for async
- To: Michael Snyder <msnyder at cygnus dot com>
- Subject: Re: [PATCH]: minor fix for async
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Wed, 29 Mar 2000 17:47:34 -0500 (EST)
- Cc: gdb-patches at sourceware dot cygnus dot com, ezannoni at cygnus dot com
- References: <200003240034.QAA20870@cleaver.cygnus.com>
Michael, sorry I forgot to reply to this. Go ahead and check it in,
modulus the capitalization of the sentences in the ChangeLog.
Elena
Michael Snyder writes:
>
> I'd like to suggest this change, replacing a void pointer field
> (which is sometimes used to hold an integer) with a union.
> This will prevent problems on hosts where an integer and a pointer
> are not the same size.
>
> 2000-03-23 Michael Snyder <msnyder@seadog.cygnus.com>
>
> * defs.h (struct continuation_arg): make 'data' a union, to avoid
> casting problems when int and pointer are not the same size.
> event-top.c (command_handler): use data as a union.
> (command_line_handler_continuation): ditto.
> * infcmd.c (step_1_continuation): use data as a union.
> (step_once): ditto. (finish_command_continuation): ditto.
> (finish_command): ditto.
> * breakpoint.c (until_break_command): use data as a union.
> (until_break_command_continuation): ditto.
> * utils.c (add_intermediate_continuation): fix typo in comment.
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/ChangeLog,v
> retrieving revision 1.170
> diff -c -r1.170 ChangeLog
> *** ChangeLog 2000/03/23 23:43:19 1.170
> --- ChangeLog 2000/03/24 00:14:45
> ***************
> *** 1,3 ****
> --- 1,16 ----
> + 2000-03-23 Michael Snyder <msnyder@seadog.cygnus.com>
> +
> + * defs.h (struct continuation_arg): make 'data' a union, to avoid
> + casting problems when int and pointer are not the same size.
> + * event-top.c (command_handler): use data as a union.
> + (command_line_handler_continuation): ditto.
> + * infcmd.c (step_1_continuation): use data as a union.
> + (step_once): ditto. (finish_command_continuation): ditto.
> + (finish_command): ditto.
> + * breakpoint.c (until_break_command): use data as a union.
> + (until_break_command_continuation): ditto.
> + * utils.c (add_intermediate_continuation): fix typo in comment.
> +
> 2000-03-23 Fernando Nasser <fnasser@cygnus.com>
>
> From David Whedon <dwhedon@gordian.com>
> Index: defs.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/defs.h,v
> retrieving revision 1.12
> diff -c -r1.12 defs.h
> *** defs.h 2000/03/14 02:37:25 1.12
> --- defs.h 2000/03/24 00:14:45
> ***************
> *** 650,656 ****
> struct continuation_arg
> {
> struct continuation_arg *next;
> ! void *data;
> };
>
> struct continuation
> --- 650,660 ----
> struct continuation_arg
> {
> struct continuation_arg *next;
> ! union continuation_data {
> ! void *pointer;
> ! int integer;
> ! long longint;
> ! } data;
> };
>
> struct continuation
> Index: event-top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/event-top.c,v
> retrieving revision 1.4
> diff -c -r1.4 event-top.c
> *** event-top.c 2000/03/19 12:30:38 1.4
> --- event-top.c 2000/03/24 00:14:45
> ***************
> *** 525,532 ****
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> arg1->next = arg2;
> arg2->next = NULL;
> ! arg1->data = (void *) time_at_cmd_start;
> ! arg2->data = (void *) space_at_cmd_start;
> add_continuation (command_line_handler_continuation, arg1);
> }
>
> --- 525,532 ----
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> arg1->next = arg2;
> arg2->next = NULL;
> ! arg1->data.integer = time_at_cmd_start;
> ! arg2->data.integer = space_at_cmd_start;
> add_continuation (command_line_handler_continuation, arg1);
> }
>
> ***************
> *** 572,579 ****
> extern int display_time;
> extern int display_space;
>
> ! long time_at_cmd_start = (long) arg->data;
> ! long space_at_cmd_start = (long) arg->next->data;
>
> bpstat_do_actions (&stop_bpstat);
> /*do_cleanups (old_chain); *//*?????FIXME????? */
> --- 572,579 ----
> extern int display_time;
> extern int display_space;
>
> ! long time_at_cmd_start = arg->data.longint;
> ! long space_at_cmd_start = arg->next->data.longint;
>
> bpstat_do_actions (&stop_bpstat);
> /*do_cleanups (old_chain); *//*?????FIXME????? */
> Index: infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.2
> diff -c -r1.2 infcmd.c
> *** infcmd.c 2000/02/23 15:53:33 1.2
> --- infcmd.c 2000/03/24 00:14:45
> ***************
> *** 576,602 ****
> step_1_continuation (arg)
> struct continuation_arg *arg;
> {
> ! int count;
> ! int skip_subroutines;
> ! int single_inst;
> !
> ! skip_subroutines = (int) arg->data;
> ! single_inst = (int) (arg->next)->data;
> ! count = (int) ((arg->next)->next)->data;
> !
> ! if (stop_step)
> ! {
> ! /* FIXME: On nexti, this may have already been done (when we hit the
> ! step resume break, I think). Probably this should be moved to
> ! wait_for_inferior (near the top). */
> #if defined (SHIFT_INST_REGS)
> ! SHIFT_INST_REGS ();
> #endif
> ! step_once (skip_subroutines, single_inst, count - 1);
> ! }
> ! else
> ! if (!single_inst || skip_subroutines)
> ! do_exec_cleanups (ALL_CLEANUPS);
> }
>
> /* Do just one step operation. If count >1 we will have to set up a
> --- 576,602 ----
> step_1_continuation (arg)
> struct continuation_arg *arg;
> {
> ! int count;
> ! int skip_subroutines;
> ! int single_inst;
> !
> ! skip_subroutines = arg->data.integer;
> ! single_inst = arg->next->data.integer;
> ! count = arg->next->next->data.integer;
> !
> ! if (stop_step)
> ! {
> ! /* FIXME: On nexti, this may have already been done (when we hit the
> ! step resume break, I think). Probably this should be moved to
> ! wait_for_inferior (near the top). */
> #if defined (SHIFT_INST_REGS)
> ! SHIFT_INST_REGS ();
> #endif
> ! step_once (skip_subroutines, single_inst, count - 1);
> ! }
> ! else
> ! if (!single_inst || skip_subroutines)
> ! do_exec_cleanups (ALL_CLEANUPS);
> }
>
> /* Do just one step operation. If count >1 we will have to set up a
> ***************
> *** 662,672 ****
> arg3 =
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> arg1->next = arg2;
> ! arg1->data = (PTR) skip_subroutines;
> arg2->next = arg3;
> ! arg2->data = (PTR) single_inst;
> arg3->next = NULL;
> ! arg3->data = (PTR) count;
> add_intermediate_continuation (step_1_continuation, arg1);
> proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
> }
> --- 662,672 ----
> arg3 =
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> arg1->next = arg2;
> ! arg1->data.integer = skip_subroutines;
> arg2->next = arg3;
> ! arg2->data.integer = single_inst;
> arg3->next = NULL;
> ! arg3->data.integer = count;
> add_intermediate_continuation (step_1_continuation, arg1);
> proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
> }
> ***************
> *** 1108,1116 ****
> struct breakpoint *breakpoint;
> struct cleanup *cleanups;
>
> ! breakpoint = (struct breakpoint *) arg->data;
> ! function = (struct symbol *) (arg->next)->data;
> ! cleanups = (struct cleanup *) (arg->next->next)->data;
>
> if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
> && function != 0)
> --- 1108,1116 ----
> struct breakpoint *breakpoint;
> struct cleanup *cleanups;
>
> ! breakpoint = (struct breakpoint *) arg->data.pointer;
> ! function = (struct symbol *) arg->next->data.pointer;
> ! cleanups = (struct cleanup *) arg->next->next->data.pointer;
>
> if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
> && function != 0)
> ***************
> *** 1225,1233 ****
> arg1->next = arg2;
> arg2->next = arg3;
> arg3->next = NULL;
> ! arg1->data = (PTR) breakpoint;
> ! arg2->data = (PTR) function;
> ! arg3->data = (PTR) old_chain;
> add_continuation (finish_command_continuation, arg1);
> }
>
> --- 1225,1233 ----
> arg1->next = arg2;
> arg2->next = arg3;
> arg3->next = NULL;
> ! arg1->data.pointer = breakpoint;
> ! arg2->data.pointer = function;
> ! arg3->data.pointer = old_chain;
> add_continuation (finish_command_continuation, arg1);
> }
>
> Index: breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.4
> diff -c -r1.4 breakpoint.c
> *** breakpoint.c 2000/03/21 20:41:39 1.4
> --- breakpoint.c 2000/03/24 00:14:46
> ***************
> *** 5686,5692 ****
> {
> struct cleanup *cleanups;
>
> ! cleanups = (struct cleanup *) arg->data;
> do_exec_cleanups (cleanups);
> }
>
> --- 5686,5692 ----
> {
> struct cleanup *cleanups;
>
> ! cleanups = (struct cleanup *) arg->data.pointer;
> do_exec_cleanups (cleanups);
> }
>
> ***************
> *** 5750,5757 ****
> the exec_cleanup_chain. */
> arg1 =
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> ! arg1->next = NULL;
> ! arg1->data = (PTR) old_chain;
>
> add_continuation (until_break_command_continuation, arg1);
> }
> --- 5750,5757 ----
> the exec_cleanup_chain. */
> arg1 =
> (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
> ! arg1->next = NULL;
> ! arg1->data.pointer = old_chain;
>
> add_continuation (until_break_command_continuation, arg1);
> }
> Index: utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/utils.c,v
> retrieving revision 1.5
> diff -c -r1.5 utils.c
> *** utils.c 2000/03/20 22:15:58 1.5
> --- utils.c 2000/03/24 00:14:46
> ***************
> *** 456,462 ****
> }
> }
>
> ! /* Add a continuation to the continuation list, the gloabl list
> intermediate_continuation. The new continuation will be added at the front.*/
> void
> add_intermediate_continuation (continuation_hook, arg_list)
> --- 456,462 ----
> }
> }
>
> ! /* Add a continuation to the continuation list, the global list
> intermediate_continuation. The new continuation will be added at the front.*/
> void
> add_intermediate_continuation (continuation_hook, arg_list)