testing and gdbstub updates
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
Signature · 1 line
2.20.1
[PULL 09/14] tests/tcg: drop inferior.was_attached() test
This test seems flaky and reports attachment even when we failed to negotiate the architecture. However the fetching of the guest architecture will fail tripping up the gdb AttributeError which will trigger our early no error status exit from the test
Message-Id: <[email protected]>
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +0 -3
@@ -58,9 +58,6 @@ def run_test(): # try: inferior = gdb.selected_inferior() - if inferior.was_attached == False: - print("SKIPPING (failed to attach)", file=sys.stderr) - exit(0) arch = inferior.architecture() report(arch.name() == "aarch64", "connected to aarch64") except (gdb.error, AttributeError):
tests/tcg/aarch64/gdbstub/test-sve.py +0 -3
@@ -59,9 +59,6 @@ def run_test(): # try: inferior = gdb.selected_inferior() - if inferior.was_attached == False: - print("SKIPPING (failed to attach)", file=sys.stderr) - exit(0) arch = inferior.architecture() report(arch.name() == "aarch64", "connected to aarch64") except (gdb.error, AttributeError):
Signature · 1 line
2.20.1
[PULL 08/14] tests/tcg: better trap gdb failures
In reply to Alex BennéeIt seems older and non-multiarach aware GDBs might not fail gracefully when faced with something they don't know. For example when faced with a target XML for s390x the Ubuntu 18.04 gdb will generate an internal fault and prompt for a core dump.
Work around this by invoking GDB in a more batch orientated way and then trying to filter out between test failures and gdb failures.
Message-Id: <[email protected]>
tests/guest-debug/run-test.py +18 -1
@@ -50,8 +50,25 @@ if __name__ == '__main__': inferior = subprocess.Popen(shlex.split(cmd)) # Now launch gdb with our test and collect the result - gdb_cmd = "%s %s -ex 'target remote localhost:1234' -x %s" % (args.gdb, args.binary, args.test) + gdb_cmd = "%s %s" % (args.gdb, args.binary) + # run quietly and ignore .gdbinit + gdb_cmd += " -q -n -batch" + # disable prompts in case of crash + gdb_cmd += " -ex 'set confirm off'" + # connect to remote + gdb_cmd += " -ex 'target remote localhost:1234'" + # finally the test script itself + gdb_cmd += " -x %s" % (args.test) + + print("GDB CMD: %s" % (gdb_cmd)) result = subprocess.call(gdb_cmd, shell=True); + # A negative result is the result of an internal gdb failure like + # a crash. We force a return of 0 so we don't fail the test on + # account of broken external tools. + if result < 0: + print("GDB crashed? SKIPPING") + exit(0) + exit(result)
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +0 -1
@@ -70,7 +70,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") # Run the actual tests run_test()
tests/tcg/aarch64/gdbstub/test-sve.py +0 -1
@@ -71,7 +71,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") # Run the actual tests run_test()
Signature · 1 line
2.20.1
[PULL 13/14] tests/tcg: add a multiarch linux-user gdb test
In reply to Alex BennéeWhen the gdbstub code was converted to the new API we missed a few snafus in the various guests. Add a simple gdb test script which can be used on all our linux-user guests to check for obvious failures.
Message-Id: <[email protected]>
tests/tcg/aarch64/Makefile.target +2 -3
@@ -54,9 +54,6 @@ sve-ioctls: CFLAGS+=-march=armv8.1-a+sve ifneq ($(HAVE_GDB_BIN),) GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py -AARCH64_TESTS += gdbstub-sysregs gdbstub-sve-ioctls - -.PHONY: gdbstub-sysregs gdbstub-sve-ioctls run-gdbstub-sysregs: sysregs $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \
@@ -70,6 +67,8 @@ run-gdbstub-sve-ioctls: sve-ioctls --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \ "basic gdbstub SVE ZLEN support") + +EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls endif endif
tests/tcg/cris/Makefile.target +1 -0
@@ -23,6 +23,7 @@ CRIS_RUNS = $(patsubst %, run-%, $(CRIS_USABLE_TESTS)) # override the list of tests, as we can't build the multiarch tests TESTS = $(CRIS_USABLE_TESTS) +EXTRA_RUNS = VPATH = $(CRIS_SRC) AS = $(CC) -x assembler-with-cpp
tests/tcg/multiarch/Makefile.target +14 -0
@@ -42,5 +42,19 @@ run-test-mmap-%: test-mmap $(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\ "$< ($* byte pages) on $(TARGET_NAME)") +ifneq ($(HAVE_GDB_BIN),) +GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py + +run-gdbstub-sha1: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ + "basic gdbstub support") + +EXTRA_RUNS += run-gdbstub-sha1 +endif + + # Update TESTS TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/gdbstub/sha1.py new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 02/14] .travis.yml: drop MacOSX
In reply to Alex BennéeThis 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.
Message-Id: <[email protected]>
.travis.yml +1 -27
@@ -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:
Signature · 1 line
2.20.1
[PULL 03/14] .cirrus.yml: bump FreeBSD to the current stable release
In reply to Alex BennéeHopefully this will un-stick the test which has been broken for a long time.
Message-Id: <[email protected]>
.cirrus.yml +1 -1
@@ -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
Signature · 1 line
2.20.1
[PULL 06/14] configure: favour gdb-multiarch if we have it
In reply to Alex BennéeAs gdb will generally be talking to "foreign" guests lets use that if we can. Otherwise the chances of gdb barfing are considerably higher.
Message-Id: <[email protected]>
configure +1 -1
@@ -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
Signature · 1 line
2.20.1
[PULL 07/14] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
When converted to use GByteArray in commits 462474d760c and a010bdbe719, the call to stfq_p() was removed. This call serialize a float.
Since we now use a GByteArray, we can not use stfq_p() directly. Introduce the gdb_get_float64() helper to load a float64 register.
Message-Id: <[email protected]>
Message-Id: <[email protected]>
include/exec/gdbstub.h +11 -0
@@ -134,6 +134,17 @@ static inline int gdb_get_float32(GByteArray *array, float32 val)return sizeof (buf); } + +static inline int gdb_get_float64 (GByteArray *array,float64 val) +{ +uint8_t buf[sizeof (CPU_DoubleU)]; + +stfq_p (buf, val); +g_byte_array_append (array, buf,sizeof (buf)); + +return sizeof (buf); +} +static inline int gdb_get_zeroes (GByteArray *array,size_t len) {guint oldlen = array->len;
target/m68k/helper.c +2 -1
@@ -72,7 +72,8 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) {if (n <8 ) {float_status s; -return gdb_get_reg64 (mem_buf,floatx80_to_float64 (env->fregs[n].d, &s)); +return gdb_get_float64 (mem_buf, +floatx80_to_float64 (env->fregs[n].d, &s)); }switch (n) {case 8 :/* fpcontrol */
target/ppc/gdbstub.c +2 -2
@@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray *buf, int n)gdb_get_regl (buf, env->gpr[n]); }else if (n <64 ) {/* fprs */ -gdb_get_reg64 (buf, *cpu_fpr_ptr (env, n -32 )); +gdb_get_float64 (buf, *cpu_fpr_ptr (env, n -32 )); }else {switch (n) {case 64 :
@@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByteArray *buf, int n)gdb_get_reg64 (buf, env->gpr[n]); }else if (n <64 ) {/* fprs */ -gdb_get_reg64 (buf, *cpu_fpr_ptr (env, n -32 )); +gdb_get_float64 (buf, *cpu_fpr_ptr (env, n -32 )); }else if (n <96 ) {/* Altivec */ gdb_get_reg64 (buf, n -64 );
target/ppc/translate_init.inc.c +1 -1
@@ -9881,7 +9881,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteArray *buf, int n) {uint8_t *mem_buf;if (n <32 ) { -gdb_get_reg64 (buf, *cpu_fpr_ptr (env, n)); +gdb_get_float64 (buf, *cpu_fpr_ptr (env, n)); mem_buf =gdb_get_reg_ptr (buf,8 );ppc_maybe_bswap_register (env, mem_buf,8 );return 8 ;
Signature · 1 line
2.20.1
[PULL 01/14] .travis.yml: show free disk space at end of run
In reply to Alex BennéeMessage-Id: <[email protected]>
.travis.yml +1 -0
@@ -113,6 +113,7 @@ script: $(exit $BUILD_RC); fi after_script: + - df -h - if command -v ccache ; then ccache --show-stats ; fi
Signature · 1 line
2.20.1
[PULL 10/14] gdbstub: eliminate gdbserver_fd global
In reply to Alex BennéeWe 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.
Message-Id: <[email protected]>
gdbstub.c +11 -13
@@ -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);
Signature · 1 line
2.20.1
[PULL 12/14] tests/guest-debug: use the unix socket for linux-user tests
In reply to Alex BennéeNow we have support for debugging over a unix socket for linux-user lets use it in our test harness.
Message-Id: <[email protected]>
tests/guest-debug/run-test.py +11 -2
@@ -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)
Signature · 1 line
2.20.1
[PULL 04/14] .cirrus.yml: bootstrap pkg unconditionally
In reply to Alex BennéeFrom: Li-Wen Hsu <[email protected]>
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>
.cirrus.yml +1 -1
@@ -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:
Signature · 1 line
2.20.1
[PULL 14/14] target/m68k: fix gdb for m68xxx
In reply to Alex BennéeFrom: KONRAD Frederic <[email protected]>
Currently "cf-core.xml" is sent to GDB when using any m68k flavor. Thing is it uses the "org.gnu.gdb.coldfire.core" feature name and gdb 8.3 then expects a coldfire FPU instead of the default m68881 FPU.
This is not OK because the m68881 floats registers are 96 bits wide so it crashes GDB with the following error message:
(gdb) target remote localhost:7960
Remote debugging using localhost:7960
warning: Register "fp0" has an unsupported size (96 bits)
warning: Register "fp1" has an unsupported size (96 bits)
...
Remote 'g' packet reply is too long (expected 148 bytes, got 180 bytes): \
00000000000[...]0000
With this patch: qemu-system-m68k -M none -cpu m68020 -s -S
(gdb) tar rem :1234
Remote debugging using :1234
warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x00000000 in ?? ()
(gdb) p $fp0
$1 = nan(0xffffffffffffffff)
Message-Id: <[email protected]>
Message-Id: <[email protected]>
configure +1 -1
@@ -7825,7 +7825,7 @@ case "$target_name" in ;; m68k) bflt="yes" - gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" + gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" TARGET_SYSTBL_ABI=common ;; microblaze|microblazeel)
target/m68k/cpu.c +37 -15
68 lines not on this page · raw message
gdb-xml/m68k-core.xml new file +29 -0
@@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- Copyright (C) 2008 Free Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. --> +<!DOCTYPE feature SYSTEM "gdb-target.dtd"> +<feature name="org.gnu.gdb.m68k.core"> + <reg name="d0" bitsize="32"/> + <reg name="d1" bitsize="32"/> + <reg name="d2" bitsize="32"/> + <reg name="d3" bitsize="32"/> + <reg name="d4" bitsize="32"/> + <reg name="d5" bitsize="32"/> + <reg name="d6" bitsize="32"/> + <reg name="d7" bitsize="32"/> + <reg name="a0" bitsize="32" type="data_ptr"/> + <reg name="a1" bitsize="32" type="data_ptr"/> + <reg name="a2" bitsize="32" type="data_ptr"/> + <reg name="a3" bitsize="32" type="data_ptr"/> + <reg name="a4" bitsize="32" type="data_ptr"/> + <reg name="a5" bitsize="32" type="data_ptr"/> + <reg name="fp" bitsize="32" type="data_ptr"/> + <reg name="sp" bitsize="32" type="data_ptr"/> + + <reg name="ps" bitsize="32"/> + <reg name="pc" bitsize="32" type="code_ptr"/> + +</feature>
Signature · 1 line
2.20.1
[PULL 05/14] .travis.yml: reduce the load on [ppc64] GCC check-tcg
In reply to Alex BennéeThis seems to be timing out quite often and occasionally running out of disk space. Relegate it to light duties.
Message-Id: <[email protected]>
.travis.yml +1 -1
@@ -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
Signature · 1 line
2.20.1
[PULL 11/14] gdbstub/linux-user: support debugging over a unix socket
In reply to Alex BennéeWhile debugging over TCP is fairly straightforward now we have test cases that want to orchestrate via make and currently a parallel build fails as two processes can't use the same listening port. While system emulation offers a wide cornucopia of connection methods thanks to the chardev abstraction we are a little more limited for linux user. Thankfully the programming API for a TCP socket and a local UNIX socket is pretty much the same once it's set up.
Message-Id: <[email protected]>
include/exec/gdbstub.h +9 -5
@@ -177,11 +177,15 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len)#endif -#ifdef CONFIG_USER_ONLY -int gdbserver_start (int ); -#else -int gdbserver_start (const char *port); -#endif +/** +* gdbserver_start: start the gdb server +* @port_or_device: connection spec for gdb +* +* For CONFIG_USER this is either a tcp port or a path to a fifo. For +* system emulation you can use a full chardev spec for your gdbserver +* port. +*/ +int gdbserver_start (const char *port_or_device);void gdbserver_cleanup (void );
bsd-user/main.c +4 -4
@@ -738,7 +738,7 @@ int main(int argc, char **argv)CPUState *cpu;int optind;const char *r; -int gdbstub_port =0 ; +const char *gdbstub =NULL ;char **target_environ, **wrk;envlist_t *envlist =NULL ;char *trace_file =NULL ;
@@ -814,7 +814,7 @@ int main(int argc, char **argv)exit (1 ); } }else if (!strcmp (r,"g" )) { - gdbstub_port =atoi (argv[optind++]); + gdbstub =g_strdup (argv[optind++]); }else if (!strcmp (r,"r" )) { qemu_uname_release = argv[optind++]; }else if (!strcmp (r,"cpu" )) {
@@ -1124,8 +1124,8 @@ int main(int argc, char **argv)#error unsupported target CPU#endif -if (gdbstub_port) { -gdbserver_start (gdbstub_port); +if (gdbstub) { +gdbserver_start (gdbstub);gdb_handlesig (cpu,0 ); }cpu_loop (env);
gdbstub.c +87 -16
144 lines not on this page · raw message
linux-user/main.c +6 -6
@@ -51,7 +51,7 @@ char *exec_path;int singlestep;static const char *argv0; -static int gdbstub_port; +static const char *gdbstub;static envlist_t *envlist;static const char *cpu_model;static const char *cpu_type;
@@ -310,7 +310,7 @@ static void handle_arg_seed(const char *arg)static void handle_arg_gdb (const char *arg) { - gdbstub_port =atoi (arg); + gdbstub =g_strdup (arg); }static void handle_arg_uname (const char *arg)
@@ -861,10 +861,10 @@ int main(int argc, char **argv, char **envp)target_cpu_copy_regs (env, regs); -if (gdbstub_port) { -if (gdbserver_start (gdbstub_port) <0 ) { -fprintf (stderr,"qemu: could not open gdbserver on port %d\n" , - gdbstub_port); +if (gdbstub) { +if (gdbserver_start (gdbstub) <0 ) { +fprintf (stderr,"qemu: could not open gdbserver on %s\n" , + gdbstub);exit (EXIT_FAILURE ); }gdb_handlesig (cpu,0 );
Signature · 1 line
2.20.1
Peter Maydell
AppliedQuoted 13 lines · Alex Bennée
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)
Quoted 8 lines
----------------------------------------------------------------
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