Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch 1/3] Code cleanup: inferior_status reordering
@ 2010-11-24  0:41 Jan Kratochvil
  2010-11-24 12:49 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2010-11-24  0:41 UTC (permalink / raw)
  To: gdb-patches

Hello,

this patch just reorders the fields to make it possible in editor to match
struct thread_info and struct inferior which fields are / are not saved.

There is no code change.


Thanks,
Jan


gdb/
2010-11-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* infrun.c (struct inferior_status, save_inferior_status)
	(restore_inferior_status): Group and reorder the fields, comment their
	groups.

--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6160,29 +6160,35 @@ get_inferior_thread_state_regcache (struct inferior_thread_state *inf_state)
 
 /* Session related state for inferior function calls.
    These are the additional bits of state that need to be restored
-   when an inferior function call successfully completes.  */
+   when an inferior function call successfully completes.
+
+   Keep the fields in orded as present in their original structures.  */
 
 struct inferior_status
 {
-  bpstat stop_bpstat;
-  int stop_step;
-  enum stop_stack_kind stop_stack_dummy;
-  int stopped_by_random_signal;
-  int stepping_over_breakpoint;
+  /* Direct copies of the struct thread_info fields:  */
   CORE_ADDR step_range_start;
   CORE_ADDR step_range_end;
   struct frame_id step_frame_id;
   struct frame_id step_stack_frame_id;
+  int stepping_over_breakpoint;
+  int proceed_to_finish;
+  int in_infcall;
   enum step_over_calls_kind step_over_calls;
+  int stop_step;
+  bpstat stop_bpstat;
+
+  /* Direct copies of the struct inferior fields:  */
+  int stop_soon;
+
+  /* Other fields:  */
+  enum stop_stack_kind stop_stack_dummy;
+  int stopped_by_random_signal;
   CORE_ADDR step_resume_break_address;
   int stop_after_trap;
-  int stop_soon;
 
   /* ID if the selected frame when the inferior function call was made.  */
   struct frame_id selected_frame_id;
-
-  int proceed_to_finish;
-  int in_infcall;
 };
 
 /* Save all of the information associated with the inferior<==>gdb
@@ -6195,25 +6201,31 @@ save_inferior_status (void)
   struct thread_info *tp = inferior_thread ();
   struct inferior *inf = current_inferior ();
 
-  inf_status->stop_step = tp->stop_step;
-  inf_status->stop_stack_dummy = stop_stack_dummy;
-  inf_status->stopped_by_random_signal = stopped_by_random_signal;
-  inf_status->stepping_over_breakpoint = tp->trap_expected;
+  /* Direct copies of the struct thread_info fields:  */
   inf_status->step_range_start = tp->step_range_start;
   inf_status->step_range_end = tp->step_range_end;
   inf_status->step_frame_id = tp->step_frame_id;
   inf_status->step_stack_frame_id = tp->step_stack_frame_id;
+  inf_status->stepping_over_breakpoint = tp->trap_expected;
+  inf_status->proceed_to_finish = tp->proceed_to_finish;
+  inf_status->in_infcall = tp->in_infcall;
   inf_status->step_over_calls = tp->step_over_calls;
-  inf_status->stop_after_trap = stop_after_trap;
-  inf_status->stop_soon = inf->stop_soon;
+  inf_status->stop_step = tp->stop_step;
+
   /* Save original bpstat chain here; replace it with copy of chain.
      If caller's caller is walking the chain, they'll be happier if we
      hand them back the original chain when restore_inferior_status is
      called.  */
   inf_status->stop_bpstat = tp->stop_bpstat;
   tp->stop_bpstat = bpstat_copy (tp->stop_bpstat);
-  inf_status->proceed_to_finish = tp->proceed_to_finish;
-  inf_status->in_infcall = tp->in_infcall;
+
+  /* Direct copies of the struct inferior fields:  */
+  inf_status->stop_soon = inf->stop_soon;
+
+  /* Other fields:  */
+  inf_status->stop_stack_dummy = stop_stack_dummy;
+  inf_status->stopped_by_random_signal = stopped_by_random_signal;
+  inf_status->stop_after_trap = stop_after_trap;
 
   inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
 
@@ -6249,22 +6261,29 @@ restore_inferior_status (struct inferior_status *inf_status)
   struct thread_info *tp = inferior_thread ();
   struct inferior *inf = current_inferior ();
 
