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]

[commit] Make "info spu dma" output more useful


Hello,

the output of "info spu dma" was less useful than it could be:

- it included invalid entries, i.e. those that were already fully
  processed and/or in otherwise inconsistent state

- the display sequence did not reflect the implicit (partial) order
  imposed by inter-entry dependencies (within the same DMA tag, 
  command are guaranteed to execute in the sequence they were submitted)

This patch uses the "valid" and "dependency" bits of the third 
doubleword of the MFC queue entry to fix those two problems.

Tested on spu-elf, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* spu-tdep.c (info_spu_dma_cmdlist): Only show entries with
	the valid bit set.  Ensure display order respects partial
	order defined by dependency bits.

testsuite/ChangeLog:

	* gdb.arch/spu-info.exp: Updated for "info spu dma" changes.


diff -urNp src-orig/gdb/spu-tdep.c src/gdb/spu-tdep.c
--- src-orig/gdb/spu-tdep.c	2008-07-25 16:38:05.000000000 +0200
+++ src/gdb/spu-tdep.c	2008-07-25 16:37:53.000000000 +0200
@@ -1742,8 +1742,44 @@ info_spu_dma_cmdlist (gdb_byte *buf, int
              NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
     };
 
+  int *seq = alloca (nr * sizeof (int));
+  int done = 0;
   struct cleanup *chain;
-  int i;
+  int i, j;
+
+
+  /* Determine sequence in which to display (valid) entries.  */
+  for (i = 0; i < nr; i++)
+    {
+      /* Search for the first valid entry all of whose
+	 dependencies are met.  */
+      for (j = 0; j < nr; j++)
+	{
+          ULONGEST mfc_cq_dw3;
+	  ULONGEST dependencies;
+
+	  if (done & (1 << (nr - 1 - j)))
+	    continue;
+
+	  mfc_cq_dw3 = extract_unsigned_integer (buf + 32*j + 24, 8);
+	  if (!spu_mfc_get_bitfield (mfc_cq_dw3, 16, 16))
+	    continue;
+
+	  dependencies = spu_mfc_get_bitfield (mfc_cq_dw3, 0, nr - 1);
+	  if ((dependencies & done) != dependencies)
+	    continue;
+
+	  seq[i] = j;
+	  done |= 1 << (nr - 1 - j);
+	  break;
+	}
+
+      if (j == nr)
+	break;
+    }
+
+  nr = i;
+
 
   chain = make_cleanup_ui_out_table_begin_end (uiout, 10, nr, "dma_cmd");
 
@@ -1766,7 +1802,6 @@ info_spu_dma_cmdlist (gdb_byte *buf, int
       ULONGEST mfc_cq_dw0;
       ULONGEST mfc_cq_dw1;
       ULONGEST mfc_cq_dw2;
-      ULONGEST mfc_cq_dw3;
       int mfc_cmd_opcode, mfc_cmd_tag, rclass_id, tclass_id;
       int lsa, size, list_lsa, list_size, mfc_lsa, mfc_size;
       ULONGEST mfc_ea;
@@ -1775,10 +1810,9 @@ info_spu_dma_cmdlist (gdb_byte *buf, int
       /* Decode contents of MFC Command Queue Context Save/Restore Registers.
 	 See "Cell Broadband Engine Registers V1.3", section 3.3.2.1.  */
 
-      mfc_cq_dw0 = extract_unsigned_integer (buf + 32*i, 8);
-      mfc_cq_dw1 = extract_unsigned_integer (buf + 32*i + 8, 8);
-      mfc_cq_dw2 = extract_unsigned_integer (buf + 32*i + 16, 8);
-      mfc_cq_dw3 = extract_unsigned_integer (buf + 32*i + 24, 8);
+      mfc_cq_dw0 = extract_unsigned_integer (buf + 32*seq[i], 8);
+      mfc_cq_dw1 = extract_unsigned_integer (buf + 32*seq[i] + 8, 8);
+      mfc_cq_dw2 = extract_unsigned_integer (buf + 32*seq[i] + 16, 8);
 
       list_lsa = spu_mfc_get_bitfield (mfc_cq_dw0, 0, 14);
       list_size = spu_mfc_get_bitfield (mfc_cq_dw0, 15, 26);
diff -urNp src-orig/gdb/testsuite/gdb.arch/spu-info.exp src/gdb/testsuite/gdb.arch/spu-info.exp
--- src-orig/gdb/testsuite/gdb.arch/spu-info.exp	2008-03-31 10:34:42.000000000 +0200
+++ src/gdb/testsuite/gdb.arch/spu-info.exp	2008-07-25 16:37:53.000000000 +0200
@@ -106,12 +106,12 @@ gdb_test "info spu mailbox" \
 
 # 'info spu dma'.
 gdb_test "info spu dma" \
-	 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \
+	 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \
 	 "info spu dma"
 
 # 'info spu proxydma'.
 gdb_test "info spu proxydma" \
-	 "Tag-Group Status.*Tag-Group Mask.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \
+	 "Tag-Group Status.*Tag-Group Mask.*" \
 	  "info spu proxydma"
 
 # Event tests.
@@ -186,14 +186,14 @@ gdb_test "info spu event" \
 # 'info spu dma' should be empty.
 c_to "Marker DMA"
 gdb_test "info spu dma" \
-	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \
+	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \
 	 "info spu dma (empty)"
 
 # 'info spu dma' should be filled with some data.
 c_to "Marker DMAWait"
 gdb_test "next" "" "next"
 gdb_test "info spu dma" \
-	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \
+	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*get.*5.*0.*0.*0x00080\[ \r\n\]+" \
 	 "info spu dma (non-empty)"
 gdb_test "finish" "" "finish"
 
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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