Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Remove redundant condition checking.
@ 2013-01-15  9:35 Yao Qi
  2013-01-15 21:19 ` Pedro Alves
  2013-01-15 21:20 ` Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2013-01-15  9:35 UTC (permalink / raw)
  To: gdb-patches

Hi,
Just find here is another redundant checking,

  if (lwp->bp_reinsert != 0) <-- [1]
    {
      if (debug_threads)
	fprintf (stderr, "  pending reinsert at 0x%s\n",
		 paddress (lwp->bp_reinsert));

      if (lwp->bp_reinsert != 0 && can_hardware_single_step ()) <-- [2]

This patch is to remove the redundant one in [2].

gdb/gdbserver:

2013-01-15  Yao Qi  <yao@codesourcery.com>

	* linux-low.c (linux_resume_one_lwp): Don't check
	'(lwp->bp_reinsert != 0'.
---
 gdb/gdbserver/linux-low.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 89988eb..8988509 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -3192,7 +3192,7 @@ linux_resume_one_lwp (struct lwp_info *lwp,
 	fprintf (stderr, "  pending reinsert at 0x%s\n",
 		 paddress (lwp->bp_reinsert));
 
-      if (lwp->bp_reinsert != 0 && can_hardware_single_step ())
+      if (can_hardware_single_step ())
 	{
 	  if (fast_tp_collecting == 0)
 	    {
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] Remove redundant condition checking.
@ 2013-01-15  9:31 Yao Qi
  2013-01-15 14:38 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2013-01-15  9:31 UTC (permalink / raw)
  To: gdb-patches

Hi,
I find a redundant condition checking the infcmd.c:step_once,

      if (!single_inst) <--- [1]
	{
	  CORE_ADDR pc;

	  /* Step at an inlined function behaves like "down".  */
	  if (!skip_subroutines && !single_inst <-- [2]
	      && inline_skipped_frames (inferior_ptid))

The condition '!single_inst' is checked in both [1] and [2], but the
checking in [2] is not necessary.  This patch is to remove the
checking in [2], because I don't see keep it in [2] helps
understanding the code.  It is obvious to me, but the review is still
welcome.

gdb:

2013-01-15  Yao Qi  <yao@codesourcery.com>

	* infcmd.c (step_once): Don't check '!single_inst' as it was
	check before.
---
 gdb/infcmd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 085903d..fb34ae4 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1032,7 +1032,7 @@ step_once (int skip_subroutines, int single_inst, int count, int thread)
 	  CORE_ADDR pc;
 
 	  /* Step at an inlined function behaves like "down".  */
-	  if (!skip_subroutines && !single_inst
+	  if (!skip_subroutines
 	      && inline_skipped_frames (inferior_ptid))
 	    {
 	      ptid_t resume_ptid;
-- 
1.7.7.6


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

end of thread, other threads:[~2013-01-16 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-15  9:35 [PATCH] Remove redundant condition checking Yao Qi
2013-01-15 21:19 ` Pedro Alves
2013-01-15 21:20 ` Pedro Alves
2013-01-16 14:47   ` committed: " Yao Qi
  -- strict thread matches above, loose matches on Subject: below --
2013-01-15  9:31 Yao Qi
2013-01-15 14:38 ` Pedro Alves
2013-01-16 14:48   ` committed: " Yao Qi

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