-  tp->stop_step = inf_status->stop_step;
-  stop_stack_dummy = inf_status->stop_stack_dummy;
-  stopped_by_random_signal = inf_status->stopped_by_random_signal;
-  tp->trap_expected = inf_status->stepping_over_breakpoint;
+  /* Direct copies of the struct thread_info fields:  */
   tp->step_range_start = inf_status->step_range_start;
   tp->step_range_end = inf_status->step_range_end;
   tp->step_frame_id = inf_status->step_frame_id;
   tp->step_stack_frame_id = inf_status->step_stack_frame_id;
+  tp->trap_expected = inf_status->stepping_over_breakpoint;
+  tp->proceed_to_finish = inf_status->proceed_to_finish;
+  tp->in_infcall = inf_status->in_infcall;
   tp->step_over_calls = inf_status->step_over_calls;
-  stop_after_trap = inf_status->stop_after_trap;
-  inf->stop_soon = inf_status->stop_soon;
+  tp->stop_step = inf_status->stop_step;
+
+  /* Handle the bpstat_copy of the chain.  */
   bpstat_clear (&tp->stop_bpstat);
   tp->stop_bpstat = inf_status->stop_bpstat;
   inf_status->stop_bpstat = NULL;
-  tp->proceed_to_finish = inf_status->proceed_to_finish;
-  tp->in_infcall = inf_status->in_infcall;
+
+  /* Direct copies of the struct inferior fields:  */
+  inf->stop_soon = inf_status->stop_soon;
+
+  /* Other fields:  */
+  stop_stack_dummy = inf_status->stop_stack_dummy;
+  stopped_by_random_signal = inf_status->stopped_by_random_signal;
+  stop_after_trap = inf_status->stop_after_trap;
 
   if (target_has_stack)
     {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/3] Code cleanup: inferior_status reordering
  2010-11-24  0:41 [patch 1/3] Code cleanup: inferior_status reordering Jan Kratochvil
