From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C13853943415 for ; Thu, 17 Nov 2022 14:37:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C13853943415 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668695859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DzLqvPr/GHwviGrkKPhkTone/E4RJdMriA6qIGKpA/A=; b=BZ9BmWTk205SQVU0wAc4Kx1ahC+DF8qJSW9Q3CWYF2XFaG3uUIoLNsDQAZCz0CGjXYoXvu 9+A/h5LvUggN/8qVZHaDipK55wsrdesTARPiEWYJj3UXUL7fddzgLsOOwgBQe7C+7VFTQS cvdBhRSPcftouU+fzEVFh+qCjOyT7xE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-421-PdhqbMMNNraDcl99p83iuA-1; Thu, 17 Nov 2022 09:37:36 -0500 X-MC-Unique: PdhqbMMNNraDcl99p83iuA-1 Received: by mail-wm1-f70.google.com with SMTP id ay19-20020a05600c1e1300b003cf758f1617so2868533wmb.5 for ; Thu, 17 Nov 2022 06:37:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DzLqvPr/GHwviGrkKPhkTone/E4RJdMriA6qIGKpA/A=; b=XNWFZIisDAyUQshn1yIDWsIJBj/yrgy2LQzNdFvB4wmheNifj71JaFo9Et10Kr9Uau cBXG7qUqdAtufvycV2zXrfeGI8Uq/LOptoqcvZD5IeviGiEMpqCuT5k99IDkPO/COHA7 SyIEjw//9Tc9fwnrDEgv51BXOPHZdU6nKht3fYe4jq4eIfxxJbvy0jtEQYDKv7BBt/IN /S3BO/tsCVcIoK+zdyBQiixNVkwKahhD74Wwlada/TSBDGpr6sdqaaySZUWUoMq5X/8X N7fxl5h+QIqdFJaOpcIQyeugvZM+WJepYgiDrjTVrGvyAZ4FO7oS1katelSJMMmVp2MY f6zw== X-Gm-Message-State: ANoB5pl9y5CK3iQE11TIzzNnDrtR0wp5cAlZf/9NApMgbgNknY8DkVFn gkVQSxpBZAisuj24VXtrmM3HMZF9D045VeTrmACe4OfpltA0RgoR+FMiRYNIn49bDDJhZH/xcX6 WzgHvktdKfk+OqCiJyuwzKL83WARUaby2M8ya04qIqZazCtJLxSP1ceNSX1XvMZ4g28NaV7MQAg == X-Received: by 2002:a05:600c:511c:b0:3cf:6c05:809e with SMTP id o28-20020a05600c511c00b003cf6c05809emr1961480wms.74.1668695855316; Thu, 17 Nov 2022 06:37:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4dLWohuPlm6ynksGXkf+sXHSPYADRbkYFnMQdCi266vjMz5rWTOH49sVzYCRcWqA0FPwt6UA== X-Received: by 2002:a05:600c:511c:b0:3cf:6c05:809e with SMTP id o28-20020a05600c511c00b003cf6c05809emr1961463wms.74.1668695855011; Thu, 17 Nov 2022 06:37:35 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id j21-20020a05600c1c1500b003cfb7c02542sm1746644wms.11.2022.11.17.06.37.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 06:37:34 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/testsuite: fix failure in gdb.python/py-send-packet.exp In-Reply-To: <20221024142342.2851511-1-aburgess@redhat.com> References: <20221024142342.2851511-1-aburgess@redhat.com> Date: Thu, 17 Nov 2022 14:37:33 +0000 Message-ID: <87pmdl8x5e.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Andrew Burgess writes: > While working on another patch I noticed that, when run on an AArch64 > target, the test gdb.python/py-send-packet.exp was failing: > > Traceback (most recent call last): > File "", line 1, in > File "/tmp/build/gdb/testsuite/outputs/gdb.python/py-send-packet/py-send-packet.py", > line 106, in run_auxv_send_packet_test > assert string == expected_result > AssertionError > Error while executing Python code. > (gdb) FAIL: gdb.python/py-send-packet.exp: call python run_auxv_send_packet_test function > > The test uses 'maint packet ...' to send a packet to gdbserver, and > then captures the output in TCL. This output is then passed through > to a Python function, which performs some actions using the Python > API, and compares the results from the Python API to the results > captured in TCL from 'maint packet ...'. > > The problem is that the output captured in TCL contains lots of things > like '\x000', when this is passed through to Python the '\x' causes > this to be treated as an escape code, which isn't what we want - we > want the actual string "\x000". > > So, in the TCL part of the test we were expanding '\x' to '\\x', this > seemed to work fine for my testing on x86-64. > > However, on AArch64 what I see is that the results from 'maint packet > ...' contain a literal '\' character followed by a literal 'x' > character. When GDB prints this in the 'maint packet' output, GDB > escapes the '\' for us, thus we get '\\x' printed by 'maint packet'. > > However, now our TCL test script kicks in and tries to "fix" the '\x', > this means we now have '\\\x', which isn't correct. > > The problem is that in the TCL script we are too restrictive, we > expand '\x' to '\\x', but really, we should be expanding all '\' > characters, regardless of what follows them. This is what this patch > does. > > After this the gdb.python/py-send-packet.exp test passes on AArch64 > for me. I've gone ahead and merged this patch. Thanks, Andrew > --- > gdb/testsuite/gdb.python/py-send-packet.exp | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gdb/testsuite/gdb.python/py-send-packet.exp b/gdb/testsuite/gdb.python/py-send-packet.exp > index 11f0043db9b..5cb2f5a656c 100644 > --- a/gdb/testsuite/gdb.python/py-send-packet.exp > +++ b/gdb/testsuite/gdb.python/py-send-packet.exp > @@ -80,9 +80,9 @@ if { ! $skip_auxv_test } { > } > } > > - # Expand the '\x' in the output, so we can pass a string through > - # to Python. > - set reply_data [string map {\x \\x} $reply_data] > + # Escape any backslash characters in the output, so we can safely > + # pass a string through to Python. > + set reply_data [string map {\\ \\\\} $reply_data] > gdb_assert { ![string equal "$reply_data" ""] } > > # Run the test, fetches the auxv data in Python and confirm it > -- > 2.25.4