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 838103858284 for ; Mon, 24 Oct 2022 14:23:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 838103858284 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=1666621429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AaOxxuxEpN/Z/zdeFdzC5tSlMiRYEeKBCNYBa+WuOEE=; b=jIa8kdPQyQTcc/hYZuyAwJulCJTuT/UP+XqhKJFEAfkkXed1d1HCL/VBMRrfFmHvqEUlJ7 1cqW020oroo+XpOH3eo9FKgXFpCV/2z/EY0Y7rALur8RKs2BTEW0GTXq8ZF69xCA4FcYHa jfg91rKs9xEzM9XRFK3fkAsC0Xx4kwY= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-629-VJfh0xN1MBOpxV1sVM-vfQ-1; Mon, 24 Oct 2022 10:23:47 -0400 X-MC-Unique: VJfh0xN1MBOpxV1sVM-vfQ-1 Received: by mail-qt1-f198.google.com with SMTP id u11-20020a05622a198b00b0039cca1826c8so7112786qtc.11 for ; Mon, 24 Oct 2022 07:23:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AaOxxuxEpN/Z/zdeFdzC5tSlMiRYEeKBCNYBa+WuOEE=; b=CQPBPu1JrgTtxVeCqpaevMJNnmhT/dGYDcXf4v5GPUlBJjqg7FhW9W+vW8ONn0QfLc ZEKHPNNrRdbrg1/69d7t4Kw5TuUV0SeQUs8mHDikZOMlUN16hJdac/fHUSkEAeB6XLi6 QgZkOdzBgg519lxJdj4Jt+mb2HKMFjCzPRTPOyzVDrWp618B7sf9/LUwgTMjZ1xsKsX0 oHaUi+kWL/RhfvqrxPamFvKyAd0fNNnmlkjfFyArV9ddYLuzPYYHPfu8j5HoTbw25zez /wl0R1T0QN0toybyTnEvzG5whauK7KlMuwt+1aEXdlvqI0SLIpicA2xTz+ffCzg5Ul2P 241g== X-Gm-Message-State: ACrzQf2Myrx7zXCawT+xw0RbE40zXI8eGskh60KsDIcDSOijfMDhmu48 Ges1pyAtb/4OLvLji1qvhPEKH6dxPSUOMQWCqGBHcMMjX0zwIb/xHq9ZdclJTwJJ+d4PU0cGup1 EI6qJeE7b/8lc7GwRcB9Ac2Z63ovsLh0WwXnCPuxJ0NvcINcxhXDLvqhTixBNoFW+QgbDaXfFAw == X-Received: by 2002:a0c:b256:0:b0:4b1:9f77:91da with SMTP id k22-20020a0cb256000000b004b19f7791damr28429977qve.84.1666621427214; Mon, 24 Oct 2022 07:23:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cxtyGMVrgAjfPPZ2VAsx+CEhldGrblXRnbxm3Va+2FnJyXjSjBzAM97sciFORGG4Pr65buA== X-Received: by 2002:a0c:b256:0:b0:4b1:9f77:91da with SMTP id k22-20020a0cb256000000b004b19f7791damr28429951qve.84.1666621426855; Mon, 24 Oct 2022 07:23:46 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id x30-20020a05620a0b5e00b006cfc9846594sm26571qkg.93.2022.10.24.07.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 07:23:46 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/testsuite: fix failure in gdb.python/py-send-packet.exp Date: Mon, 24 Oct 2022 15:23:42 +0100 Message-Id: <20221024142342.2851511-1-aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 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: 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. --- 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