@ 2010-11-24 12:49 ` Pedro Alves
  2010-11-24 19:07   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2010-11-24 12:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Kratochvil

On Wednesday 24 November 2010 00:40:54, Jan Kratochvil wrote:
> Hello,
> 
> this patch just reorders the fields to make it possible in editor to match
> struct thread_info and struct inferior which fields are / are not saved.
> 
> There is no code change.

Somehow I only got this message after reviewing 3/3.

"/me wait, there's a 1/3 and a 2/3?" :-)

In case you were waiting for a comment, both 1/3 and 2/3 look
fine to me too.

Thanks.

> 
> 
> Thanks,
> Jan
> 
> 
> gdb/
> 2010-11-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* infrun.c (struct inferior_status, save_inferior_status)
> 	(restore_inferior_status): Group and reorder the fields, comment their
> 	groups.
> 
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -6160,29 +6160,35 @@ get_inferior_thread_state_regcache (struct inferior_thread_state *inf_state)
>  
>  /* Session related state for inferior function calls.
>     These are the additional bits of state that need to be restored
> -   when an inferior function call successfully completes.  */
> +   when an inferior function call successfully completes.
> +
> +   Keep the fields in orded as present in their original structures.  */
>  
>  struct inferior_status
>  {
> -  bpstat stop_bpstat;
> -  int stop_step;
> -  enum stop_stack_kind stop_stack_dummy;
> -  int stopped_by_random_signal;
> -  int stepping_over_breakpoint;
> +  /* Direct copies of the struct thread_info fields:  */
>    CORE_ADDR step_range_start;
>    CORE_ADDR step_range_end;
>    struct frame_id step_frame_id;
>    struct frame_id step_stack_frame_id;
> +  int stepping_over_breakpoint;
> +  int proceed_to_finish;
> +  int in_infcall;
>    enum step_over_calls_kind step_over_calls;
> +  int stop_step;
> +  bpstat stop_bpstat;
> +
> +  /* Direct copies of the struct inferior fields:  */
> +  int stop_soon;
> +
> +  /* Other fields:  */
> +  enum stop_stack_kind stop_stack_dummy;
> +  int stopped_by_random_signal;
>    CORE_ADDR step_resume_break_address;
>    int stop_after_trap;
> -  int stop_soon;
>  
>    /* ID if the selected frame when the inferior function call was made.  */
>    struct frame_id selected_frame_id;
> -
> -  int proceed_to_finish;
> -  int in_infcall;
>  };
>  
>  /* Save all of the information associated with the inferior<==>gdb
> @@ -6195,25 +6201,31 @@ save_inferior_status (void)
>    struct thread_info *tp = inferior_thread ();
>    struct inferior *inf = current_inferior ();
>  
> -  inf_status->stop_step = tp->stop_step;
> -  inf_status->stop_stack_dummy = stop_stack_dummy;
> -  inf_status->stopped_by_random_signal = stopped_by_random_signal;
> -  inf_status->stepping_over_breakpoint = tp->trap_expected;
> +  /* Direct copies of the struct thread_info fields:  */
>    inf_status->step_range_start = tp->step_range_start;
>    inf_status->step_range_end = tp->step_range_end;
>    inf_status->step_frame_id = tp->step_frame_id;
>    inf_status->step_stack_frame_id = tp->step_stack_frame_id;
> +  inf_status->stepping_over_breakpoint = tp->trap_expected;
> +  inf_status->proceed_to_finish = tp->proceed_to_finish;
> +  inf_status->in_infcall = tp->in_infcall;
>    inf_status->step_over_calls = tp->step_over_calls;
> -  inf_status->stop_after_trap = stop_after_trap;
> -  inf_status->stop_soon = inf->stop_soon;
> +  inf_status->stop_step = tp->stop_step;
> +
>    /* Save original bpstat chain here; replace it with copy of chain.
>       If caller's caller is walking the chain, they'll be happier if we
>       hand them back the original chain when restore_inferior_status is
>       called.  */
>    inf_status->stop_bpstat = tp->stop_bpstat;
>    tp->stop_bpstat = bpstat_copy (tp->stop_bpstat);
> -  inf_status->proceed_to_finish = tp->proceed_to_finish;
> -  inf_status->in_infcall = tp->in_infcall;
> +
> +  /* Direct copies of the struct inferior fields:  */
> +  inf_status->stop_soon = inf->stop_soon;
> +
> +  /* Other fields:  */
> +  inf_status->stop_stack_dummy = stop_stack_dummy;
> +  inf_status->stopped_by_random_signal = stopped_by_random_signal;
> +  inf_status->stop_after_trap = stop_after_trap;
>  
>    inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
>  
> @@ -6249,22 +6261,29 @@ restore_inferior_status (struct inferior_status *inf_status)
>    struct thread_info *tp = inferior_thread ();
>    struct inferior *inf = current_inferior ();
>  
> -  tp->stop_step = inf_status->stop_step;
> -  stop_stack_dummy = inf_status->stop_stack_dummy;
> -  stopped_by_random_signal = inf_status->stopped_by_random_signal;
> -  tp->trap_expected = inf_status->stepping_over_breakpoint;
> +  /* Direct copies of the struct thread_info fields:  */
>    tp->step_range_start = inf_status->step_range_start;
>    tp->step_range_end = inf_status->step_range_end;
>    tp->step_frame_id = inf_status->step_frame_id;
>    tp->step_stack_frame_id = inf_status->step_stack_frame_id;
> +  tp->trap_expected = inf_status->stepping_over_breakpoint;
> +  tp->proceed_to_finish = inf_status->proceed_to_finish;
> +  tp->in_infcall = inf_status->in_infcall;
>    tp->step_over_calls = inf_status->step_over_calls;
> -  stop_after_trap = inf_status->stop_after_trap;
> -  inf->stop_soon = inf_status->stop_soon;
> +  tp->stop_step = inf_status->stop_step;
> +
> +  /* Handle the bpstat_copy of the chain.  */
>    bpstat_clear (&tp->stop_bpstat);
>    tp->stop_bpstat = inf_status->stop_bpstat;
>    inf_status->stop_bpstat = NULL;
> -  tp->proceed_to_finish = inf_status->proceed_to_finish;
> -  tp->in_infcall = inf_status->in_infcall;
> +
> +  /* Direct copies of the struct inferior fields:  */
> +  inf->stop_soon = inf_status->stop_soon;
> +
> +  /* Other fields:  */
> +  stop_stack_dummy = inf_status->stop_stack_dummy;
> +  stopped_by_random_signal = inf_status->stopped_by_random_signal;
> +  stop_after_trap = inf_status->stop_after_trap;
>  
>    if (target_has_stack)
>      {
> 


-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/3] Code cleanup: inferior_status reordering
  2010-11-24 12:49 ` Pedro Alves
@ 2010-11-24 19:07   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2010-11-24 19:07 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wed, 24 Nov 2010 13:48:44 +0100, Pedro Alves wrote:
> In case you were waiting for a comment, both 1/3 and 2/3 look
> fine to me too.

Not strictly waiting but if anyone had some comment.

Checked in:
	http://sourceware.org/ml/gdb-cvs/2010-11/msg00134.html


Thanks,
Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-24 19:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24  0:41 [patch 1/3] Code cleanup: inferior_status reordering Jan Kratochvil
2010-11-24 12:49 ` Pedro Alves
2010-11-24 19:07   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox