some testing and gdbstub fixes
cover some testing and gdbstub fixes
This is mostly gdbstub focused but I cleaned up some bits while I was in the testing makefiles. This is mostly to make the "check-tcg" output as clean as possible without ugly line wraps. I tried to eliminate the gdbstub info() output but sadly this is harder than expected.
I've tweaked the gdbstub handling for Ctrl-c packets as suggested by Matheus. While I was there I also noticed we were being a bit precious about gdb sending preemptive ACKS so I fixed that as well.
I don't know if this is all late 8.1-rc material but its fairly simple testing updates and the ccache stuff from Daniel should help as well.
Alex Bennée (7):
tests/docker: cleanup non-verbose output tests/tcg: remove quoting for info output
tests: remove test-gdbstub.py
tests/tcg: clean-up gdb confirm/pagination settings tests/tcg: ensure system-mode gdb tests start stopped
gdbstub: more fixes for client Ctrl-C handling
gdbstub: don't complain about preemptive ACK chars
Daniel P. Berrangé (1):
gitlab: enable ccache for many build jobs
docs/devel/ci-jobs.rst.inc | 7 + gdbstub/gdbstub.c | 10 +- .gitlab-ci.d/buildtest-template.yml | 11 ++ .gitlab-ci.d/crossbuild-template.yml | 26 +++ .gitlab-ci.d/windows.yml | 13 +- gdbstub/trace-events | 1 + tests/docker/Makefile.include | 6 +- .../dockerfiles/debian-hexagon-cross.docker | 9 +- tests/guest-debug/run-test.py | 11 +- tests/guest-debug/test-gdbstub.py | 177 ------------------ tests/tcg/aarch64/Makefile.target | 2 +- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 - tests/tcg/aarch64/gdbstub/test-sve.py | 3 - tests/tcg/multiarch/gdbstub/memory.py | 3 - tests/tcg/multiarch/gdbstub/sha1.py | 4 - .../multiarch/gdbstub/test-proc-mappings.py | 4 - .../multiarch/gdbstub/test-qxfer-auxv-read.py | 4 - .../gdbstub/test-thread-breakpoint.py | 4 - .../multiarch/system/Makefile.softmmu-target | 4 +- tests/tcg/s390x/gdbstub/test-signals-s390x.py | 4 - tests/tcg/s390x/gdbstub/test-svc.py | 4 - 21 files changed, 83 insertions(+), 227 deletions(-) delete mode 100644 tests/guest-debug/test-gdbstub.py
Signature · 1 line
2.39.2
PATCH 1/8 gitlab: enable ccache for many build jobs
From: Daniel P. Berrangé <[email protected]>
The ccache tool can be very effective at reducing compilation times when re-running pipelines with only minor changes each time. For example a fresh 'build-system-fedora' job will typically take 20 minutes on the gitlab.com shared runners. With ccache this is reduced to as little as 6 minutes.
Normally meson would auto-detect existance of ccache in $PATH and use it automatically, but the way we wrap meson from configure breaks this, as we're passing in an config file with explicitly set compiler paths. Thus we need to add $CCACHE_WRAPPERSPATH to the front of $PATH. For unknown reasons if doing this in msys though, gcc becomes unable to invoke 'cc1' when run from meson. For msys we thus set CC='ccache gcc' before invoking 'configure' instead.
A second problem with msys is that cache misses are incredibly expensive, so enabling ccache massively slows down the build when the cache isn't well populated. This is suspected to be a result of the cost of spawning processes under the msys architecture. To deal with this we set CCACHE_DEPEND=1 which enables ccache's 'depend_only' strategy. This avoids extra spawning of the pre-processor during cache misses, with the downside that is it less likely ccache will find a cache hit after semantically benign compiler flag changes. This is the lesser of two evils, as otherwise we can't use ccache at all under msys and remain inside the job time limit.
If people are finding ccache to hurt their pipelines, it can be disabled by setting the 'CCACHE_DISABLE=1' env variable against their gitlab fork CI settings.
Message-Id: <[email protected]>
--- docs/devel/ci-jobs.rst.inc | 7 +++++ .gitlab-ci.d/buildtest-template.yml | 11 ++++++++ .gitlab-ci.d/crossbuild-template.yml | 26 +++++++++++++++++++ .gitlab-ci.d/windows.yml | 13 ++++++++-- .../dockerfiles/debian-hexagon-cross.docker | 9 ++++++- 5 files changed, 63 insertions(+), 3 deletions(-)
docs/devel/ci-jobs.rst.inc +7 -0
@@ -188,3 +188,10 @@ If you've got access to a CentOS Stream 8 x86_64 host that can be used as a gitlab-CI runner, you can set this variable to enable the tests that require this kind of host. The runner should be tagged with both "centos_stream_8" and "x86_64". + +CCACHE_DISABLE +~~~~~~~~~~~~~~ +The jobs are configured to use "ccache" by default since this typically +reduces compilation time, at the cost of increased storage. If the +use of "ccache" is suspected to be hurting the overall job execution +time, setting the "CCACHE_DISABLE=1" env variable to disable it.
.gitlab-ci.d/buildtest-template.yml +11 -0
@@ -2,11 +2,21 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache + key: "$CI_JOB_NAME" + when: always before_script: - JOBS=$(expr $(nproc) + 1) script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=system ${TARGETS:+--target-list="$TARGETS"} $CONFIGURE_ARGS ||
@@ -20,6 +30,7 @@ then make -j"$JOBS" $MAKE_CHECK_ARGS ; fi + - ccache --show-stats # We jump some hoops in common_test_job_template to avoid # rebuilding all the object files we skip in the artifacts
.gitlab-ci.d/crossbuild-template.yml +26 -0
@@ -2,10 +2,20 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache + key: "$CI_JOB_NAME" + when: always timeout: 80m script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=system --disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS --target-list-exclude="arm-softmmu cris-softmmu
@@ -18,6 +28,7 @@ version="$(git describe --match v[0-9]* 2>/dev/null || git rev-parse --short HEAD)"; mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi + - ccache --show-stats # Job to cross-build specific accelerators. #
@@ -29,7 +40,15 @@ stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG timeout: 30m + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build - ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
@@ -40,7 +59,14 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" - mkdir build - cd build - ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
.gitlab-ci.d/windows.yml +11 -2
@@ -5,13 +5,14 @@ - windows - windows-1809 cache: - key: "${CI_JOB_NAME}-cache" + key: "$CI_JOB_NAME" paths: - msys64/var/cache + - ccache when: always needs: [] stage: build - timeout: 80m + timeout: 100m variables: # This feature doesn't (currently) work with PowerShell, it stops # the echo'ing of commands being run and doesn't show any timing
@@ -72,6 +73,7 @@ bison diffutils flex git grep make sed $MINGW_TARGET-capstone + $MINGW_TARGET-ccache $MINGW_TARGET-curl $MINGW_TARGET-cyrus-sasl $MINGW_TARGET-dtc
@@ -101,11 +103,18 @@ - Write-Output "Running build at $(Get-Date -Format u)" - $env:CHERE_INVOKING = 'yes' # Preserve the current working directory - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink + - $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR" + - $env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache" + - $env:CCACHE_MAXSIZE = "500M" + - $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode + - $env:CC = "ccache gcc" - mkdir build - cd build + - ..\msys64\usr\bin\bash -lc "ccache --zero-stats" - ..\msys64\usr\bin\bash -lc "../configure --enable-fdt=system $CONFIGURE_ARGS" - ..\msys64\usr\bin\bash -lc "make" - ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;" + - ..\msys64\usr\bin\bash -lc "ccache --show-stats" - Write-Output "Finished build at $(Get-Date -Format u)" msys2-64bit:
tests/docker/dockerfiles/debian-hexagon-cross.docker +8 -1
@@ -15,6 +15,7 @@ RUN apt-get update && \ # Install common build utilities apt-get install -y --no-install-recommends \ curl \ + ccache \ xz-utils \ ca-certificates \ bison \
@@ -24,13 +25,19 @@ RUN apt-get update && \ python3-venv && \ # Install QEMU build deps for use in CI DEBIAN_FRONTEND=noninteractive eatmydata \ - apt build-dep -yy --arch-only qemu + apt build-dep -yy --arch-only qemu && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc ENV TOOLCHAIN_INSTALL /opt ENV TOOLCHAIN_RELEASE 16.0.0 ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unknown-linux-musl" ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolchain-for-hexagon/v${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL" ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu/bin
Signature · 1 line
2.39.2
PATCH 2/8 tests/docker: cleanup non-verbose output
In reply to Alex BennéeEven with --quiet docker will spam the sha256 to the console. Avoid this by redirecting stdout. While we are at it fix the name we echo which was broken during 0b1a649047 (tests/docker: use direct RUNC call to build containers).
--- tests/docker/Makefile.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/docker/Makefile.include +3 -3
@@ -46,9 +46,9 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker --build-arg BUILDKIT_INLINE_CACHE=1 \ $(if $(NOUSER),, \ --build-arg USER=$(USER) \ - --build-arg UID=$(UID)) \ - -t qemu/$* - < $<, \ - "BUILD", $1) + --build-arg UID=$(UID)) \ + -t qemu/$* - < $< $(if $V,,> /dev/null),\ + "BUILD", $*) # Special rule for debootstraped binfmt linux-user images docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
Signature · 1 line
2.39.2
Re: [PATCH 2/8] tests/docker: cleanup non-verbose output
Quoted 15 lines · Alex Bennée
Even with --quiet docker will spam the sha256 to the console. Avoid this by redirecting stdout. While we are at it fix the name we echo which was broken during
0b1a649047(tests/docker: use direct RUNC call to build containers).Signed-off-by Alex Bennée <[email protected]>--- tests/docker/Makefile.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tests/docker/Makefile.include +0
-0
tests/docker/Makefile.include docker-image-%: $(DOCKER_FILES_DIR)/%.docker · line 51
Quoted 9 lines
tests/docker/Makefile.include +3
-3@@ -46,9 +46,9 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker --build-arg BUILDKIT_INLINE_CACHE=1 \ $(if $(NOUSER),, \ --build-arg USER=$(USER) \ - --build-arg UID=$(UID)) \ - -t qemu/$* - < $<, \ - "BUILD", $1) + --build-arg UID=$(UID)) \ + -t qemu/$* - < $< $(if $V,,> /dev/null),\ + "BUILD", $*)
PATCH 3/8 tests/tcg: remove quoting for info output
In reply to Alex BennéeThis avoids ugly multi-line wrapping for the test on non V=1 builds.
--- tests/tcg/aarch64/Makefile.target | 2 +- tests/tcg/multiarch/system/Makefile.softmmu-target | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
tests/tcg/aarch64/Makefile.target +1 -1
@@ -14,7 +14,7 @@ AARCH64_TESTS=fcvt pcalign-a64 fcvt: LDFLAGS+=-lm run-fcvt: fcvt - $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") + $(call run-test,$<,$(QEMU) $<) $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) config-cc.mak: Makefile
tests/tcg/multiarch/system/Makefile.softmmu-target +2 -2
@@ -37,10 +37,10 @@ run-gdbstub-untimely-packet: hello --qemu $(QEMU) \ --bin $< --qargs \ "-monitor none -display none -chardev file$(COMMA)path=untimely-packet.out$(COMMA)id=output $(QEMU_OPTS)", \ - "softmmu gdbstub untimely packets") + softmmu gdbstub untimely packets) $(call quiet-command, \ (! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err), \ - "GREP", "file untimely-packet.gdb.err") + "GREP", file untimely-packet.gdb.err) else run-gdbstub-%: $(call skip-test, "gdbstub test $*", "no guest arch support")
Signature · 1 line
2.39.2
PATCH 4/8 tests: remove test-gdbstub.py
In reply to Alex BennéeThis isn't directly called by our CI and because it doesn't run via our run-test.py script does things slightly differently. Lets remove it as we have plenty of working in-tree tests now for various aspects of gdbstub.
--- tests/guest-debug/test-gdbstub.py | 177 ------------------------------ 1 file changed, 177 deletions(-) delete mode 100644 tests/guest-debug/test-gdbstub.py
tests/guest-debug/test-gdbstub.py deleted +0 -177
@@ -1,177 +0,0 @@ -# -# This script needs to be run on startup -# qemu -kernel ${KERNEL} -s -S -# and then: -# gdb ${KERNEL}.vmlinux -x ${QEMU_SRC}/tests/guest-debug/test-gdbstub.py - -import gdb - -failcount = 0 - - -def report(cond, msg): - "Report success/fail of test" - if cond: - print ("PASS: %s" % (msg)) - else: - print ("FAIL: %s" % (msg)) - global failcount - failcount += 1 - - -def check_step(): - "Step an instruction, check it moved." - start_pc = gdb.parse_and_eval('$pc') - gdb.execute("si") - end_pc = gdb.parse_and_eval('$pc') - - return not (start_pc == end_pc) - - -def check_break(sym_name): - "Setup breakpoint, continue and check we stopped." - sym, ok = gdb.lookup_symbol(sym_name) - bp = gdb.Breakpoint(sym_name) - - gdb.execute("c") - - # hopefully we came back - end_pc = gdb.parse_and_eval('$pc') - print ("%s == %s %d" % (end_pc, sym.value(), bp.hit_count)) - bp.delete() - - # can we test we hit bp? - return end_pc == sym.value() - - -# We need to do hbreak manually as the python interface doesn't export it -def check_hbreak(sym_name): - "Setup hardware breakpoint, continue and check we stopped." - sym, ok = gdb.lookup_symbol(sym_name) - gdb.execute("hbreak %s" % (sym_name)) - gdb.execute("c") - - # hopefully we came back - end_pc = gdb.parse_and_eval('$pc') - print ("%s == %s" % (end_pc, sym.value())) - - if end_pc == sym.value(): - gdb.execute("d 1") - return True - else: - return False - - -class WatchPoint(gdb.Breakpoint): - - def get_wpstr(self, sym_name): - "Setup sym and wp_str for given symbol." - self.sym, ok = gdb.lookup_symbol(sym_name) - wp_addr = gdb.parse_and_eval(sym_name).address - self.wp_str = '*(%(type)s)(&%(address)s)' % dict( - type = wp_addr.type, address = sym_name) - - return(self.wp_str) - - def __init__(self, sym_name, type): - wp_str = self.get_wpstr(sym_name) - super(WatchPoint, self).__init__(wp_str, gdb.BP_WATCHPOINT, type) - - def stop(self): - end_pc = gdb.parse_and_eval('$pc') - print ("HIT WP @ %s" % (end_pc)) - return True - - -def do_one_watch(sym, wtype, text): - - wp = WatchPoint(sym, wtype) - gdb.execute("c") - report_str = "%s for %s (%s)" % (text, sym, wp.sym.value()) - - if wp.hit_count > 0: - report(True, report_str) - wp.delete() - else: - report(False, report_str) - - -def check_watches(sym_name): - "Watch a symbol for any access." - - # Should hit for any read - do_one_watch(sym_name, gdb.WP_ACCESS, "awatch") - - # Again should hit for reads - do_one_watch(sym_name, gdb.WP_READ, "rwatch") - - # Finally when it is written - do_one_watch(sym_name, gdb.WP_WRITE, "watch") - - -class CatchBreakpoint(gdb.Breakpoint): - def __init__(self, sym_name): - super(CatchBreakpoint, self).__init__(sym_name) - self.sym, ok = gdb.lookup_symbol(sym_name) - - def stop(self): - end_pc = gdb.parse_and_eval('$pc') - print ("CB: %s == %s" % (end_pc, self.sym.value())) - if end_pc == self.sym.value(): - report(False, "Hit final catchpoint") - - -def run_test(): - "Run through the tests one by one" - - print ("Checking we can step the first few instructions") - step_ok = 0 - for i in range(3): - if check_step(): - step_ok += 1 - - report(step_ok == 3, "single step in boot code") - - print ("Checking HW breakpoint works") - break_ok = check_hbreak("kernel_init") - report(break_ok, "hbreak @ kernel_init") - - # Can't set this up until we are in the kernel proper - # if we make it to run_init_process we've over-run and - # one of the tests failed - print ("Setup catch-all for run_init_process") - cbp = CatchBreakpoint("run_init_process") - cpb2 = CatchBreakpoint("try_to_run_init_process") - - print ("Checking Normal breakpoint works") - break_ok = check_break("wait_for_completion") - report(break_ok, "break @ wait_for_completion") - - print ("Checking watchpoint works") - check_watches("system_state") - -# -# This runs as the script it sourced (via -x) -# - -try: - print ("Connecting to remote") - gdb.execute("target remote localhost:1234") - - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - - # Run the actual tests - run_test() - -except: - print ("GDB Exception: %s" % (sys.exc_info()[0])) - failcount += 1 - import code - code.InteractiveConsole(locals=globals()).interact() - raise - -# Finally kill the inferior and exit gdb with a count of failures -gdb.execute("kill") -exit(failcount)
Signature · 1 line
2.39.2
Re: [PATCH 4/8] tests: remove test-gdbstub.py
Quoted 10 lines · Alex Bennée
This isn't directly called by our CI and because it doesn't run via our
run-test.pyscript does things slightly differently. Lets remove it as we have plenty of working in-tree tests now for various aspects of gdbstub.Signed-off-by Alex Bennée<[email protected]>--- tests/guest-debug/test-gdbstub.py | 177 ------------------------------ 1 file changed, 177 deletions(-)delete mode 100644
tests/guest-debug/test-gdbstub.py
The first sentence could be clearer. But as it's unused,
r~
PATCH 5/8 tests/tcg: clean-up gdb confirm/pagination settings
In reply to Alex BennéeWe can do this all in the run-test.py script so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests.
--- tests/guest-debug/run-test.py | 2 ++ tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- tests/tcg/multiarch/gdbstub/memory.py | 3 --- tests/tcg/multiarch/gdbstub/sha1.py | 4 ---- tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 4 ---- tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py | 4 ---- tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 4 ---- tests/tcg/s390x/gdbstub/test-signals-s390x.py | 4 ---- tests/tcg/s390x/gdbstub/test-svc.py | 4 ---- 10 files changed, 2 insertions(+), 33 deletions(-)
tests/guest-debug/run-test.py +2 -0
@@ -86,6 +86,8 @@ def log(output, msg): gdb_cmd += " %s" % (args.gdb_args) # run quietly and ignore .gdbinit gdb_cmd += " -q -n -batch" + # disable pagination + gdb_cmd += " -ex 'set pagination off'" # disable prompts in case of crash gdb_cmd += " -ex 'set confirm off'" # connect to remote
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +0 -3
@@ -76,9 +76,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except:
tests/tcg/aarch64/gdbstub/test-sve.py +0 -3
@@ -66,9 +66,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except:
tests/tcg/multiarch/gdbstub/memory.py +0 -3
@@ -115,9 +115,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except (gdb.error):
tests/tcg/multiarch/gdbstub/sha1.py +0 -4
@@ -73,10 +73,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error):
tests/tcg/multiarch/gdbstub/test-proc-mappings.py +0 -4
@@ -51,10 +51,6 @@ def main(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except gdb.error:
tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py +0 -4
@@ -42,10 +42,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error):
tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py +0 -4
@@ -45,10 +45,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error):
tests/tcg/s390x/gdbstub/test-signals-s390x.py +0 -4
@@ -61,10 +61,6 @@ def run_test(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error):
tests/tcg/s390x/gdbstub/test-svc.py +0 -4
@@ -49,10 +49,6 @@ def main(): exit(0) try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except gdb.error:
Signature · 1 line
2.39.2
Re: [PATCH 5/8] tests/tcg: clean-up gdb confirm/pagination settings
Quoted 5 lines · Alex Bennée
We can do this all in the
run-test.pyscript so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests.Signed-off-by Alex Bennée <[email protected]>
Quoted 12 lines
--- tests/guest-debug/run-test.py | 2 ++ tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- tests/tcg/multiarch/gdbstub/memory.py | 3 --- tests/tcg/multiarch/gdbstub/sha1.py | 4 ---- tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 4 ---- tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py | 4 ---- tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 4 ---- tests/tcg/s390x/gdbstub/test-signals-s390x.py | 4 ---- tests/tcg/s390x/gdbstub/test-svc.py | 4 ---- 10 files changed, 2 insertions(+), 33 deletions(-)
Re: [PATCH 5/8] tests/tcg: clean-up gdb confirm/pagination settings
In reply to Alex BennéeQuoted 5 lines · Alex Bennée
We can do this all in the
run-test.pyscript so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests.Signed-off-by Alex Bennée<[email protected]>
Quoted 12 lines
--- tests/guest-debug/run-test.py | 2 ++ tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- tests/tcg/multiarch/gdbstub/memory.py | 3 --- tests/tcg/multiarch/gdbstub/sha1.py | 4 ---- tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 4 ---- tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py | 4 ---- tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 4 ---- tests/tcg/s390x/gdbstub/test-signals-s390x.py | 4 ---- tests/tcg/s390x/gdbstub/test-svc.py | 4 ---- 10 files changed, 2 insertions(+), 33 deletions(-)
r~
PATCH 6/8 tests/tcg: ensure system-mode gdb tests start stopped
In reply to Alex BennéeWithout -S we run into potential races with tests starting before the gdbstub attaches. We don't need to worry about user-mode as enabling the gdbstub implies we wait for the initial connection.
--- tests/guest-debug/run-test.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
tests/guest-debug/run-test.py +3 -6
@@ -69,13 +69,10 @@ def log(output, msg): # Launch QEMU with binary if "system" in args.qemu: - cmd = "%s %s %s -gdb unix:path=%s,server=on" % (args.qemu, - args.qargs, - args.binary, - socket_name) + cmd = f'{args.qemu} {args.qargs} {args.binary}' \ + f' -S -gdb unix:path={socket_name},server=on' else: - cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, - args.binary) + cmd = f'{args.qemu} {args.qargs} -g {socket_name} {args.binary}' log(output, "QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd))
Signature · 1 line
2.39.2
Re: [PATCH 6/8] tests/tcg: ensure system-mode gdb tests start stopped
Quoted 8 lines · Alex Bennée
Without -S we run into potential races with tests starting before the gdbstub attaches. We don't need to worry about user-mode as enabling the gdbstub implies we wait for the initial connection.
Signed-off-by Alex Bennée <[email protected]>--- tests/guest-debug/run-test.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Re: [PATCH 6/8] tests/tcg: ensure system-mode gdb tests start stopped
In reply to Alex BennéeQuoted 8 lines · Alex Bennée
Without -S we run into potential races with tests starting before the gdbstub attaches. We don't need to worry about user-mode as enabling the gdbstub implies we wait for the initial connection.
Signed-off-by Alex Bennée<[email protected]>--- tests/guest-debug/run-test.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
r~
PATCH 7/8 gdbstub: more fixes for client Ctrl-C handling
In reply to Alex BennéeThe original fix caused problems with spurious characters on other system emulation. So:
- instead of spamming output make the warning a trace point
- ensure we only allow a stop reply if it was 0x3
Message-Id: <456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_mathbern@quicinc.com>
--- gdbstub/gdbstub.c | 5 +++-- gdbstub/trace-events | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
gdbstub/gdbstub.c +3 -2
@@ -2059,9 +2059,10 @@ void gdb_read_byte(uint8_t ch)* here, but it does expect a stop reply. */ if (ch !=0x03 ) { -warn_report ("gdbstub: client sent packet while target running\n" ); +trace_gdbstub_err_unexpected_runpkt (ch); + }else { + gdbserver_state.allow_stop_reply = true; } - gdbserver_state.allow_stop_reply = true;vm_stop (RUN_STATE_PAUSED ); } else#endif
gdbstub/trace-events +1 -0
@@ -26,6 +26,7 @@ gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x" gdbstub_err_invalid_rle(void) "got invalid RLE sequence" gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x" gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x" +gdbstub_err_unexpected_runpkt(uint8_t ch) "unexpected packet (%c) while target running" # softmmu.c gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 ""
Signature · 1 line
2.39.2
Re: [PATCH 7/8] gdbstub: more fixes for client Ctrl-C handling
Quoted 20 lines · Alex Bennée
The original fix caused problems with spurious characters on other system emulation. So:
- instead of spamming output make the warning a trace point
- ensure we only allow a stop reply if it was0x3Suggested-by Matheus Tavares Bernardino <[email protected]>Signed-off-by Alex Bennée <[email protected]>Message-Id: <456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_mathbern@quicinc.com>
--- gdbstub/gdbstub.c | 5 +++-- gdbstub/trace-events | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)gdbstub/trace-events +0
-0
gdbstub/trace-events gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x" · line 29
Quoted 4 lines
gdbstub/trace-events +1
-0@@ -26,6 +26,7 @@ gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x" gdbstub_err_invalid_rle(void) "got invalid RLE sequence" gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x" gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x" +gdbstub_err_unexpected_runpkt(uint8_t ch) "unexpected packet (%c) while target running"
Since unexpected packet can be non-ASCII, better log its hexa value.
Otherwise,
Re: [PATCH 7/8] gdbstub: more fixes for client Ctrl-C handling
In reply to Alex BennéeQuoted 6 lines · Alex Bennée
The original fix caused problems with spurious characters on other system emulation. So:
- instead of spamming output make the warning a trace point
- ensure we only allow a stop reply if it was0x3
Quoted 7 lines
Suggested-by Matheus Tavares Bernardino<[email protected]>Signed-off-by Alex Bennée<[email protected]>Message-Id:<456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_mathbern@quicinc.com>
--- gdbstub/gdbstub.c | 5 +++-- gdbstub/trace-events | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
r~
PATCH 8/8 gdbstub: don't complain about preemptive ACK chars
In reply to Alex BennéeWhen starting a remote connection GDB sends an '+':
/* Ack any packet which the remote side has already sent. */ remote_serial_write ("+", 1);
which gets flagged as a garbage character in the gdbstub state machine. As gdb does send it out lets be permissive about the handling so we can better see real issues.
--- gdbstub/gdbstub.c | 5 +++++ 1 file changed, 5 insertions(+)
gdbstub/gdbstub.c +5 -0
@@ -2074,6 +2074,11 @@ void gdb_read_byte(uint8_t ch) gdbserver_state.line_buf_index =0 ; gdbserver_state.line_sum =0 ; gdbserver_state.state =RS_GETLINE ; + }else if (ch =='+' ) { +/* +* do nothing, gdb may preemptively send out ACKs on +* initial connection +*/ }else {trace_gdbstub_err_garbage (ch); }
Signature · 1 line
2.39.2
Re: [PATCH 8/8] gdbstub: don't complain about preemptive ACK chars
Quoted 9 lines · Alex Bennée
When starting a remote connection GDB sends an '+':
/* Ack any packet which the remote side has already sent. */ remote_serial_write ("+", 1);which gets flagged as a garbage character in the gdbstub state machine. As gdb does send it out lets be permissive about the handling so we can better see real issues.
Quoted 5 lines
Signed-off-by Alex Bennée <[email protected]>--- gdbstub/gdbstub.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 7 lines · Alex Bennée
This is mostly gdbstub focused but I cleaned up some bits while I was in the testing makefiles. This is mostly to make the "check-tcg" output as clean as possible without ugly line wraps. I tried to eliminate the gdbstub
info()output but sadly this is harder than expected.
Quoted 6 lines
I've tweaked the gdbstub handling for Ctrl-c packets as suggested by Matheus. While I was there I also noticed we were being a bit precious about gdb sending preemptive ACKS so I fixed that as well.
I don't know if this is all late 8.1-rc material but its fairly simple testing updates and the ccache stuff from Daniel should help as well.
At this point in the cycle I would favour putting in the minimum that actually fixes bugs / test failure issues.
thanks
-- PMM
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Alex Bennée
This is mostly gdbstub focused but I cleaned up some bits while I was in the testing makefiles. This is mostly to make the "check-tcg" output as clean as possible without ugly line wraps. I tried to eliminate the gdbstub
info()output but sadly this is harder than expected.I've tweaked the gdbstub handling for Ctrl-c packets as suggested by Matheus. While I was there I also noticed we were being a bit precious about gdb sending preemptive ACKS so I fixed that as well.
Quoted 5 lines
Quoted 2 lines
I don't know if this is all late 8.1-rc material but its fairly simple testing updates and the ccache stuff from Daniel should help as well.
At this point in the cycle I would favour putting in the minimum that actually fixes bugs / test failure issues.
Indeed. Which I think would be patches 7 and 8.
r~
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Alex Bennée
This is mostly gdbstub focused but I cleaned up some bits while I was in the testing makefiles. This is mostly to make the "check-tcg" output as clean as possible without ugly line wraps. I tried to eliminate the gdbstub
info()output but sadly this is harder than expected.I've tweaked the gdbstub handling for Ctrl-c packets as suggested by Matheus. While I was there I also noticed we were being a bit precious about gdb sending preemptive ACKS so I fixed that as well.
Quoted 5 lines
Quoted 2 lines
I don't know if this is all late 8.1-rc material but its fairly simple testing updates and the ccache stuff from Daniel should help as well.
At this point in the cycle I would favour putting in the minimum that actually fixes bugs / test failure issues.
So 7 and 8? I would argue for 6 as well given that's a foot gun just waiting to happen.
Quoted 3 lines
thanks
-- PMM
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 2 lines · Alex Bennée
So 7 and 8? I would argue for 6 as well given that's a foot gun just waiting to happen.
Yes, the timing issues with 6 are nasty.
r~
Quoted 5 lines · Richard Henderson
Quoted 2 lines · Alex Bennée
So 7 and 8? I would argue for 6 as well given that's a foot gun just waiting to happen.
Yes, the timing issues with 6 are nasty.
I'm going to queue 6-8 to tcg-next, along with the %x change Phil suggested for logging non-ASCII characters.
r~