[PULL 00/14] testing and gdbstub updates

Alex Bennée posted 14 patches 5 years, 6 months ago
Only 6 patches received!
There is a newer version of this series
configure                                   |   4 +-
include/exec/gdbstub.h                      |  25 ++++--
bsd-user/main.c                             |   8 +-
gdbstub.c                                   | 119 ++++++++++++++++++++++------
linux-user/main.c                           |  12 +--
target/m68k/cpu.c                           |  52 ++++++++----
target/m68k/helper.c                        |   3 +-
target/ppc/gdbstub.c                        |   4 +-
target/ppc/translate_init.inc.c             |   2 +-
.cirrus.yml                                 |   4 +-
.travis.yml                                 |  31 +-------
gdb-xml/m68k-core.xml                       |  29 +++++++
tests/guest-debug/run-test.py               |  30 ++++++-
tests/tcg/aarch64/Makefile.target           |   5 +-
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py |   4 -
tests/tcg/aarch64/gdbstub/test-sve.py       |   4 -
tests/tcg/cris/Makefile.target              |   1 +
tests/tcg/multiarch/Makefile.target         |  14 ++++
tests/tcg/multiarch/gdbstub/sha1.py         |  81 +++++++++++++++++++
19 files changed, 328 insertions(+), 104 deletions(-)
create mode 100644 gdb-xml/m68k-core.xml
create mode 100644 tests/tcg/multiarch/gdbstub/sha1.py
[PULL 00/14] testing and gdbstub updates
Posted by Alex Bennée 5 years, 6 months ago
The following changes since commit f19d118bed77bb95681b07f4e76dbb700c16918d:

  Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-05-04' into staging (2020-05-05 15:47:44 +0100)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-testing-and-gdbstub-060520-1

for you to fetch changes up to a976ed3ffdede7f64c89ac235d0154d048981b5f:

  target/m68k: fix gdb for m68xxx (2020-05-06 09:29:26 +0100)

----------------------------------------------------------------
Testing and gdbstub updates:

  - travis: drop macosx, tweak ppc64 native
  - cirrus: fix FreeBSD, guard against future breakage
  - gdbstub: support socket debug for linux-user
  - gdbstub: add multiarch tests
  - gdbstub: fixes for m68k

----------------------------------------------------------------
Alex Bennée (11):
      .travis.yml: show free disk space at end of run
      .travis.yml: drop MacOSX
      .cirrus.yml: bump FreeBSD to the current stable release
      .travis.yml: reduce the load on [ppc64] GCC check-tcg
      configure: favour gdb-multiarch if we have it
      tests/tcg: better trap gdb failures
      tests/tcg: drop inferior.was_attached() test
      gdbstub: eliminate gdbserver_fd global
      gdbstub/linux-user: support debugging over a unix socket
      tests/guest-debug: use the unix socket for linux-user tests
      tests/tcg: add a multiarch linux-user gdb test

KONRAD Frederic (1):
      target/m68k: fix gdb for m68xxx

Li-Wen Hsu (1):
      .cirrus.yml: bootstrap pkg unconditionally

Philippe Mathieu-Daudé (1):
      gdbstub: Introduce gdb_get_float64() to get 64-bit float registers

 configure                                   |   4 +-
 include/exec/gdbstub.h                      |  25 ++++--
 bsd-user/main.c                             |   8 +-
 gdbstub.c                                   | 119 ++++++++++++++++++++++------
 linux-user/main.c                           |  12 +--
 target/m68k/cpu.c                           |  52 ++++++++----
 target/m68k/helper.c                        |   3 +-
 target/ppc/gdbstub.c                        |   4 +-
 target/ppc/translate_init.inc.c             |   2 +-
 .cirrus.yml                                 |   4 +-
 .travis.yml                                 |  31 +-------
 gdb-xml/m68k-core.xml                       |  29 +++++++
 tests/guest-debug/run-test.py               |  30 ++++++-
 tests/tcg/aarch64/Makefile.target           |   5 +-
 tests/tcg/aarch64/gdbstub/test-sve-ioctl.py |   4 -
 tests/tcg/aarch64/gdbstub/test-sve.py       |   4 -
 tests/tcg/cris/Makefile.target              |   1 +
 tests/tcg/multiarch/Makefile.target         |  14 ++++
 tests/tcg/multiarch/gdbstub/sha1.py         |  81 +++++++++++++++++++
 19 files changed, 328 insertions(+), 104 deletions(-)
 create mode 100644 gdb-xml/m68k-core.xml
 create mode 100644 tests/tcg/multiarch/gdbstub/sha1.py


-- 
2.20.1


Re: [PULL 00/14] testing and gdbstub updates
Posted by Peter Maydell 5 years, 6 months ago
On Wed, 6 May 2020 at 13:05, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit f19d118bed77bb95681b07f4e76dbb700c16918d:
>
>   Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-05-04' into staging (2020-05-05 15:47:44 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-testing-and-gdbstub-060520-1
>
> for you to fetch changes up to a976ed3ffdede7f64c89ac235d0154d048981b5f:
>
>   target/m68k: fix gdb for m68xxx (2020-05-06 09:29:26 +0100)
>
> ----------------------------------------------------------------
> Testing and gdbstub updates:
>
>   - travis: drop macosx, tweak ppc64 native
>   - cirrus: fix FreeBSD, guard against future breakage
>   - gdbstub: support socket debug for linux-user
>   - gdbstub: add multiarch tests
>   - gdbstub: fixes for m68k


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM

[PULL 01/14] .travis.yml: show free disk space at end of run
Posted by Alex Bennée 5 years, 6 months ago
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200501111505.4225-2-alex.bennee@linaro.org>

diff --git a/.travis.yml b/.travis.yml
index 2fd63eceaac..a4c3c6c8058 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -113,6 +113,7 @@ script:
         $(exit $BUILD_RC);
     fi
 after_script:
+  - df -h
   - if command -v ccache ; then ccache --show-stats ; fi
 
 
-- 
2.20.1


[PULL 02/14] .travis.yml: drop MacOSX
Posted by Alex Bennée 5 years, 6 months ago
This keeps breaking on Travis so lets just fall back to the Cirrus CI
builds which seem to be better maintained. Fix up the comments while
we are doing this as we never had a windows build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200501111505.4225-3-alex.bennee@linaro.org>

diff --git a/.travis.yml b/.travis.yml
index a4c3c6c8058..49267b73b36 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,9 +9,8 @@ compiler:
 cache:
   # There is one cache per branch and compiler version.
   # characteristics of each job are used to identify the cache:
-  # - OS name (currently, linux, osx, or windows)
+  # - OS name (currently only linux)
   # - OS distribution (for Linux, xenial, trusty, or precise)
-  # - macOS image name (e.g., xcode7.2)
   # - Names and values of visible environment variables set in .travis.yml or Settings panel
   timeout: 1200
   ccache: true
@@ -271,31 +270,6 @@ jobs:
         - TEST_CMD=""
 
 
-    # MacOSX builds - cirrus.yml also tests some MacOS builds including latest Xcode
-
-    - name: "OSX Xcode 10.3"
-      env:
-        - BASE_CONFIG="--disable-docs --enable-tools"
-        - CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu"
-      os: osx
-      osx_image: xcode10.3
-      compiler: clang
-      addons:
-        homebrew:
-          packages:
-            - ccache
-            - glib
-            - pixman
-            - gnu-sed
-            - python
-          update: true
-      before_script:
-        - brew link --overwrite python
-        - export PATH="/usr/local/opt/ccache/libexec:$PATH"
-        - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
-        - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
-
-
     # Python builds
     - name: "GCC Python 3.5 (x86_64-softmmu)"
       env:
-- 
2.20.1


[PULL 03/14] .cirrus.yml: bump FreeBSD to the current stable release
Posted by Alex Bennée 5 years, 6 months ago
Hopefully this will un-stick the test which has been broken for a long
time.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Li-Wen Hsu <lwhsu@freebsd.org>
Tested-by: Li-Wen Hsu <lwhsu@freebsd.org>
Message-Id: <20200501111505.4225-4-alex.bennee@linaro.org>

diff --git a/.cirrus.yml b/.cirrus.yml
index 90645fede6b..f06f5af2b93 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -3,7 +3,7 @@ env:
 
 freebsd_12_task:
   freebsd_instance:
-    image: freebsd-12-0-release-amd64
+    image_family: freebsd-12-1
     cpu: 8
     memory: 8G
   install_script: pkg install -y
-- 
2.20.1


[PULL 04/14] .cirrus.yml: bootstrap pkg unconditionally
Posted by Alex Bennée 5 years, 6 months ago
From: Li-Wen Hsu <lwhsu@lwhsu.org>

This ensures compatibility with pkg repo so a change in upstream
doesn't break setup. See:

  https://lists.freebsd.org/pipermail/freebsd-cloud/2020-April/000234.html

Message-Id: <CAKBkRUzicxphjjkkxdgzB3cDSv=AszD5V4X499jT2BjiAaazGw@mail.gmail.com>
Signed-off-by: Li-Wen Hsu <lwhsu@lwhsu.org>
[AJB: applied from Li-Wen's github, applied sob, tweaked commit message]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

diff --git a/.cirrus.yml b/.cirrus.yml
index f06f5af2b93..de0727cb097 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -6,7 +6,7 @@ freebsd_12_task:
     image_family: freebsd-12-1
     cpu: 8
     memory: 8G
-  install_script: pkg install -y
+  install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y
     bash bison curl cyrus-sasl git glib gmake gnutls gsed
     nettle perl5 pixman pkgconf png usbredir
   script:
-- 
2.20.1


[PULL 05/14] .travis.yml: reduce the load on [ppc64] GCC check-tcg
Posted by Alex Bennée 5 years, 6 months ago
This seems to be timing out quite often and occasionally running out
of disk space. Relegate it to light duties.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200501111505.4225-5-alex.bennee@linaro.org>

diff --git a/.travis.yml b/.travis.yml
index 49267b73b36..fe708792ca2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -458,7 +458,7 @@ jobs:
           - genisoimage
       env:
         - TEST_CMD="make check check-tcg V=1"
-        - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS},ppc64le-linux-user"
+        - CONFIG="--disable-containers --target-list=ppc64-softmmu,ppc64le-linux-user"
 
     - name: "[s390x] GCC check-tcg"
       arch: s390x
-- 
2.20.1


[PULL 06/14] configure: favour gdb-multiarch if we have it
Posted by Alex Bennée 5 years, 6 months ago
As gdb will generally be talking to "foreign" guests lets use that if
we can. Otherwise the chances of gdb barfing are considerably higher.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200430190122.4592-2-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 23b5e93752b..c58787100f1 100755
--- a/configure
+++ b/configure
@@ -303,7 +303,7 @@ libs_qga=""
 debug_info="yes"
 stack_protector=""
 use_containers="yes"
-gdb_bin=$(command -v "gdb")
+gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
 
 if test -e "$source_path/.git"
 then
-- 
2.20.1


[PULL 10/14] gdbstub: eliminate gdbserver_fd global
Posted by Alex Bennée 5 years, 6 months ago
We don't really need to track this fd beyond the initial creation of
the socket. We already know if the system has been initialised by
virtue of the gdbserver_state so lets remove it. This makes the later
re-factoring easier.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200430190122.4592-6-alex.bennee@linaro.org>

diff --git a/gdbstub.c b/gdbstub.c
index 171e1509509..b5381aa5204 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -398,8 +398,6 @@ static void reset_gdbserver_state(void)
 bool gdb_has_xml;
 
 #ifdef CONFIG_USER_ONLY
-/* XXX: This is not thread safe.  Do we care?  */
-static int gdbserver_fd = -1;
 
 static int get_char(void)
 {
@@ -2964,7 +2962,7 @@ void gdb_exit(CPUArchState *env, int code)
       return;
   }
 #ifdef CONFIG_USER_ONLY
-  if (gdbserver_fd < 0 || gdbserver_state.fd < 0) {
+  if (gdbserver_state.fd < 0) {
       return;
   }
 #endif
@@ -3011,7 +3009,7 @@ gdb_handlesig(CPUState *cpu, int sig)
     char buf[256];
     int n;
 
-    if (gdbserver_fd < 0 || gdbserver_state.fd < 0) {
+    if (!gdbserver_state.init || gdbserver_state.fd < 0) {
         return sig;
     }
 
@@ -3060,7 +3058,7 @@ void gdb_signalled(CPUArchState *env, int sig)
 {
     char buf[4];
 
-    if (gdbserver_fd < 0 || gdbserver_state.fd < 0) {
+    if (!gdbserver_state.init || gdbserver_state.fd < 0) {
         return;
     }
 
@@ -3068,7 +3066,7 @@ void gdb_signalled(CPUArchState *env, int sig)
     put_packet(buf);
 }
 
-static bool gdb_accept(void)
+static bool gdb_accept(int gdb_fd)
 {
     struct sockaddr_in sockaddr;
     socklen_t len;
@@ -3076,7 +3074,7 @@ static bool gdb_accept(void)
 
     for(;;) {
         len = sizeof(sockaddr);
-        fd = accept(gdbserver_fd, (struct sockaddr *)&sockaddr, &len);
+        fd = accept(gdb_fd, (struct sockaddr *)&sockaddr, &len);
         if (fd < 0 && errno != EINTR) {
             perror("accept");
             return false;
@@ -3137,13 +3135,13 @@ static int gdbserver_open(int port)
 
 int gdbserver_start(int port)
 {
-    gdbserver_fd = gdbserver_open(port);
-    if (gdbserver_fd < 0)
+    int gdb_fd = gdbserver_open(port);
+    if (gdb_fd < 0) {
         return -1;
+    }
     /* accept connections */
-    if (!gdb_accept()) {
-        close(gdbserver_fd);
-        gdbserver_fd = -1;
+    if (!gdb_accept(gdb_fd)) {
+        close(gdb_fd);
         return -1;
     }
     return 0;
@@ -3152,7 +3150,7 @@ int gdbserver_start(int port)
 /* Disable gdb stub for child processes.  */
 void gdbserver_fork(CPUState *cpu)
 {
-    if (gdbserver_fd < 0 || gdbserver_state.fd < 0) {
+    if (!gdbserver_state.init || gdbserver_state.fd < 0) {
         return;
     }
     close(gdbserver_state.fd);
-- 
2.20.1


[PULL 12/14] tests/guest-debug: use the unix socket for linux-user tests
Posted by Alex Bennée 5 years, 6 months ago
Now we have support for debugging over a unix socket for linux-user
lets use it in our test harness.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200430190122.4592-8-alex.bennee@linaro.org>

diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py
index 2bbb8fbaa38..d9af9573b9e 100755
--- a/tests/guest-debug/run-test.py
+++ b/tests/guest-debug/run-test.py
@@ -15,6 +15,8 @@ import argparse
 import subprocess
 import shutil
 import shlex
+import os
+from tempfile import TemporaryDirectory
 
 def get_args():
     parser = argparse.ArgumentParser(description="A gdbstub test runner")
@@ -41,11 +43,15 @@ if __name__ == '__main__':
         print("We need gdb to run the test")
         exit(-1)
 
+    socket_dir = TemporaryDirectory("qemu-gdbstub")
+    socket_name = os.path.join(socket_dir.name, "gdbstub.socket")
+
     # Launch QEMU with binary
     if "system" in args.qemu:
         cmd = "%s %s %s -s -S" % (args.qemu, args.qargs, args.binary)
     else:
-        cmd = "%s %s -g 1234 %s" % (args.qemu, args.qargs, args.binary)
+        cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name,
+                                  args.binary)
 
     inferior = subprocess.Popen(shlex.split(cmd))
 
@@ -56,7 +62,10 @@ if __name__ == '__main__':
     # disable prompts in case of crash
     gdb_cmd += " -ex 'set confirm off'"
     # connect to remote
-    gdb_cmd += " -ex 'target remote localhost:1234'"
+    if "system" in args.qemu:
+        gdb_cmd += " -ex 'target remote localhost:1234'"
+    else:
+        gdb_cmd += " -ex 'target remote %s'" % (socket_name)
     # finally the test script itself
     gdb_cmd += " -x %s" % (args.test)
 
-- 
2.20.1