From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 578F03857BB1 for ; Tue, 31 May 2022 12:57:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 578F03857BB1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f44.google.com with SMTP id bg25so7974458wmb.4 for ; Tue, 31 May 2022 05:57:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=prXPcaPL+ivEYR/56oSgQYAyYjxaoxuE1Ur2pJZUueQ=; b=zrWysRl7GOe4oFGImcFUakMnYO8mDp+EALNrfhK4TactRcsOQyeCZnJSxJXNA/mGdY CBT9tXwRibkQpKd30vt5zWHYwDfN7+puMmXGWemtuvV4h2uaL1A1CXEit16Ab9EkgLXP Si86UQ09oHPZppwIFIpV6Qfmmx7jUrpl6w+/paFqWE3xqSp/bVgoFvKQ3TLL2/HDffzg IpekTfRxAhTV5oWTHp12u2FPVOAsjtZaN5rmyTAnHIFe4SKV8MSFg0Gb8K9s+o/qsaW5 c2Cnj5+HLv4wgGOcsIhf/lFhT4ABgibOow7ghVsI4h4/wmFXfvYrnPURif87Fct5Idpc 64Bw== X-Gm-Message-State: AOAM530Eb0mwH0RAbiiqb1LtZ/IfgZSd1qno9w7I+rGaG9aWUFKA9IvO TwYWww/En28ciWpfFGoNNbTPfpEgqA8= X-Google-Smtp-Source: ABdhPJygb8KIqArmvzlXT2BG2HxSMTMU4zhSMIOh3IOnht4zRgGIR9/8vdEojmDH5mpZQAYC7OFREQ== X-Received: by 2002:a05:600c:89a:b0:397:3e2c:f416 with SMTP id l26-20020a05600c089a00b003973e2cf416mr23811814wmp.160.1654001850321; Tue, 31 May 2022 05:57:30 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id n13-20020adff08d000000b0020e5b4ebaecsm11508424wro.4.2022.05.31.05.57.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 May 2022 05:57:29 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Clarify why we unit test matching symbol names with 0xff characters Date: Tue, 31 May 2022 13:57:28 +0100 Message-Id: <20220531125728.105482-1-pedro@palves.net> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2022 12:57:34 -0000 In the name matching unit tests in gdb/dwarf2/read.c, explain better why we test symbols with \377 / 0xff characters (Latin1 'ÿ'). Change-Id: I517f13adfff2e4d3cd783fec1d744e2b26e18b8e --- gdb/dwarf2/read.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index c4578c687d2..848fd5627b8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -3628,10 +3628,17 @@ static const char *test_symbols[] = { is "function" in PT). */ u8"u8função", - /* \377 (0xff) is Latin1 'ÿ'. */ + /* Test a symbol name that ends with a 0xff character, which is a + valid character in non-UTF-8 source character sets (e.g. Latin1 + 'ÿ'), and we can't rule out compilers allowing it in identifiers. + We test this because the completion algorithm finds the upper + bound of symbols by looking for the insertion point of + "func"-with-last-character-incremented, i.e. "fund", and adding 1 + to 0xff should wraparound and carry to the previous character. + See comments in make_sort_after_prefix_name. */ "yfunc\377", - /* \377 (0xff) is Latin1 'ÿ'. */ + /* Some more symbols with \377 (0xff). See above. */ "\377", "\377\377123", @@ -3701,7 +3708,8 @@ test_mapped_index_find_name_component_bounds () } /* Check that the increment-last-char in the name matching algorithm - for completion doesn't get confused with Ansi1 'ÿ' / 0xff. */ + for completion doesn't get confused with Ansi1 'ÿ' / 0xff. See + make_sort_after_prefix_name. */ { static const char *expected_syms1[] = { "\377", @@ -3770,7 +3778,8 @@ test_dw2_expand_symtabs_matching_symbol () } /* Check that the name matching algorithm for completion doesn't get - confused with Latin1 'ÿ' / 0xff. */ + confused with Latin1 'ÿ' / 0xff. See + make_sort_after_prefix_name. */ { static const char str[] = "\377"; CHECK_MATCH (str, symbol_name_match_type::FULL, true, base-commit: e595ad4cc20a9b34fbda044b161cc7daccdfcf66 -- 2.36.0