2010-03-17 Stan Shebs <stan@codesourcery.com>
authorStan Shebs <shebs@codesourcery.com>
Thu, 18 Mar 2010 01:47:33 +0000 (01:47 +0000)
committerStan Shebs <shebs@codesourcery.com>
Thu, 18 Mar 2010 01:47:33 +0000 (01:47 +0000)
* ax-gdb.c (require_rvalue): Disallow non-scalars.

gdb/ChangeLog
gdb/ax-gdb.c

index 2b5e242de5545edd73c7f4dbfa68d9034bb8d998..f961562f399bbeba61036308647d5ee10f200f2c 100644 (file)
@@ -1,5 +1,7 @@
 2010-03-17 Stan Shebs  <stan@codesourcery.com>
 
+       * ax-gdb.c (require_rvalue): Disallow non-scalars.
+
        * infcall.c: Include tracepoint.h.
        (call_function_by_hand): Disallow calls in tfind mode.
        * infcmd.c: Include tracepoint.h.
index 091fd95f1fc6c042ef6d495ed48180f16757f8ad..4307de3acd608d9356641b2a6dba1d9e7641d74d 100644 (file)
@@ -745,6 +745,15 @@ gen_int_literal (struct agent_expr *ax, struct axs_value *value, LONGEST k,
 static void
 require_rvalue (struct agent_expr *ax, struct axs_value *value)
 {
+  /* Only deal with scalars, structs and such may be too large
+     to fit in a stack entry.  */
+  value->type = check_typedef (value->type);
+  if (TYPE_CODE (value->type) == TYPE_CODE_ARRAY
+      || TYPE_CODE (value->type) == TYPE_CODE_STRUCT
+      || TYPE_CODE (value->type) == TYPE_CODE_UNION
+      || TYPE_CODE (value->type) == TYPE_CODE_FUNC)
+    error ("Value not scalar: cannot be an rvalue.");
+
   switch (value->kind)
     {
     case axs_rvalue: