(sim_resume): Clarify use of SIGGNAL.
[deliverable/binutils-gdb.git] / gdb / valops.c
index 3c30d8ff9bec475aec0d09c1d77722a4729a5480..3e1a619c3766d57f24ff2811007ae2b855a82447 100644 (file)
@@ -61,10 +61,6 @@ static CORE_ADDR value_push PARAMS ((CORE_ADDR, value_ptr));
 static value_ptr search_struct_field PARAMS ((char *, value_ptr, int,
                                              struct type *, int));
 
-static value_ptr search_struct_field_aux PARAMS ((char *, value_ptr, int,
-                                         struct type *, int, int *, char *,
-                                                 struct type **));
-
 static value_ptr search_struct_method PARAMS ((char *, value_ptr *,
                                               value_ptr *,
                                               int, int *, struct type *));
@@ -666,8 +662,8 @@ value_assign (toval, fromval)
              > len * HOST_CHAR_BIT)
            /* Getting this right would involve being very careful about
               byte order.  */
-           error ("\
-Can't handle bitfield which doesn't fit in a single register.");
+           error ("Can't assign to bitfields that cross register "
+                  "boundaries.");
 
          read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
                               buffer, len);
@@ -970,7 +966,6 @@ value_ind (arg1)
 {
   struct type *base_type;
   value_ptr arg2;
-  value_ptr real_val;
 
   COERCE_ARRAY (arg1);
 
@@ -1066,7 +1061,12 @@ push_bytes (sp, buffer, len)
   return sp;
 }
 
-/* Push onto the stack the specified value VALUE.  */
+#ifndef PARM_BOUNDARY
+#define PARM_BOUNDARY (0)
+#endif
+
+/* Push onto the stack the specified value VALUE.  Pad it correctly for
+   it to be an argument to a function.  */
 
 static CORE_ADDR
 value_push (sp, arg)
@@ -1074,18 +1074,31 @@ value_push (sp, arg)
      value_ptr arg;
 {
   register int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
+  register int container_len = len;
+  register int offset;
+
+  /* How big is the container we're going to put this value in?  */
+  if (PARM_BOUNDARY)
+    container_len = ((len + PARM_BOUNDARY / TARGET_CHAR_BIT - 1)
+                    & ~(PARM_BOUNDARY / TARGET_CHAR_BIT - 1));
+
+  /* Are we going to put it at the high or low end of the container?  */
+  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+    offset = container_len - len;
+  else
+    offset = 0;
 
   if (INNER_THAN (1, 2))
     {
       /* stack grows downward */
-      sp -= len;
-      write_memory (sp, VALUE_CONTENTS_ALL (arg), len);
+      sp -= container_len;
+      write_memory (sp + offset, VALUE_CONTENTS_ALL (arg), len);
     }
   else
     {
       /* stack grows upward */
-      write_memory (sp, VALUE_CONTENTS_ALL (arg), len);
-      sp += len;
+      write_memory (sp + offset, VALUE_CONTENTS_ALL (arg), len);
+      sp += container_len;
     }
 
   return sp;
@@ -1279,6 +1292,7 @@ hand_function_call (function, nargs, args)
 {
   register CORE_ADDR sp;
   register int i;
+  int rc;
   CORE_ADDR start_sp;
   /* CALL_DUMMY is an array of words (REGISTER_SIZE), but each word
      is in host byte order.  Before calling FIX_CALL_DUMMY, we byteswap it
@@ -1674,9 +1688,28 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
     /* Execute the stack dummy routine, calling FUNCTION.
        When it is done, discard the empty frame
        after storing the contents of all regs into retbuf.  */
-    if (run_stack_dummy (real_pc + CALL_DUMMY_START_OFFSET, retbuf))
+    rc = run_stack_dummy (real_pc + CALL_DUMMY_START_OFFSET, retbuf);
+
+    if (rc == 1)
+      {
+       /* We stopped inside the FUNCTION because of a random signal.
+          Further execution of the FUNCTION is not allowed. */
+
+       /* In this case, we must do the cleanups because we don't
+          want the dummy anymore (the dummy frame has been poped already. */
+       do_cleanups (old_chain);
+
+       /* FIXME: Insert a bunch of wrap_here; name can be very long if it's
+          a C++ name with arguments and stuff.  */
+       error ("\
+The program being debugged stopped while in a function called from GDB.\n\
+Evaluation of the expression containing the function (%s) will be abandoned.",
+              name);
+      }
+
+    if (rc == 2)
       {
-       /* We stopped somewhere besides the call dummy.  */
+       /* We hit a breakpoint inside the FUNCTION. */
 
        /* If we did the cleanups, we would print a spurious error
           message (Unable to restore previously selected frame),
@@ -1701,6 +1734,7 @@ stop (instead of continuing to evaluate the expression containing\n\
 the function call).", name);
       }
 
+    /* If we get here the called FUNCTION run to completion. */
     do_cleanups (old_chain);
 
     /* Figure out the value returned by the function.  */
@@ -2544,7 +2578,6 @@ value_find_oload_method_list (argp, method, offset, static_memfuncp, num_fns, ba
      int *boffset;
 {
   struct type *t;
-  value_ptr v;
 
   t = check_typedef (VALUE_TYPE (*argp));
 
@@ -2665,6 +2698,14 @@ find_overload_match (arg_types, nargs, name, method, lax, obj, fsym, valp, symp,
       int i = -1;
       func_name = cplus_demangle (SYMBOL_NAME (fsym), DMGL_NO_OPTS);
 
+      /* If the name is NULL this must be a C-style function.
+         Just return the same symbol. */
+      if (!func_name)
+        {
+         *symp = fsym;
+          return 0;
+        }
+
       oload_syms = make_symbol_overload_list (fsym);
       while (oload_syms[++i])
        num_fns++;
@@ -2677,8 +2718,6 @@ find_overload_match (arg_types, nargs, name, method, lax, obj, fsym, valp, symp,
   /* Consider each candidate in turn */
   for (ix = 0; ix < num_fns; ix++)
     {
-      int jj;
-
       /* Number of parameters for current candidate */
       nparms = method ? TYPE_NFIELDS (fns_ptr[ix].type)
        : TYPE_NFIELDS (SYMBOL_TYPE (oload_syms[ix]));
This page took 0.026361 seconds and 4 git commands to generate.