public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  gdb_7_2-branch: Make tracepoint can trace pseudo register. Add MIPS callbacks.
@ 2010-12-30  7:22 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2010-12-30  7:22 UTC (permalink / raw)
  To: archer-commits

The branch, gdb_7_2-branch has been updated
       via  8f614fc651c3e011de1eecd51df50d71bc664fa4 (commit)
       via  777c51cf21a6b0427af7b2973e7547003f5a704c (commit)
       via  b1d0b932a6bdff50cb8fa913869e6f7fc809b0aa (commit)
       via  7a856fc581a643b0c47febc9bd6de838678c2e85 (commit)
       via  a3c13b53cf75995a19f647e3bccb901540f28c9b (commit)
       via  e2633f0da047b8fbbdc451fc87726a0e3bf4c1c8 (commit)
       via  f4727374fb5f4abaeccaa2cde5beeff10a8d7c8e (commit)
       via  1a8cc6a432b95aa9de46f5d821e2b70285a2c38b (commit)
       via  cc848f61f6187aaf3aba94e9c90d7985ee1246ea (commit)
       via  bc9788d5474406073ee70661c473f89b74b94f9e (commit)
       via  51fbedee86bf577af959c2e0c5c34263078aca0e (commit)
       via  f673c5f9f0ca21173a666ee70561f45a94645e59 (commit)
       via  aed0256b2a147e22e7612fd63d86f6b4559dd19a (commit)
       via  9e92257b2465b2daa0befc87b3a2718fe66dca77 (commit)
       via  dd375b5487287cf6bb4d536901d5a2fb5abd5cd1 (commit)
       via  375a53221d5e58f7413e153d3296f23b65ec8e88 (commit)
       via  267fbe5ac1de448527215e2c1078b3d181bef2cb (commit)
       via  8243ecc04fbacb52e4a80cc0602232da67ca11aa (commit)
       via  8754f553e55dd3ff0aad39ef278f669ae6333187 (commit)
       via  b8c8277a341b9a631ccc15f8c8ee1e0b902cfbb2 (commit)
       via  a343577ce1e18913fb05b594c8fe1f53a1619f03 (commit)
       via  e06aec921c652d0dea02bdcdd40af9a2325e4dc7 (commit)
       via  197f70b2b0d1da5ade9b6aa16fde86fe505da216 (commit)
      from  67d41c5740f9041e3bdffb0b2b33d19a159d5acf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 8f614fc651c3e011de1eecd51df50d71bc664fa4
Author: Hui Zhu <teawater@gmail.com>
Date:   Thu Dec 30 03:17:32 2010 +0000

    Make tracepoint can trace pseudo register.
    Add MIPS callbacks.

commit 777c51cf21a6b0427af7b2973e7547003f5a704c
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Thu Dec 30 00:00:02 2010 +0000

    *** empty log message ***

commit b1d0b932a6bdff50cb8fa913869e6f7fc809b0aa
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Wed Dec 29 00:00:33 2010 +0000

    *** empty log message ***

commit 7a856fc581a643b0c47febc9bd6de838678c2e85
Author: Hui Zhu <teawater@gmail.com>
Date:   Tue Dec 28 02:29:25 2010 +0000

    * mips-tedp.c (mips_register_name): Add comments.

commit a3c13b53cf75995a19f647e3bccb901540f28c9b
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Tue Dec 28 00:00:03 2010 +0000

    *** empty log message ***

commit e2633f0da047b8fbbdc451fc87726a0e3bf4c1c8
Author: Pedro Alves <pedro@codesourcery.com>
Date:   Mon Dec 27 19:53:55 2010 +0000

    	gdb/
    	* breakpoint.c (breakpoint_restore_shadows): When looking for the
    	location with the lowest address that overlaps the memory range we
    	want to restore shadows for, account for multiple locations at the
    	same address.

commit f4727374fb5f4abaeccaa2cde5beeff10a8d7c8e
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Mon Dec 27 00:00:03 2010 +0000

    *** empty log message ***

commit 1a8cc6a432b95aa9de46f5d821e2b70285a2c38b
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Sun Dec 26 00:00:33 2010 +0000

    *** empty log message ***

commit cc848f61f6187aaf3aba94e9c90d7985ee1246ea
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Sat Dec 25 00:00:03 2010 +0000

    *** empty log message ***

commit bc9788d5474406073ee70661c473f89b74b94f9e
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Fri Dec 24 00:00:03 2010 +0000

    *** empty log message ***

commit 51fbedee86bf577af959c2e0c5c34263078aca0e
Author: Joel Brobecker <brobecker@gnat.com>
Date:   Thu Dec 23 04:35:37 2010 +0000

    Add missing _() marker in error message.
    
    gdb/ChangeLog:
    
    	* mi/mi-main.c (mi_cmd_remove_inferior): Use _() marker for error
    	message.  Change spelling of "can not" into "cannot".

commit f673c5f9f0ca21173a666ee70561f45a94645e59
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Thu Dec 23 00:00:04 2010 +0000

    *** empty log message ***

commit aed0256b2a147e22e7612fd63d86f6b4559dd19a
Author: Marc Khouzam <marc.khouzam@ericsson.com>
Date:   Wed Dec 22 18:23:31 2010 +0000

    	* inferior.c (remove_inferior_command): Don't remove an active inferior.
    	* mi/mi-main.c (mi_cmd_remove_inferior): Ditto.

commit 9e92257b2465b2daa0befc87b3a2718fe66dca77
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Wed Dec 22 00:00:04 2010 +0000

    *** empty log message ***

commit dd375b5487287cf6bb4d536901d5a2fb5abd5cd1
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Tue Dec 21 00:00:32 2010 +0000

    *** empty log message ***

commit 375a53221d5e58f7413e153d3296f23b65ec8e88
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Mon Dec 20 00:00:03 2010 +0000

    *** empty log message ***

commit 267fbe5ac1de448527215e2c1078b3d181bef2cb
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Sun Dec 19 00:00:03 2010 +0000

    *** empty log message ***

commit 8243ecc04fbacb52e4a80cc0602232da67ca11aa
Author: Marc Khouzam <marc.khouzam@ericsson.com>
Date:   Sat Dec 18 01:56:06 2010 +0000

    	* mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current inferior.
    	(get_other_inferior): New.

commit 8754f553e55dd3ff0aad39ef278f669ae6333187
Author: Marc Khouzam <marc.khouzam@ericsson.com>
Date:   Sat Dec 18 01:28:06 2010 +0000

    * python/py-progspace.c (py_free_pspace): Obtain arch another
    way to avoid dereferencing a null pointer.

commit b8c8277a341b9a631ccc15f8c8ee1e0b902cfbb2
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Sat Dec 18 00:00:04 2010 +0000

    *** empty log message ***

commit a343577ce1e18913fb05b594c8fe1f53a1619f03
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Fri Dec 17 00:00:03 2010 +0000

    *** empty log message ***

commit e06aec921c652d0dea02bdcdd40af9a2325e4dc7
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Thu Dec 16 00:00:32 2010 +0000

    *** empty log message ***

commit 197f70b2b0d1da5ade9b6aa16fde86fe505da216
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Wed Dec 15 00:00:34 2010 +0000

    *** empty log message ***

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog             |   57 +++++++++++++++++++++++++++++++++
 gdb/ax-gdb.c              |    8 +++--
 gdb/ax-general.c          |   77 +++++++++++++++++++++++++++++++-------------
 gdb/breakpoint.c          |   17 ++++++++++
 gdb/gdbarch.c             |   66 ++++++++++++++++++++++++++++++++++++++
 gdb/gdbarch.h             |   20 ++++++++++++
 gdb/gdbarch.sh            |   10 ++++++
 gdb/inferior.c            |    3 ++
 gdb/mi/mi-main.c          |   31 ++++++++++++++++++
 gdb/mips-tdep.c           |   59 ++++++++++++++++++++++++++++++++++-
 gdb/python/py-progspace.c |    5 +--
 gdb/version.in            |    2 +-
 12 files changed, 324 insertions(+), 31 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ef0b0a7..cb0e021 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,60 @@
+2010-12-30  Hui Zhu  <teawater@gmail.com>
+
+	* ax-gdb.c (gen_expr): Change error message.
+
+2010-12-30  Pedro Alves  <pedro@codesourcery.com>
+
+	* ax-gdb.c (gen_expr) <OP_REGISTER>: Error out if trying to
+	collect a user register.
+
+2010-12-30  Hui Zhu  <teawater@gmail.com>
+
+	* gdbarch.sh (ax_pseudo_register_collect,
+	ax_pseudo_register_push_stack): new callbacks.
+	(agent_expr): Forward declare.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* ax-gdb.c (gen_expr): Remove pseudo-register check code.
+	* ax-general.c (user-regs.h): New include.
+	(ax_reg): Call gdbarch_ax_pseudo_register_push_stack.
+	(ax_reg_mask): Call gdbarch_ax_pseudo_register_collect.
+	* mips-tdep.c (ax.h): New include.
+	(mips_ax_pseudo_register_collect,
+	mips_ax_pseudo_register_push_stack): New functions.
+	(mips_gdbarch_init): Set mips_ax_pseudo_register_collect and
+	mips_ax_pseudo_register_push_stack.
+
+2010-12-28  Kevin Buettner  <kevinb@redhat.com>
+            Hui Zhu  <teawater@gmail.com>
+
+	* mips-tedp.c (mips_register_name): Add comments.
+
+2010-12-27  Pedro Alves  <pedro@codesourcery.com>
+
+	* breakpoint.c (breakpoint_restore_shadows): When looking for the
+	location with the lowest address that overlaps the memory range we
+	want to restore shadows for, account for multiple locations at the
+	same address.
+
+2010-12-23  Joel Brobecker  <brobecker@adacore.com>
+
+	* mi/mi-main.c (mi_cmd_remove_inferior): Use _() marker for error
+	message.  Change spelling of "can not" into "cannot".
+
+2010-12-22  Marc Khouzam  <marc.khouzam@ericsson.com>
+
+	* inferior.c (remove_inferior_command): Don't remove an active inferior.
+	* mi/mi-main.c (mi_cmd_remove_inferior): Ditto.
+
+2010-12-17  Marc Khouzam  <marc.khouzam@ericsson.com>
+
+	* mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current inferior.
+	(get_other_inferior): New.
+
+2010-12-17  Marc Khouzam  <marc.khouzam@ericsson.com>
+
+	* python/py-progspace.c (py_free_pspace): Obtain arch another
+	way to avoid dereferencing a null pointer.
+
 2010-12-12  Stan Shebs  <stan@codesourcery.com>
 
 	* value.c (value_of_internalvar): Add case for trace state
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index e01f359..4941d32 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1978,9 +1978,11 @@ gen_expr (struct expression *exp, union exp_element **pc,
 	if (reg == -1)
 	  internal_error (__FILE__, __LINE__,
 			  _("Register $%s not available"), name);
-	if (reg >= gdbarch_num_regs (exp->gdbarch))
-	  error (_("'%s' is a pseudo-register; "
-		   "GDB cannot yet trace pseudoregister contents."),
+	/* No support for tracing user registers yet.  */
+	if (reg >= gdbarch_num_regs (exp->gdbarch)
+	    + gdbarch_num_pseudo_regs (exp->gdbarch))
+	  error (_("'%s' is a user-register; "
+		   "GDB cannot yet trace user-register contents."),
 		 name);
 	value->kind = axs_lvalue_register;
 	value->u.reg = reg;
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index ab4591f..e1269e6 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -28,6 +28,8 @@
 #include "value.h"
 #include "gdb_string.h"
 
+#include "user-regs.h"
+
 static void grow_expr (struct agent_expr *x, int n);
 
 static void append_const (struct agent_expr *x, LONGEST val, int n);
@@ -272,14 +274,28 @@ ax_const_d (struct agent_expr *x, LONGEST d)
 void
 ax_reg (struct agent_expr *x, int reg)
 {
-  /* Make sure the register number is in range.  */
-  if (reg < 0 || reg > 0xffff)
-    error (_("GDB bug: ax-general.c (ax_reg): register number out of range"));
-  grow_expr (x, 3);
-  x->buf[x->len] = aop_reg;
-  x->buf[x->len + 1] = (reg >> 8) & 0xff;
-  x->buf[x->len + 2] = (reg) & 0xff;
-  x->len += 3;
+  if (reg >= gdbarch_num_regs (x->gdbarch))
+    {
+      /* This is a pseudo-register.  */
+      if (!gdbarch_ax_pseudo_register_push_stack_p (x->gdbarch))
+	error (_("'%s' is a pseudo-register; "
+		 "GDB cannot yet trace its contents."),
+	       user_reg_map_regnum_to_name (x->gdbarch, reg));
+      if (gdbarch_ax_pseudo_register_push_stack (x->gdbarch, x, reg))
+	error (_("Trace '%s' failed."),
+	       user_reg_map_regnum_to_name (x->gdbarch, reg));
+    }
+  else
+    {
+      /* Make sure the register number is in range.  */
+      if (reg < 0 || reg > 0xffff)
+        error (_("GDB bug: ax-general.c (ax_reg): register number out of range"));
+      grow_expr (x, 3);
+      x->buf[x->len] = aop_reg;
+      x->buf[x->len + 1] = (reg >> 8) & 0xff;
+      x->buf[x->len + 2] = (reg) & 0xff;
+      x->len += 3;
+    }
 }
 
 /* Assemble code to operate on a trace state variable.  */
@@ -413,23 +429,38 @@ ax_print (struct ui_file *f, struct agent_expr *x)
 void
 ax_reg_mask (struct agent_expr *ax, int reg)
 {
-  int byte = reg / 8;
-
-  /* Grow the bit mask if necessary.  */
-  if (byte >= ax->reg_mask_len)
+  if (reg >= gdbarch_num_regs (ax->gdbarch))
     {
-      /* It's not appropriate to double here.  This isn't a
-	 string buffer.  */
-      int new_len = byte + 1;
-      unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
-					      new_len * sizeof (ax->reg_mask[0]));
-      memset (new_reg_mask + ax->reg_mask_len, 0,
-	      (new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
-      ax->reg_mask_len = new_len;
-      ax->reg_mask = new_reg_mask;
+      /* This is a pseudo-register.  */
+      if (!gdbarch_ax_pseudo_register_collect_p (ax->gdbarch))
+	error (_("'%s' is a pseudo-register; "
+		 "GDB cannot yet trace its contents."),
+	       user_reg_map_regnum_to_name (ax->gdbarch, reg));
+      if (gdbarch_ax_pseudo_register_collect (ax->gdbarch, ax, reg))
+	error (_("Trace '%s' failed."),
+	       user_reg_map_regnum_to_name (ax->gdbarch, reg));
+    }
+  else
+    {
+      int byte = reg / 8;
+
+      /* Grow the bit mask if necessary.  */
+      if (byte >= ax->reg_mask_len)
+        {
+          /* It's not appropriate to double here.  This isn't a
+	     string buffer.  */
+          int new_len = byte + 1;
+          unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
+					          new_len
+					          * sizeof (ax->reg_mask[0]));
+          memset (new_reg_mask + ax->reg_mask_len, 0,
+	          (new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
+          ax->reg_mask_len = new_len;
+          ax->reg_mask = new_reg_mask;
+        }
+
+      ax->reg_mask[byte] |= 1 << (reg % 8);
     }
-
-  ax->reg_mask[byte] |= 1 << (reg % 8);
 }
 
 /* Given an agent expression AX, fill in requirements and other descriptive
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 484cc37..9e1d6ee 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1138,6 +1138,23 @@ breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len)
 	bc_r = bc;
     }
 
+  /* Due to the binary search above, we need to make sure we pick the
+     first location that's at BC_L's address.  E.g., if there are
+     multiple locations at the same address, BC_L may end up pointing
+     at a duplicate location, and miss the "master"/"inserted"
+     location.  Say, given locations L1, L2 and L3 at addresses A and
+     B:
+
+      L1@A, L2@A, L3@B, ...
+
+     BC_L could end up pointing at location L2, while the "master"
+     location could be L1.  Since the `loc->inserted' flag is only set
+     on "master" locations, we'd forget to restore the shadow of L1
+     and L2.  */
+  while (bc_l > 0
+	 && bp_location[bc_l]->address == bp_location[bc_l - 1]->address)
+    bc_l--;
+
   /* Now do full processing of the found relevant range of elements.  */
 
   for (bc = bc_l; bc < bp_location_count; bc++)
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 103abcb..5c0b75d 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -163,6 +163,8 @@ struct gdbarch
   gdbarch_pseudo_register_write_ftype *pseudo_register_write;
   int num_regs;
   int num_pseudo_regs;
+  gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect;
+  gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack;
   int sp_regnum;
   int pc_regnum;
   int ps_regnum;
@@ -313,6 +315,8 @@ struct gdbarch startup_gdbarch =
   0,  /* pseudo_register_write */
   0,  /* num_regs */
   0,  /* num_pseudo_regs */
+  0,  /* ax_pseudo_register_collect */
+  0,  /* ax_pseudo_register_push_stack */
   -1,  /* sp_regnum */
   -1,  /* pc_regnum */
   -1,  /* ps_regnum */
@@ -592,6 +596,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->num_regs == -1)
     fprintf_unfiltered (log, "\n\tnum_regs");
   /* Skip verify of num_pseudo_regs, invalid_p == 0 */
+  /* Skip verify of ax_pseudo_register_collect, has predicate */
+  /* Skip verify of ax_pseudo_register_push_stack, has predicate */
   /* Skip verify of sp_regnum, invalid_p == 0 */
   /* Skip verify of pc_regnum, invalid_p == 0 */
   /* Skip verify of ps_regnum, invalid_p == 0 */
@@ -760,6 +766,18 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: auto_wide_charset = <%s>\n",
                       host_address_to_string (gdbarch->auto_wide_charset));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
+                      gdbarch_ax_pseudo_register_collect_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
+                      host_address_to_string (gdbarch->ax_pseudo_register_collect));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_ax_pseudo_register_push_stack_p() = %d\n",
+                      gdbarch_ax_pseudo_register_push_stack_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
+                      host_address_to_string (gdbarch->ax_pseudo_register_push_stack));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: believe_pcc_promotion = %s\n",
                       plongest (gdbarch->believe_pcc_promotion));
   fprintf_unfiltered (file,
@@ -1722,6 +1740,54 @@ set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
 }
 
 int
+gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->ax_pseudo_register_collect != NULL;
+}
+
+int
+gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->ax_pseudo_register_collect != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_collect called\n");
+  return gdbarch->ax_pseudo_register_collect (gdbarch, ax, reg);
+}
+
+void
+set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
+                                        gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
+{
+  gdbarch->ax_pseudo_register_collect = ax_pseudo_register_collect;
+}
+
+int
+gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->ax_pseudo_register_push_stack != NULL;
+}
+
+int
+gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->ax_pseudo_register_push_stack != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ax_pseudo_register_push_stack called\n");
+  return gdbarch->ax_pseudo_register_push_stack (gdbarch, ax, reg);
+}
+
+void
+set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
+                                           gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
+{
+  gdbarch->ax_pseudo_register_push_stack = ax_pseudo_register_push_stack;
+}
+
+int
 gdbarch_sp_regnum (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index cfc777e..91e6aa5 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -53,6 +53,7 @@ struct target_desc;
 struct displaced_step_closure;
 struct core_regset_section;
 struct syscall;
+struct agent_expr;
 
 /* The architecture associated with the connection to the target.
  
@@ -215,6 +216,25 @@ extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
 extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
 extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
 
+/* Assemble agent expression bytecode to collect pseudo-register REG.
+   Return -1 if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_ax_pseudo_register_collect_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern int gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern void set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect);
+
+/* Assemble agent expression bytecode to push the value of pseudo-register
+   REG on the interpreter stack.
+   Return -1 if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
+
 /* GDB's standard (or well known) register numbers.  These can map onto
    a real register or a pseudo (computed) register or not be defined at
    all (-1).
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index eece393..b693e67 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -412,6 +412,15 @@ v:int:num_regs:::0:-1
 # combinations of other registers, or they may be computed by GDB.
 v:int:num_pseudo_regs:::0:0::0
 
+# Assemble agent expression bytecode to collect pseudo-register REG.
+# Return -1 if something goes wrong, 0 otherwise.
+M:int:ax_pseudo_register_collect:struct agent_expr *ax, int reg:ax, reg
+
+# Assemble agent expression bytecode to push the value of pseudo-register
+# REG on the interpreter stack.
+# Return -1 if something goes wrong, 0 otherwise.
+M:int:ax_pseudo_register_push_stack:struct agent_expr *ax, int reg:ax, reg
+
 # GDB's standard (or well known) register numbers.  These can map onto
 # a real register or a pseudo (computed) register or not be defined at
 # all (-1).
@@ -912,6 +921,7 @@ struct target_desc;
 struct displaced_step_closure;
 struct core_regset_section;
 struct syscall;
+struct agent_expr;
 
 /* The architecture associated with the connection to the target.
  
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 28c5867..3ae87d7 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -741,6 +741,9 @@ remove_inferior_command (char *args, int from_tty)
 
   if (inf == current_inferior ())
     error (_("Can not remove current symbol inferior."));
+    
+  if (inf->pid != 0)
+    error (_("Can not remove an active inferior."));
 
   delete_inferior_1 (inf, 1);
 }
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 0614506..db20e70 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1623,6 +1623,18 @@ mi_cmd_add_inferior (char *command, char **argv, int argc)
   ui_out_field_fmt (uiout, "inferior", "i%d", inf->num);
 }
 
+/* Callback used to find the first inferior other than the
+   current one. */
+   
+static int
+get_other_inferior (struct inferior *inf, void *arg)
+{
+  if (inf == current_inferior ())
+    return 0;
+
+  return 1;
+}
+
 void
 mi_cmd_remove_inferior (char *command, char **argv, int argc)
 {
@@ -1639,6 +1651,25 @@ mi_cmd_remove_inferior (char *command, char **argv, int argc)
   if (!inf)
     error ("the specified thread group does not exist");
 
+  if (inf->pid != 0)
+    error (_("cannot remove an active inferior"));
+
+  if (inf == current_inferior ())
+    {
+      struct thread_info *tp = 0;
+      struct inferior *new_inferior 
+	= iterate_over_inferiors (get_other_inferior, NULL);
+
+      if (new_inferior == NULL)
+	error (_("Cannot remove last inferior"));
+
+      set_current_inferior (new_inferior);
+      if (new_inferior->pid != 0)
+	tp = any_thread_of_process (new_inferior->pid);
+      switch_to_thread (tp ? tp->ptid : null_ptid);
+      set_current_program_space (new_inferior->pspace);
+    }
+
   delete_inferior_1 (inf, 1 /* silent */);
 }
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7e15041..99895f5 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -58,6 +58,7 @@
 #include "dwarf2-frame.h"
 #include "user-regs.h"
 #include "valprint.h"
+#include "ax.h"
 
 static const struct objfile_data *mips_pdr_data;
 
@@ -449,7 +450,16 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
   enum mips_abi abi = mips_abi (gdbarch);
 
   /* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers, 
-     but then don't make the raw register names visible.  */
+     but then don't make the raw register names visible.  This (upper)
+     range of user visible register numbers are the pseudo-registers.
+
+     This approach was adopted accommodate the following scenario:
+     It is possible to debug a 64-bit device using a 32-bit
+     programming model.  In such instances, the raw registers are
+     configured to be 64-bits wide, while the pseudo registers are
+     configured to be 32-bits wide.  The registers that the user
+     sees - the pseudo registers - match the users expectations
+     given the programming model being used.  */
   int rawnum = regno % gdbarch_num_regs (gdbarch);
   if (regno < gdbarch_num_regs (gdbarch))
     return "";
@@ -592,6 +602,48 @@ mips_pseudo_register_write (struct gdbarch *gdbarch,
     internal_error (__FILE__, __LINE__, _("bad register size"));
 }
 
+static int
+mips_ax_pseudo_register_collect (struct gdbarch *gdbarch,
+				 struct agent_expr *ax, int reg)
+{
+  int rawnum = reg % gdbarch_num_regs (gdbarch);
+  gdb_assert (reg >= gdbarch_num_regs (gdbarch)
+	      && reg < 2 * gdbarch_num_regs (gdbarch));
+
+  ax_reg_mask (ax, rawnum);
+
+  return 0;
+}
+
+static int
+mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
+				    struct agent_expr *ax, int reg)


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-30  7:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-30  7:22 [SCM] gdb_7_2-branch: Make tracepoint can trace pseudo register. Add MIPS callbacks jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).