This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove redundant condition checking.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]