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 v2 2/4] Add testcases to display.exp


    add testcases to display different types of data and variables
    *display/d/u/o/t/a/c
    *display array and structure

gdb/testsuite/ChangeLog:

    * gdb.base/display.c: Add variable types.
    * gdb.base/display.exp: Add testcases to test display.
---
 gdb/testsuite/gdb.base/display.c   |  6 ++++++
 gdb/testsuite/gdb.base/display.exp | 17 ++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/display.c b/gdb/testsuite/gdb.base/display.c
index cd833e2..2ade4d7 100644
--- a/gdb/testsuite/gdb.base/display.c
+++ b/gdb/testsuite/gdb.base/display.c
@@ -4,6 +4,12 @@
 #define LOOP 10
 
 int sum = 0;
+int int_array[2] = {0, 1};
+struct
+  {
+	char name;
+	int age;
+  } human;
 
 /* Call to force a variable onto the stack so we can see its address.  */
 void force_mem (int *arg) { }
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index 6e21d9e..8cbf875 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -80,13 +80,24 @@ gdb_test "disp/x j" ".*2: /x j = 0x0.*" "display j"
 gdb_test "disp/i &k" ".*3: x/i &k(\r\n|  )   $hex:.*" "display &k"
 gdb_test "disp/f f" ".*4: /f f = 3.1415*" "display/f f"
 gdb_test "disp/s &sum" ".*5: x/s &sum  $hex.*sum.:.*" "display/s &sum"
+gdb_test "disp/d f" "6: /d f = 3" "display/d f"
+gdb_test "disp/u f" "7: /u f = 3" "display/u f"
+gdb_test "disp/o f" "8: /o f = 03" "display/o f"
+gdb_test "disp/t f" "9: /t f = 11" "display/t f"
+gdb_test "disp/a f" "10: /a f = 0x3" "display/a f"
+gdb_test "disp/c f" "11: /c f = 3\ \'\\\\003\'" "display/c f"
+
+gdb_test "disp int_array" \
+    "12: int_array = \\{0, 1\\}" "display array"
+gdb_test "disp human" \
+    "13: human = {name = 0 '\\\\000', age = 0}" "display struct"
 
 # Hit the displays
 #
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 3 \'\\\\003\'\r\n\[0-9\]*: /a f = 0x3\r\n\[1-9\]*: /t f = 11\r\n\[1-9\]*: /o f = 03\r\n\[1-9\]*: /u f = 3\r\n\[1-9\]*: /d f = 3\r\n\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 4 \'\\\\004\'\r\n\[0-9\]*: /a f = 0x4\r\n\[1-9\]*: /t f = 100\r\n\[1-9\]*: /o f = 04\r\n\[1-9\]*: /u f = 4\r\n\[1-9\]*: /d f = 4\r\n\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "second disp"
 
-gdb_test "enab  disp 6" ".*No display number 6..*" "catch err"
+gdb_test "enab  disp 14" ".*No display number 14..*" "catch err"
 gdb_test_no_output "disab disp 1" "disab disp 1"
 gdb_test_no_output "disab disp 2" "disab disp 2"
 gdb_test_no_output "enab disp 1"  "re-enab"
-- 
1.8.3.1


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