qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Gustavo Romero <gustavo.romero@linaro.org>,
	qemu-devel@nongnu.org, alex.bennee@linaro.org,
	berrange@redhat.com
Cc: qemu-arm@nongnu.org, manos.pitsidianakis@linaro.org,
	peter.maydell@linaro.org
Subject: Re: [PATCH v4 8/9] tests/functional: Adapt reverse_debugging to run w/o Avocado
Date: Fri, 26 Sep 2025 10:44:19 +0200	[thread overview]
Message-ID: <ec28971b-fe8c-4a6a-b241-10ff1468c991@redhat.com> (raw)
In-Reply-To: <20250926051542.104432-9-gustavo.romero@linaro.org>

On 26/09/2025 07.15, Gustavo Romero wrote:
> This commit removes Avocado as a dependency for running the
> reverse_debugging test.
> 
> The main benefit, beyond eliminating an extra dependency, is that there
> is no longer any need to handle GDB packets manually. This removes the
> need for ad-hoc functions dealing with endianness and arch-specific
> register numbers, making the test easier to read. The timeout variable
> is also removed, since Meson now manages timeouts automatically.
> 
> reverse_debugging now uses the pygdbmi module to interact with GDB, if
> it's available in the test environment, otherwise the test is skipped.
> GDB is detect via the QEMU_TEST_GDB env. variable.
> 
> This commit also significantly improves the output for the test and
> now prints all the GDB commands used in sequence. It also adds
> some clarifications to existing comments, for example, clarifying that
> once the replay-break is reached, a SIGINT is captured in GDB.
> 
> reverse_debugging is kept "skipped" for aarch64, ppc64, and x86_64, so
> won't run unless QEMU_TEST_FLAKY_TESTS=1 is set in the test environment,
> before running 'make check-functional' or 'meson test [...]'.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> ---
...
> @@ -53,49 +55,11 @@ def run_vm(self, record, shift, args, replay_path, image_path, port):
>           vm.launch()
>           return vm
>   
> -    @staticmethod
> -    def get_reg_le(g, reg):
> -        res = g.cmd(b'p%x' % reg)
> -        num = 0
> -        for i in range(len(res))[-2::-2]:
> -            num = 0x100 * num + int(res[i:i + 2], 16)
> -        return num
> -
> -    @staticmethod
> -    def get_reg_be(g, reg):
> -        res = g.cmd(b'p%x' % reg)
> -        return int(res, 16)
> -
> -    def get_reg(self, g, reg):
> -        # value may be encoded in BE or LE order
> -        if self.endian_is_le:
> -            return self.get_reg_le(g, reg)
> -        else:
> -            return self.get_reg_be(g, reg)
> -
> -    def get_pc(self, g):
> -        return self.get_reg(g, self.REG_PC)
> -
> -    def check_pc(self, g, addr):
> -        pc = self.get_pc(g)
> -        if pc != addr:
> -            self.fail('Invalid PC (read %x instead of %x)' % (pc, addr))

I think it would make sense to keep wrapper functions get_pc() and 
check_pc(), since that functionality is still used in a bunch of places 
(e.g. "gdb.cli("print $pc").get_addr()" is used a couple of times).

> @@ -124,68 +88,99 @@ def reverse_debugging(self, shift=7, args=None):
>           with Ports() as ports:
>               port = ports.find_free_port()
>               vm = self.run_vm(False, shift, args, replay_path, image_path, port)
> -        logger.info('connecting to gdbstub')
> -        g = gdb.GDBRemote('127.0.0.1', port, False, False)
> -        g.connect()
> -        r = g.cmd(b'qSupported')
> -        if b'qXfer:features:read+' in r:
> -            g.cmd(b'qXfer:features:read:target.xml:0,ffb')
> -        if b'ReverseStep+' not in r:
> +
> +        try:
> +            logger.info('Connecting to gdbstub...')
> +            self.reverse_debugging_run(vm, port, last_icount)
> +            logger.info('Test passed.')
> +        except GdbTimeoutError:
> +            self.fail("Connection to gdbstub timeouted...")

I'm not a native English speaker, but I think "timeout" is not a verb. So 
maybe better: "Timeout while connecting to gdbstub" or something similar?

> +    @skipIfMissingEnv("QEMU_TEST_GDB")

Somehow this SKIP is always triggered on my system, even if I correctly 
pointed "configure" to the right GDB with the "--gdb" option ... not sure 
why this happens, but I'll try to find out...

  Thomas



  reply	other threads:[~2025-09-26  8:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26  5:15 [PATCH v4 0/9] tests/functional: Adapt reverse_debugging to run w/o Avocado Gustavo Romero
2025-09-26  5:15 ` [PATCH v4 1/9] tests/functional: Re-activate the check-venv target Gustavo Romero
2025-09-26  6:28   ` Thomas Huth
2025-09-26  8:34   ` Thomas Huth
2025-09-26  8:37     ` Daniel P. Berrangé
2025-09-26  8:42       ` Thomas Huth
2025-09-26  8:50         ` Daniel P. Berrangé
2025-09-26 15:44           ` Gustavo Romero
2025-09-26 15:47             ` Daniel P. Berrangé
2025-09-26 16:02               ` Gustavo Romero
2025-09-26 15:43     ` Gustavo Romero
2025-09-29  6:26       ` Thomas Huth
2025-09-29  6:29         ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 2/9] python: Install pygdbmi in meson's venv Gustavo Romero
2025-09-26  6:28   ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 3/9] tests/functional: Provide GDB to the functional tests Gustavo Romero
2025-09-26 10:03   ` Thomas Huth
2025-09-26 18:08     ` Gustavo Romero
2025-09-26 18:15       ` Gustavo Romero
2025-09-29  6:34         ` Thomas Huth
2025-09-29  8:03           ` Daniel P. Berrangé
2025-09-26  5:15 ` [PATCH v4 4/9] tests/functional: Add GDB class Gustavo Romero
2025-09-26  7:05   ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 5/9] tests/functional: replace avocado process with subprocess Gustavo Romero
2025-09-26  7:10   ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 6/9] tests/functional: drop datadrainer class in reverse debugging Gustavo Romero
2025-09-26  7:13   ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 7/9] tests/functional: Add decorator to skip test on missing env vars Gustavo Romero
2025-09-26  7:20   ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 8/9] tests/functional: Adapt reverse_debugging to run w/o Avocado Gustavo Romero
2025-09-26  8:44   ` Thomas Huth [this message]
2025-09-26 16:00     ` Gustavo Romero
2025-09-29  6:24       ` Thomas Huth
2025-09-26  5:15 ` [PATCH v4 9/9] tests/functional: Adapt arches to reverse_debugging " Gustavo Romero
2025-09-26  9:09   ` Thomas Huth
2025-09-26  6:49 ` [PATCH v4 0/9] tests/functional: Adapt reverse_debugging to run " Philippe Mathieu-Daudé
2025-09-26  9:14   ` Thomas Huth
2025-09-26  9:32     ` Philippe Mathieu-Daudé
2025-09-26  9:41       ` Daniel P. Berrangé
2025-09-26  9:42       ` Thomas Huth

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=ec28971b-fe8c-4a6a-b241-10ff1468c991@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=gustavo.romero@linaro.org \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).