Honour software single step in fallback of displaced stepping
authorYao Qi <yao.qi@linaro.org>
Thu, 16 Apr 2015 12:48:10 +0000 (13:48 +0100)
committerYao Qi <yao.qi@linaro.org>
Thu, 16 Apr 2015 12:48:10 +0000 (13:48 +0100)
Hi,
When I run gdb.threads/non-stop-fair-events.exp on arm-linux target,
I see the following message in the debugging log,

  displaced: breakpoint is gone: Thread 22518, step(1)^M
  Sending packet: $vCont;s:p57f3.57f6#9d...
                  ^^^^^^^^^
GDB sends vCont;s by mistake, and GDBserver fails on assert.  GDB
doesn't consider software single step in infrun.c:displaced_step_fixup,

  /* Go back to what we were trying to do.  */
  step = currently_stepping (tp);

  if (debug_displaced)
    fprintf_unfiltered (gdb_stdlog,
"displaced: breakpoint is gone: %s, step(%d)\n",
target_pid_to_str (tp->ptid), step);

  target_resume (ptid, step, GDB_SIGNAL_0);

The patch is to let GDB consider software single step here.  It fixes
fails in gdb.threads/non-stop-fair-events.exp on arm.

gdb:

2015-04-16  Yao Qi  <yao.qi@linaro.org>

* infrun.c (maybe_software_singlestep): Declare.
(displaced_step_fixup): Call maybe_software_singlestep.

gdb/ChangeLog
gdb/infrun.c

index efee4167ad93e2d0ad1ecefc8a2c833897f4cadb..7f9c96ad3f5d9cb6869ba39f3f2a4542276c379a 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-16  Yao Qi  <yao.qi@linaro.org>
+
+       * infrun.c (maybe_software_singlestep): Declare.
+       (displaced_step_fixup): Call maybe_software_singlestep.
+
 2015-04-15  Doug Evans  <dje@google.com>
 
        * psymtab.c (psym_expand_symtabs_matching): Add QUIT call.
index 4164a003c263f94594b4a1d84d206c421caefb9e..7870f703e6c76041d0c831b28545f3a5536e1513 100644 (file)
@@ -98,6 +98,8 @@ static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
 
 static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
 
+static int maybe_software_singlestep (struct gdbarch *gdbarch, CORE_ADDR pc);
+
 /* When set, stop the 'step' command if we enter a function which has
    no line number information.  The normal behavior is that we step
    over such function.  */
@@ -1863,6 +1865,7 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal)
       regcache = get_thread_regcache (ptid);
       actual_pc = regcache_read_pc (regcache);
       aspace = get_regcache_aspace (regcache);
+      gdbarch = get_regcache_arch (regcache);
 
       if (breakpoint_here_p (aspace, actual_pc))
        {
@@ -1873,8 +1876,6 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal)
 
          displaced_step_prepare (ptid);
 
-         gdbarch = get_regcache_arch (regcache);
-
          if (debug_displaced)
            {
              CORE_ADDR actual_pc = regcache_read_pc (regcache);
@@ -1907,6 +1908,9 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal)
          /* Go back to what we were trying to do.  */
          step = currently_stepping (tp);
 
+         if (step)
+           step = maybe_software_singlestep (gdbarch, actual_pc);
+
          if (debug_displaced)
            fprintf_unfiltered (gdb_stdlog,
                                "displaced: breakpoint is gone: %s, step(%d)\n",
This page took 0.030858 seconds and 4 git commands to generate.