gdb/
[deliverable/binutils-gdb.git] / gdb / infcall.c
index 48c183e39be88d7064c853640c3d82715b9db6bf..d42248ef5196a98128a0878d538234dc1bc66775 100644 (file)
@@ -88,7 +88,7 @@ show_coerce_float_to_double_p (struct ui_file *file, int from_tty,
    the stack and restore the context to what as it was before the
    call.
 
-   The default is to stop in the frame where the signal was received. */
+   The default is to stop in the frame where the signal was received.  */
 
 int unwind_on_signal_p = 0;
 static void
@@ -264,7 +264,7 @@ find_function_addr (struct value *function, struct type **retval_type)
   else if (code == TYPE_CODE_INT)
     {
       /* Handle the case of functions lacking debugging info.
-         Their values are characters since their addresses are char */
+         Their values are characters since their addresses are char */
       if (TYPE_LENGTH (ftype) == 1)
        funaddr = value_as_address (value_addr (function));
       else
@@ -373,7 +373,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 
   disable_watchpoints_before_interactive_call_start ();
 
-  /* We want stop_registers, please... */
+  /* We want stop_registers, please...  */
   call_thread->control.proceed_to_finish = 1;
 
   if (target_can_async_p ())
@@ -436,7 +436,7 @@ cleanup_delete_std_terminate_breakpoint (void *ignore)
    May fail to return, if a breakpoint or signal is hit
    during the execution of the function.
 
-   ARGS is modified to contain coerced values. */
+   ARGS is modified to contain coerced values.  */
 
 struct value *
 call_function_by_hand (struct value *function, int nargs, struct value **args)
@@ -549,7 +549,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
         If the generic dummy frame ends up empty (because nothing is
         pushed) GDB won't be able to correctly perform back traces.
         If a target is having trouble with backtraces, first thing to
-        do is add FRAME_ALIGN() to the architecture vector. If that
+        do is add FRAME_ALIGN() to the architecture vector.  If that
         fails, try dummy_id().
 
          If the ABI specifies a "Red Zone" (see the doco) the code
@@ -682,7 +682,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
 
   /* Reserve space for the return structure to be written on the
      stack, if necessary.  Make certain that the value is correctly
-     aligned. */
+     aligned.  */
 
   if (struct_return || lang_struct_return)
     {
@@ -700,7 +700,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
       else
        {
          /* Stack grows upward.  Align the frame, allocate space, and
-             then again, re-align the frame??? */
+             then again, re-align the frame???  */
          if (gdbarch_frame_align_p (gdbarch))
            sp = gdbarch_frame_align (gdbarch, sp);
          struct_addr = sp;
@@ -825,12 +825,11 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
       switch (e.reason)
        {
        case RETURN_ERROR:
-         throw_error (e.error,
-                      _("%s\nAn error occurred while in a "
-                        "function called from GDB.\n Evaluation "
-                        "of the expression containing the function\n   "
-                        "(%s) will be abandoned.\nWhen the function "
-                        "is done executing, GDB will silently stop."),
+         throw_error (e.error, _("%s\n\
+An error occurred while in a function called from GDB.\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned.\n\
+When the function is done executing, GDB will silently stop."),
                       e.message, name);
        case RETURN_QUIT:
        default:
@@ -874,18 +873,19 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
       /* Keep the dummy frame record, if the user switches back to the
         thread with the hand-call, we'll need it.  */
       if (stopped_by_random_signal)
-       error (_("The program received a signal in another thread while\n"
-                "making a function call from GDB.\nEvaluation "
-                "of the expression containing the function\n"
-                "(%s) will be abandoned.\nWhen the function "
-                "is done executing, GDB will silently stop."),
+       error (_("\
+The program received a signal in another thread while\n\
+making a function call from GDB.\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned.\n\
+When the function is done executing, GDB will silently stop."),
               name);
       else
-       error (_("The program stopped in another thread while making "
-                "a function call from GDB.\nEvaluation "
-                "of the expression containing the function\n"
-                "(%s) will be abandoned.\nWhen the function "
-                "is done executing, GDB will silently stop."),
+       error (_("\
+The program stopped in another thread while making a function call from GDB.\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned.\n\
+When the function is done executing, GDB will silently stop."),
               name);
     }
 
@@ -898,11 +898,11 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
        {
          /* We stopped inside the FUNCTION because of a random
             signal.  Further execution of the FUNCTION is not
-            allowed. */
+            allowed.  */
 
          if (unwind_on_signal_p)
            {
-             /* The user wants the context restored. */
+             /* The user wants the context restored.  */
 
              /* We must get back to the frame we were before the
                 dummy call.  */
@@ -914,12 +914,12 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
 
              /* 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 was signaled while "
-                      "in a function called from GDB.\nGDB has restored "
-                      "the context to what it was before the call.\n "
-                      "To change this behavior use \"set unwindonsignal "
-                      "off\".\nEvaluation of the expression containing "
-                      "the function\n(%s) will be abandoned."),
+             error (_("\
+The program being debugged was signaled while in a function called from GDB.\n\
+GDB has restored the context to what it was before the call.\n\
+To change this behavior use \"set unwindonsignal off\".\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned."),
                     name);
            }
          else
@@ -932,14 +932,13 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
 
              /* 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 was signaled while "
-                      "in a function called from GDB.\nGDB remains in "
-                      "the frame where the signal was received.\nTo change "
-                      "this behavior use \"set unwindonsignal on\".\n"
-                      "Evaluation of the expression containing the "
-                      "function\n(%s) will be abandoned.\n"
-                      "When the function is done executing, GDB will "
-                      "silently stop."),
+             error (_("\
+The program being debugged was signaled while in a function called from GDB.\n\
+GDB remains in the frame where the signal was received.\n\
+To change this behavior use \"set unwindonsignal on\".\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned.\n\
+When the function is done executing, GDB will silently stop."),
                     name);
            }
        }
@@ -954,18 +953,14 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
             the dummy call.  */
          restore_infcall_control_state (inf_status);
 
-         error (_("The program being debugged entered a "
-                  "std::terminate call, most likely\n"
-                  "caused by an unhandled C++ exception.  "
-                  "GDB blocked this call in order\n"
-                  "to prevent the program from being "
-                  "terminated, and has restored the\n"
-                  "context to its original state before the call.\n"
-                  "To change this behaviour use \"set "
-                  "unwind-on-terminating-exception off\".\n"
-                  "Evaluation of the expression "
-                  "containing the function (%s)\n"
-                  "will be abandoned."),
+         error (_("\
+The program being debugged entered a std::terminate call, most likely\n\
+caused by an unhandled C++ exception.  GDB blocked this call in order\n\
+to prevent the program from being terminated, and has restored the\n\
+context to its original state before the call.\n\
+To change this behaviour use \"set unwind-on-terminating-exception off\".\n\
+Evaluation of the expression containing the function (%s)\n\
+will be abandoned."),
                 name);
        }
       else if (stop_stack_dummy == STOP_NONE)
@@ -985,13 +980,11 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
             someday this will be implemented (it would not be easy).  */
          /* 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\n"
-                  "(%s) will be abandoned.\n"
-                  "When the function is done executing, "
-                  "GDB will silently stop."),
+         error (_("\
+The program being debugged stopped while in a function called from GDB.\n\
+Evaluation of the expression containing the function\n\
+(%s) will be abandoned.\n\
+When the function is done executing, GDB will silently stop."),
                 name);
        }
 
@@ -1017,29 +1010,29 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
     restore_infcall_control_state (inf_status);
 
     /* Figure out the value returned by the function.  */
+    retval = allocate_value (values_type);
 
     if (lang_struct_return)
-      retval = value_at (values_type, struct_addr);
-    else if (TYPE_CODE (target_values_type) == TYPE_CODE_VOID)
+      read_value_memory (retval, 0, 1, struct_addr,
+                        value_contents_raw (retval),
+                        TYPE_LENGTH (values_type));
+    else if (TYPE_CODE (target_values_type) != TYPE_CODE_VOID)
       {
        /* If the function returns void, don't bother fetching the
           return value.  */
-       retval = allocate_value (values_type);
-      }
-    else
-      {
        switch (gdbarch_return_value (gdbarch, value_type (function),
                                      target_values_type, NULL, NULL, NULL))
          {
          case RETURN_VALUE_REGISTER_CONVENTION:
          case RETURN_VALUE_ABI_RETURNS_ADDRESS:
          case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
-           retval = allocate_value (values_type);
            gdbarch_return_value (gdbarch, value_type (function), values_type,
                                  retbuf, value_contents_raw (retval), NULL);
            break;
          case RETURN_VALUE_STRUCT_CONVENTION:
-           retval = value_at (values_type, struct_addr);
+           read_value_memory (retval, 0, 1, struct_addr,
+                              value_contents_raw (retval),
+                              TYPE_LENGTH (values_type));
            break;
          }
       }
This page took 0.030394 seconds and 4 git commands to generate.