2003-01-09 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / infcmd.c
index 6b4d7ae367a6a49cf4a6f067e547316e0ce47e7b..56bd75d8484d434b77209441d205a6fe54e84581 100644 (file)
@@ -182,7 +182,7 @@ CORE_ADDR step_range_end;   /* Exclusive */
    This is how we know when we step into a subroutine call,
    and how to set the frame for the breakpoint used to step out.  */
 
-CORE_ADDR step_frame_address;
+struct frame_id step_frame_id;
 
 /* Our notion of the current stack pointer.  */
 
@@ -278,7 +278,7 @@ construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
 
       /* We over-compute the size.  It shouldn't matter.  */
       for (i = 0; i < argc; ++i)
-       length += 2 * strlen (argv[i]) + 1;
+       length += 2 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0');
 
       result = (char *) xmalloc (length);
       out = result;
@@ -288,11 +288,20 @@ construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
          if (i > 0)
            *out++ = ' ';
 
-         for (cp = argv[i]; *cp; ++cp)
+         /* Need to handle empty arguments specially.  */
+         if (argv[i][0] == '\0')
            {
-             if (strchr (special, *cp) != NULL)
-               *out++ = '\\';
-             *out++ = *cp;
+             *out++ = '\'';
+             *out++ = '\'';
+           }
+         else
+           {
+             for (cp = argv[i]; *cp; ++cp)
+               {
+                 if (strchr (special, *cp) != NULL)
+                   *out++ = '\\';
+                 *out++ = *cp;
+               }
            }
        }
       *out = '\0';
@@ -618,7 +627,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
          frame = get_current_frame ();
          if (!frame)           /* Avoid coredump here.  Why tho? */
            error ("No current frame");
-         step_frame_address = get_frame_base (frame);
+         step_frame_id = get_frame_id (frame);
          step_sp = read_sp ();
 
          if (!single_inst)
@@ -733,7 +742,7 @@ step_once (int skip_subroutines, int single_inst, int count)
       frame = get_current_frame ();
       if (!frame)              /* Avoid coredump here.  Why tho? */
        error ("No current frame");
-      step_frame_address = get_frame_base (frame);
+      step_frame_id = get_frame_id (frame);
       step_sp = read_sp ();
 
       if (!single_inst)
@@ -992,27 +1001,28 @@ run_stack_dummy (CORE_ADDR addr, struct regcache *buffer)
        }
       else
        {
+         /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need
+            to put a breakpoint instruction.  If not, the call dummy
+            already has the breakpoint instruction in it.
+
+            ADDR IS THE ADDRESS of the call dummy plus the
+            CALL_DUMMY_START_OFFSET, so we need to subtract the
+            CALL_DUMMY_START_OFFSET.  */
          sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
        }
       sal.section = find_pc_overlay (sal.pc);
 
-      /* Set up a FRAME for the dummy frame so we can pass it to
-         set_momentary_breakpoint.  We need to give the breakpoint a
-         frame in case there is only one copy of the dummy (e.g.
-         CALL_DUMMY_LOCATION == AFTER_TEXT_END).  */
-      flush_cached_frames ();
-      set_current_frame (create_new_frame (read_fp (), sal.pc));
-
-      /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
-         a breakpoint instruction.  If not, the call dummy already has the
-         breakpoint instruction in it.
-
-         addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
-         so we need to subtract the CALL_DUMMY_START_OFFSET.  */
-      bpt = set_momentary_breakpoint (sal,
-                                     get_current_frame (),
-                                     bp_call_dummy);
-      bpt->disposition = disp_del;
+      {
+       /* Set up a frame ID for the dummy frame so we can pass it to
+          set_momentary_breakpoint.  We need to give the breakpoint a
+          frame ID so that the breakpoint code can correctly
+          re-identify the dummy breakpoint.  */
+       struct frame_id frame = frame_id_build (read_fp (), sal.pc);
+       /* Create a momentary breakpoint at the return address of the
+           inferior.  That way it breaks when it returns.  */
+       bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
+       bpt->disposition = disp_del;
+      }
 
       /* If all error()s out of proceed ended up calling normal_stop (and
          perhaps they should; it already does in the special case of error
@@ -1096,7 +1106,7 @@ until_next_command (int from_tty)
     }
 
   step_over_calls = STEP_OVER_ALL;
-  step_frame_address = get_frame_base (frame);
+  step_frame_id = get_frame_id (frame);
   step_sp = read_sp ();
 
   step_multi = 0;              /* Only one call to proceed */
@@ -1272,10 +1282,10 @@ finish_command (char *arg, int from_tty)
 
   clear_proceed_status ();
 
-  sal = find_pc_line (frame->pc, 0);
-  sal.pc = frame->pc;
+  sal = find_pc_line (get_frame_pc (frame), 0);
+  sal.pc = get_frame_pc (frame);
 
-  breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
+  breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), bp_finish);
 
   if (!event_loop_p || !target_can_async_p ())
     old_chain = make_cleanup_delete_breakpoint (breakpoint);
@@ -1284,7 +1294,7 @@ finish_command (char *arg, int from_tty)
 
   /* Find the function we will return from.  */
 
-  function = find_pc_function (deprecated_selected_frame->pc);
+  function = find_pc_function (get_frame_pc (deprecated_selected_frame));
 
   /* Print info on the selected frame, including level number
      but not source.  */
This page took 0.035269 seconds and 4 git commands to generate.