Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luisgpm@linux.vnet.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] "single step" atomic instruction sequences as a whole.
Date: Thu, 12 Apr 2007 13:30:00 -0000	[thread overview]
Message-ID: <1176384326.4434.28.camel@localhost> (raw)
In-Reply-To: <20070412125850.GA13780@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

The typos were corrected and the gdbarch.[c|h] files were updated with
gdbarch.sh, though the comment was just added to gdbarch.h, not
gdbarch.c, is this correct?

Regards,
Luis

[-- Attachment #2: single_stepping.diff --]
[-- Type: text/x-patch, Size: 15109 bytes --]

2007-04-12  Luis Machado  <luisgpm@br.ibm.com>

	* gdbarch.sh (software_single_step): Change the return type
	from void to int and reformatted some comments to <= 80
	columns.
	* gdbarch.c, gdbarch.h: Regenerated.
	* alpha-tdep.c (alpha_software_single_step): Likewise.
	* alpha-tdep.h (alpha_software_single_step): Likewise.
	* arm-tdep.c (arm_software_single_step): Likewise.
	* cris-tdep.c (cris_software_single_step): Likewise.
	* mips-tdep.c (mips_software_single_step): Likewise.
	* mips-tdep.h (mips_software_single_step): Likewise.
	* rs6000-tdep.c (rs6000_software_single_step): Likewise.
	* rs6000-tdep.h (rs6000_software_single_step): Likewise.
	* sparc-tdep.c (sparc_software_single_step): Likewise.
	* sparc-tdep.h (sparc_software_single_step): Likewise.
	* spu-tdep.c (spu_software_single_step): Likewise.
	* infrun.c (resume): Check the return value from SOFTWARE_SINGLE_STEP
	and act accordingly.

Index: alpha-tdep.c
===================================================================
--- alpha-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ alpha-tdep.c	2007-04-12 06:05:21.000000000 -0700
@@ -1518,7 +1518,7 @@
   return (pc + ALPHA_INSN_SIZE);
 }
 
-void
+int
 alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
   static CORE_ADDR next_pc;
@@ -1536,6 +1536,7 @@
       remove_single_step_breakpoints ();
       write_pc (next_pc);
     }
+  return 1;
 }
 
 \f
Index: alpha-tdep.h
===================================================================
--- alpha-tdep.h.orig	2007-04-12 06:04:10.000000000 -0700
+++ alpha-tdep.h	2007-04-12 06:05:21.000000000 -0700
@@ -107,7 +107,7 @@
 };
 
 extern unsigned int alpha_read_insn (CORE_ADDR pc);
-extern void alpha_software_single_step (enum target_signal, int);
+extern int alpha_software_single_step (enum target_signal, int);
 extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);
 
 extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
Index: arm-tdep.c
===================================================================
--- arm-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ arm-tdep.c	2007-04-12 06:05:21.000000000 -0700
@@ -1907,7 +1907,7 @@
    single_step() is also called just after the inferior stops.  If we
    had set up a simulated single-step, we undo our damage.  */
 
-static void
+static int
 arm_software_single_step (enum target_signal sig, int insert_bpt)
 {
   /* NOTE: This may insert the wrong breakpoint instruction when
@@ -1922,6 +1922,8 @@
     }
   else
     remove_single_step_breakpoints ();
+
+  return 1;
 }
 
 #include "bfd-in2.h"
Index: cris-tdep.c
===================================================================
--- cris-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ cris-tdep.c	2007-04-12 06:05:21.000000000 -0700
@@ -2119,7 +2119,7 @@
    digs through the opcodes in order to find all possible targets. 
    Either one ordinary target or two targets for branches may be found.  */
 
-static void
+static int
 cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
 {
   inst_env_type inst_env;
@@ -2152,6 +2152,8 @@
     }
   else
     remove_single_step_breakpoints ();
+
+  return 1;
 }
 
 /* Calculates the prefix value for quick offset addressing mode.  */
Index: gdbarch.c
===================================================================
--- gdbarch.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ gdbarch.c	2007-04-12 06:12:53.000000000 -0700
@@ -3289,14 +3289,14 @@
   return gdbarch->software_single_step != NULL;
 }
 
-void
+int
 gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->software_single_step != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
-  gdbarch->software_single_step (sig, insert_breakpoints_p);
+  return gdbarch->software_single_step (sig, insert_breakpoints_p);
 }
 
 void
Index: gdbarch.h
===================================================================
--- gdbarch.h.orig	2007-04-12 06:04:10.000000000 -0700
+++ gdbarch.h	2007-04-12 06:15:05.000000000 -0700
@@ -1144,14 +1144,19 @@
 #define SMASH_TEXT_ADDRESS(addr) (gdbarch_smash_text_address (current_gdbarch, addr))
 #endif
 
-/* FIXME/cagney/2001-01-18: This should be split in two.  A target method that indicates if
-   the target needs software single step.  An ISA method to implement it.
+/* FIXME/cagney/2001-01-18: This should be split in two.  A target method that
+   indicates if the target needs software single step.  An ISA method to
+   implement it.
   
-   FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints
-   using the breakpoint system instead of blatting memory directly (as with rs6000).
+   FIXME/cagney/2001-01-18: This should be replaced with something that inserts
+   breakpoints using the breakpoint system instead of blatting memory directly
+   (as with rs6000).
   
-   FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the target can
-   single step.  If not, then implement single step using breakpoints. */
+   FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the
+   target can single step.  If not, then implement single step using breakpoints.
+  
+   A return value of 1 means that the software_single_step breakpoints
+   were inserted; 0 means they were not. */
 
 #if defined (SOFTWARE_SINGLE_STEP)
 /* Legacy for systems yet to multi-arch SOFTWARE_SINGLE_STEP */
@@ -1168,8 +1173,8 @@
 #define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch))
 #endif
 
-typedef void (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p);
-extern void gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p);
+typedef int (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p);
+extern int gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p);
 extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
 #if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP)
 #error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
Index: gdbarch.sh
===================================================================
--- gdbarch.sh.orig	2007-04-12 06:04:10.000000000 -0700
+++ gdbarch.sh	2007-04-12 06:12:32.000000000 -0700
@@ -614,15 +614,22 @@
 # It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
 # ADDR_BITS_REMOVE.
 f:=:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0
-# FIXME/cagney/2001-01-18: This should be split in two.  A target method that indicates if
-# the target needs software single step.  An ISA method to implement it.
+
+# FIXME/cagney/2001-01-18: This should be split in two.  A target method that
+# indicates if the target needs software single step.  An ISA method to
+# implement it.
+#
+# FIXME/cagney/2001-01-18: This should be replaced with something that inserts
+# breakpoints using the breakpoint system instead of blatting memory directly
+# (as with rs6000).
 #
-# FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints
-# using the breakpoint system instead of blatting memory directly (as with rs6000).
+# FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the
+# target can single step.  If not, then implement single step using breakpoints.
 #
-# FIXME/cagney/2001-01-18: The logic is backwards.  It should be asking if the target can
-# single step.  If not, then implement single step using breakpoints.
-F:=:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
+# A return value of 1 means that the software_single_step breakpoints 
+# were inserted; 0 means they were not.
+F:=:int:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
+
 # Return non-zero if the processor is executing a delay slot and a
 # further single-step is needed before the instruction finishes.
 M::int:single_step_through_delay:struct frame_info *frame:frame
Index: infrun.c
===================================================================
--- infrun.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ infrun.c	2007-04-12 06:05:21.000000000 -0700
@@ -548,14 +548,16 @@
   if (SOFTWARE_SINGLE_STEP_P () && step)
     {
       /* Do it the hard way, w/temp breakpoints */
-      SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ );
-      /* ...and don't ask hardware to do it.  */
-      step = 0;
-      /* and do not pull these breakpoints until after a `wait' in
-         `wait_for_inferior' */
-      singlestep_breakpoints_inserted_p = 1;
-      singlestep_ptid = inferior_ptid;
-      singlestep_pc = read_pc ();
+      if (SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ ))
+        {
+          /* ...and don't ask hardware to do it.  */
+          step = 0;
+          /* and do not pull these breakpoints until after a `wait' in
+          `wait_for_inferior' */
+          singlestep_breakpoints_inserted_p = 1;
+          singlestep_ptid = inferior_ptid;
+          singlestep_pc = read_pc ();
+        }
     }
 
   /* If there were any forks/vforks/execs that were caught and are
@@ -1378,7 +1380,7 @@
 					   (LONGEST) ecs->ws.value.integer));
       gdb_flush (gdb_stdout);
       target_mourn_inferior ();
-      singlestep_breakpoints_inserted_p = 0;	/*SOFTWARE_SINGLE_STEP_P() */
+      singlestep_breakpoints_inserted_p = 0;	/* SOFTWARE_SINGLE_STEP_P() */
       stop_print_frame = 0;
       stop_stepping (ecs);
       return;
@@ -1398,7 +1400,7 @@
       target_mourn_inferior ();
 
       print_stop_reason (SIGNAL_EXITED, stop_signal);
-      singlestep_breakpoints_inserted_p = 0;	/*SOFTWARE_SINGLE_STEP_P() */
+      singlestep_breakpoints_inserted_p = 0;	/* SOFTWARE_SINGLE_STEP_P() */
       stop_stepping (ecs);
       return;
 
@@ -1569,7 +1571,7 @@
 	  if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
 	  /* Pull the single step breakpoints out of the target.  */
-	  SOFTWARE_SINGLE_STEP (0, 0);
+	  (void) SOFTWARE_SINGLE_STEP (0, 0);
 	  singlestep_breakpoints_inserted_p = 0;
 
 	  ecs->random_signal = 0;
@@ -1678,7 +1680,7 @@
 	  if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
 	    {
 	      /* Pull the single step breakpoints out of the target. */
-	      SOFTWARE_SINGLE_STEP (0, 0);
+	      (void) SOFTWARE_SINGLE_STEP (0, 0);
 	      singlestep_breakpoints_inserted_p = 0;
 	    }
 
@@ -1749,7 +1751,7 @@
   if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
     {
       /* Pull the single step breakpoints out of the target. */
-      SOFTWARE_SINGLE_STEP (0, 0);
+      (void) SOFTWARE_SINGLE_STEP (0, 0);
       singlestep_breakpoints_inserted_p = 0;
     }
 
Index: mips-tdep.c
===================================================================
--- mips-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ mips-tdep.c	2007-04-12 06:05:21.000000000 -0700
@@ -2204,7 +2204,7 @@
    single_step is also called just after the inferior stops.  If we had
    set up a simulated single-step, we undo our damage.  */
 
-void
+int
 mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
   CORE_ADDR pc, next_pc;
@@ -2218,6 +2218,8 @@
     }
   else
     remove_single_step_breakpoints ();
+
+  return 1;
 }
 
 /* Test whether the PC points to the return instruction at the
Index: mips-tdep.h
===================================================================
--- mips-tdep.h.orig	2007-04-12 06:04:10.000000000 -0700
+++ mips-tdep.h	2007-04-12 06:05:21.000000000 -0700
@@ -100,7 +100,7 @@
 };
 
 /* Single step based on where the current instruction will take us.  */
-extern void mips_software_single_step (enum target_signal, int);
+extern int mips_software_single_step (enum target_signal, int);
 
 /* Tell if the program counter value in MEMADDR is in a MIPS16
    function.  */
Index: rs6000-tdep.h
===================================================================
--- rs6000-tdep.h.orig	2007-04-12 06:04:10.000000000 -0700
+++ rs6000-tdep.h	2007-04-12 06:05:22.000000000 -0700
@@ -21,8 +21,8 @@
 
 #include "defs.h"
 
-extern void rs6000_software_single_step (enum target_signal signal,
-					 int insert_breakpoints_p);
+extern int rs6000_software_single_step (enum target_signal signal,
+                                        int insert_breakpoints_p);
 
 /* Hook in rs6000-tdep.c for determining the TOC address when
    calling functions in the inferior.  */
Index: sparc-tdep.c
===================================================================
--- sparc-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ sparc-tdep.c	2007-04-12 06:05:22.000000000 -0700
@@ -1176,7 +1176,7 @@
   return 0;
 }
 
-void
+int
 sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
   struct gdbarch *arch = current_gdbarch;
@@ -1206,6 +1206,8 @@
     }
   else
     remove_single_step_breakpoints ();
+
+  return 1;
 }
 
 static void
Index: sparc-tdep.h
===================================================================
--- sparc-tdep.h.orig	2007-04-12 06:04:10.000000000 -0700
+++ sparc-tdep.h	2007-04-12 06:05:22.000000000 -0700
@@ -167,8 +167,8 @@
 
 \f
 
-extern void sparc_software_single_step (enum target_signal sig,
-					int insert_breakpoints_p);
+extern int sparc_software_single_step (enum target_signal sig,
+                                       int insert_breakpoints_p);
 
 extern void sparc_supply_rwindow (struct regcache *regcache,
 				  CORE_ADDR sp, int regnum);
