unbreak infcalls
authorPedro Alves <palves@redhat.com>
Thu, 29 May 2014 16:17:30 +0000 (17:17 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 29 May 2014 16:17:30 +0000 (17:17 +0100)
I managed to miss an interaction between the recent *running patch,
and target-async, which resulted in infcalls being completely broken
on GNU/Linux and remote targets (that is, the async-capable targets).

 Temporary breakpoint 1, main () at threads.c:35
 35          long i = 0;
 (gdb) p malloc (0)
 The program being debugged stopped while in a function called from GDB.
 Evaluation of the expression containing the function
 (malloc) will be abandoned.
 When the function is done executing, GDB will silently stop.
 (gdb) p malloc (0)

 Program received signal SIGSEGV, Segmentation fault.
 0x000000000058d7e8 in get_regcache_aspace (regcache=0x0) at ../../src/gdb/regcache.c:281
 281       return regcache->aspace;
 (top-gdb)

The issue is that when running an infcall, the thread is no longer
marked as running, so run_inferior_call is not calling
wait_for_inferior anymore.

Fix this by doing what the comment actually says we do:

  "Do here what `proceed' itself does in sync mode."

And proceed doesn't check whether the target is running.

I notice this is broken in case of the early return in proceed, but we
were broken before in that case anyway, because run_inferior_call will
think the call actually ran.  Seems like we should make proceed have a
boolean return, and go through all callers making use of it, if
necessary.

But for now, just fix the regression.

Tested on x86_64 Fedora 20.

gdb/
2014-05-29  Pedro Alves  <palves@redhat.com>

* infcall.c (run_inferior_call): Don't check whether the current
thread is running after the proceed call.

gdb/ChangeLog
gdb/infcall.c

index 341698b4805fd27a95e269aba9cb7f61a2ed183c..3225ceb0cf7b7718b7eec1fd4f44a1fa3dbbab67 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-29  Pedro Alves  <palves@redhat.com>
+
+       * infcall.c (run_inferior_call): Don't check whether the current
+       thread is running after the proceed call.
+
 2014-05-29  Pedro Alves  <palves@redhat.com>
            Tom Tromey  <tromey@redhat.com>
 
index 9a859584e421804db93866f3adee8105ceaec052..685b8a4c699cc90759ced96c7aa3800491d37c93 100644 (file)
@@ -407,7 +407,7 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
       /* Inferior function calls are always synchronous, even if the
         target supports asynchronous execution.  Do here what
         `proceed' itself does in sync mode.  */
-      if (target_can_async_p () && is_running (inferior_ptid))
+      if (target_can_async_p ())
        {
          wait_for_inferior ();
          normal_stop ();
This page took 0.03054 seconds and 4 git commands to generate.