public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb/gdb-8.1-branch] gdbserver/Windows: Fix "no program to debug" error
Date: Thu, 10 May 2018 19:22:00 -0000	[thread overview]
Message-ID: <c0c0270a9a38e1e888e9d6f0185b465d3751f518@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT c0c0270a9a38e1e888e9d6f0185b465d3751f518 ***

Author: Joel Brobecker <brobecker@adacore.com>
Branch: gdb-8.1-branch
Commit: c0c0270a9a38e1e888e9d6f0185b465d3751f518

gdbserver/Windows: Fix "no program to debug" error

Trying to start a program with GDBserver on Windows yields
the following error:

    $ gdbserver.exe --once :4444 simple_main.exe
    Killing process(es): 5008
    No program to debug
    Exiting

The error itself comes from the following code shortly after
create_inferior gets called (in server.c::main):

    /* Wait till we are at first instruction in program.  */
    create_inferior (program_path.get (), program_args);
    [...]

    if (last_status.kind == TARGET_WAITKIND_EXITED
        || last_status.kind == TARGET_WAITKIND_SIGNALLED)
      was_running = 0;
    else
      was_running = 1;

    if (!was_running && !multi_mode)
      error ("No program to debug");

What happens is that the "last_status" global starts initialized
as zeroes, which means last_status.kind == TARGET_WAITKIND_EXITED,
and we expect create_inferior to be waiting for the inferior to
start until reaching the SIGTRAP, and to set the "last_status"
global to match that last event we received.

I suspect this is an unintended side-effect of the following change...

    commit 2090129c36c7e582943b7d300968d19b46160d84
    Date:   Thu Dec 22 21:11:11 2016 -0500
    Subject: Share fork_inferior et al with gdbserver

... which removes some code in server.c that was responsible for
starting the inferior in a functin that was named start_inferior,
and looked like this:

   signal_pid = create_inferior (new_argv[0], &new_argv[0]);
   [...]
   /* Wait till we are at 1st instruction in program, return new pid
      (assuming success).  */
   last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);

The code has been transitioned to using fork_inferior, but sadly,
only for the targets that support it. On Windows, the calls to wait
setting "last_status" simply disappeared.

This patch adds it back in the Windows-specific implementation of
create_inferior.

gdb/gdbserver/ChangeLog:

        PR server/23158:
        * win32-low.c (win32_create_inferior): Add call to my_wait
        setting last_status global.


             reply	other threads:[~2018-05-10 19:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 19:22 sergiodj+buildbot [this message]
2018-05-10 19:32 ` Failures on Fedora-s390x-m64, branch gdb-8.1-branch sergiodj+buildbot
2018-05-10 20:47 ` Failures on RHEL-s390x-m64, " sergiodj+buildbot
2018-05-10 23:10 ` Failures on Debian-s390x-m64, " sergiodj+buildbot
2018-05-10 23:57 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-05-11  0:17 ` Failures on Debian-s390x-native-gdbserver-m64, " sergiodj+buildbot
2018-05-11 14:36 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2018-05-11 14:54 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-05-11 15:18 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-05-11 17:22 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-05-11 17:46 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-06-20  7:35 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-06-20  7:37 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-06-20  7:51 ` Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0c0270a9a38e1e888e9d6f0185b465d3751f518@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).