Index: rs6000-tdep.c
===================================================================
--- rs6000-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ rs6000-tdep.c	2007-04-12 06:05:22.000000000 -0700
@@ -722,7 +722,7 @@
 
 /* AIX does not support PT_STEP. Simulate it. */
 
-void
+int
 rs6000_software_single_step (enum target_signal signal,
 			     int insert_breakpoints_p)
 {
@@ -761,6 +761,7 @@
 
   errno = 0;			/* FIXME, don't ignore errors! */
   /* What errors?  {read,write}_memory call error().  */
+  return 1;
 }
 
 
Index: spu-tdep.c
===================================================================
--- spu-tdep.c.orig	2007-04-12 06:04:10.000000000 -0700
+++ spu-tdep.c	2007-04-12 06:05:22.000000000 -0700
@@ -1078,7 +1078,7 @@
 
 /* Software single-stepping support.  */
 
-void
+int
 spu_software_single_step (enum target_signal signal, int insert_breakpoints_p)
 {
   if (insert_breakpoints_p)
@@ -1093,7 +1093,7 @@
       pc = extract_unsigned_integer (buf, 4) & -4;
 
       if (target_read_memory (pc, buf, 4))
-	return;
+	return 1;
       insn = extract_unsigned_integer (buf, 4);
 
        /* Next sequential instruction is at PC + 4, except if the current
@@ -1125,6 +1125,8 @@
     }
   else
     remove_single_step_breakpoints ();
+
+  return 1;
 }
 
 

  reply	other threads:[~2007-04-12 13:30 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 22:24 Luis Machado
2007-04-10 20:40 ` Daniel Jacobowitz
2007-04-12 12:09   ` Luis Machado
2007-04-12 12:15     ` Daniel Jacobowitz
2007-04-12 12:54       ` Luis Machado
2007-04-12 12:58         ` Daniel Jacobowitz
2007-04-12 13:30           ` Luis Machado [this message]
2007-04-12 13:35             ` Daniel Jacobowitz
2007-04-12 14:58               ` Ulrich Weigand
2007-04-12 15:33                 ` Daniel Jacobowitz
2007-04-12 17:16                   ` Ulrich Weigand
2007-04-12 18:25                     ` Daniel Jacobowitz
2007-04-12 20:09                       ` Ulrich Weigand
2007-04-12 20:16                         ` Mark Kettenis
2007-04-12 20:43                           ` Ulrich Weigand
2007-04-14 15:20                             ` Mark Kettenis
2007-04-14 18:13                               ` Ulrich Weigand
2007-04-12 20:49                           ` Daniel Jacobowitz
2007-04-12 20:48                         ` Daniel Jacobowitz
2007-04-14 18:50                           ` [commit] Update software_single_step arguments Ulrich Weigand
2007-04-12 14:32     ` [patch] "single step" atomic instruction sequences as a whole Ulrich Weigand
2007-04-12 14:47       ` Luis Machado
2007-04-12 15:00         ` Ulrich Weigand
  -- strict thread matches above, loose matches on Subject: below --
2007-02-17  2:24 Luis Machado
2007-02-27 13:00 ` Emi SUZUKI
2007-02-27 13:17   ` Daniel Jacobowitz
2007-02-28  8:08     ` Emi SUZUKI
2007-02-28 11:46       ` Daniel Jacobowitz
2007-02-28 16:09         ` Luis Machado
2007-03-02 12:47           ` Emi SUZUKI
2007-03-06 11:00             ` Andreas Schwab
2007-03-06 12:24               ` Daniel Jacobowitz
2007-03-08  8:50                 ` Emi SUZUKI
2007-03-08 16:15                   ` Ulrich Weigand
2007-03-13  6:12                     ` SUZUKI Emi
2007-02-06 11:02 Luis Machado
2007-02-06 12:11 ` Emi SUZUKI
2007-02-07 13:10   ` Luis Machado
2007-02-08 13:00     ` Emi SUZUKI
2006-09-18 11:59 emin ak
2006-11-09 13:07 ` [patch] " emin ak
2006-06-22 20:56 PAUL GILLIAM
2006-06-22 21:53 ` PAUL GILLIAM
2006-06-22 22:20   ` PAUL GILLIAM
2006-11-10 21:18 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1176384326.4434.28.camel@localhost \
    --to=luisgpm@linux.vnet.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox