2011-02-16 Tom Tromey <tromey@redhat.com>
authorPedro Alves <palves@redhat.com>
Wed, 16 Feb 2011 18:07:58 +0000 (18:07 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 16 Feb 2011 18:07:58 +0000 (18:07 +0000)
gdb/
* ax-gdb.c.c (gen_expr) <UNOP_MEMVAL>: Handle value kinds other
than axs_rvalue.

2011-02-16  Pedro Alves  <pedro@codesourcery.com>

gdb/testsuite/
* collection.c (globalarr3): New global.
(main): Initialize it before collecting, and and clear it
afterwards.
* collection.exp (gdb_collect_globals_test): Test collecting with
'{type} addr', where the addr expression is not an rvalue.

gdb/ChangeLog
gdb/ax-gdb.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/collection.c
gdb/testsuite/gdb.trace/collection.exp

index b81c0ba4e734d6ea3987129a08a77232447164cf..fe6fec70d81b1785913ecf11f0de13cb2d59a0aa 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-16  Tom Tromey  <tromey@redhat.com>
+
+       * ax-gdb.c.c (gen_expr) <UNOP_MEMVAL>: Handle value kinds other
+       than axs_rvalue.
+
 2011-02-16  Yao Qi  <yao@qiyaows>
 
        * infrun.c (get_displaced_step_closure_by_addr): New.
index 29084318ae581733c22253befcf94bfa8b11adc1..d1736e144ccfa723070cf678ae1746c905cd73c0 100644 (file)
@@ -2044,14 +2044,13 @@ gen_expr (struct expression *exp, union exp_element **pc,
 
        (*pc) += 3;
        gen_expr (exp, pc, ax, value);
-       /* I'm not sure I understand UNOP_MEMVAL entirely.  I think
-          it's just a hack for dealing with minsyms; you take some
-          integer constant, pretend it's the address of an lvalue of
-          the given type, and dereference it.  */
-       if (value->kind != axs_rvalue)
-         /* This would be weird.  */
-         internal_error (__FILE__, __LINE__,
-                         _("gen_expr: OP_MEMVAL operand isn't an rvalue???"));
+
+       /* If we have an axs_rvalue or an axs_lvalue_memory, then we
+          already have the right value on the stack.  For
+          axs_lvalue_register, we must convert.  */
+       if (value->kind == axs_lvalue_register)
+         require_rvalue (ax, value);
+
        value->type = type;
        value->kind = axs_lvalue_memory;
       }
index f27dd22030e43be0db08882d3519fa01101b9216..5af639ddc89d26b4ed51f2f859f77a01d68925e1 100644 (file)
@@ -1,3 +1,11 @@
+2011-02-16  Pedro Alves  <pedro@codesourcery.com>
+
+       * collection.c (globalarr3): New global.
+       (main): Initialize it before collecting, and and clear it
+       afterwards.
+       * collection.exp (gdb_collect_globals_test): Test collecting with
+       '{type} addr', where the addr expression is not an rvalue.
+
 2011-02-16  Ken Werner  <ken.werner@de.ibm.com>
 
        * gdb.opencl/datatypes.exp: Allow "false" when printing the content of
index 422b737cc8a7dab3b2ee17cc304a4e10aaca7336..6c666374fbbca7ddcfffc7af5ba2b3210f2c1882 100644 (file)
@@ -27,6 +27,7 @@ test_struct  globalstruct;
 test_struct *globalp;
 int          globalarr[16];
 int          globalarr2[4];
+int          globalarr3[4];
 
 struct global_pieces {
   unsigned int a;
@@ -241,6 +242,9 @@ main (argc, argv, envp)
   for (i = 0; i < 4; i++)
     globalarr2[i] = i;
 
+  for (i = 0; i < 4; i++)
+    globalarr3[3 - i] = i;
+
   mystruct.memberc = 101;
   mystruct.memberi = 102;
   mystruct.memberf = 103.3;
@@ -289,6 +293,8 @@ main (argc, argv, envp)
     globalarr[i] = 0;
   for (i = 0; i < 4; i++)
     globalarr2[i] = 0;
+  for (i = 0; i < 4; i++)
+    globalarr3[i] = 0;
 
   end ();
   return 0;
index c966f2f129d9338cc420b772efa4e6ec2205d0d4..c6f7fd1e6f817a84cd29262b355fbd7ae3f7bd88 100644 (file)
@@ -479,7 +479,8 @@ proc gdb_collect_globals_test { } {
            "collect globalc, globali, globalf, globald" "^$" \
            "collect globalstruct, globalp, globalarr" "^$" \
            "collect \{int \[4\]\}$globalarr2_addr" "^$" \
-           "collect \{int \[2\]\}$globalarr2_addr" "^$"
+           "collect \{int \[2\]\}$globalarr2_addr" "^$" \
+           "collect \{int \[4\]\}globalarr3" "^$"
 
     # Begin the test.
     run_trace_experiment "globals" globals_test_func
@@ -530,6 +531,14 @@ proc gdb_collect_globals_test { } {
        "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
        "collect globals: collected global array 2"
 
+    # GDB would internal error collecting UNOP_MEMVAL's whose address
+    # expression wasn't an rvalue (that's regtested in the
+    # corresponding 'collect' action above).  This just double checks
+    # we actually did collect what we wanted.
+    gdb_test "print globalarr3" \
+       "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \
+       "collect globals: collected global array 3"
+
     gdb_test "tfind none" \
            "#0  end .*" \
            "collect globals: cease trace debugging"
This page took 0.049223 seconds and 4 git commands to generate.