From patchwork Fri Apr 7 01:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Li X-Patchwork-Id: 67481 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4EFFD3858433 for ; Fri, 7 Apr 2023 01:44:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 6985A3858D28 for ; Fri, 7 Apr 2023 01:44:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6985A3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxUU97dS9k4aQXAA--.25119S3; Fri, 07 Apr 2023 09:44:28 +0800 (CST) Received: from localhost.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxIL97dS9k6LYXAA--.58066S2; Fri, 07 Apr 2023 09:44:27 +0800 (CST) From: Hui Li To: gdb-patches@sourceware.org Subject: [PATCH] gdb/testsuite: Skip dump ihex for 64-bit address in gdb.base/dump.exp Date: Fri, 7 Apr 2023 09:44:27 +0800 Message-Id: <20230407014427.21354-1-lihui@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxIL97dS9k6LYXAA--.58066S2 X-CM-SenderInfo: 5olk3xo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxGFyxtF43JrW5Zr1UXFW3Awb_yoW5tw4Dpa 13Jas8KrW8JrZFqry7Ja4DG34YyFW8AFZxuw13AF129w1rZr47Awn3Kw13X3WFkF1Fqa43 t3Z2yw1j9a4YkaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2AI xVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r1j6r15MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0 rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r 4UYxBIdaVFxhVjvjDU0xZFpf9x07UE-erUUUUU= X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" (1) Description of problem In the current code, when execute the following test on LoongArch: $make check-gdb TESTS="gdb.base/dump.exp" ``` FAIL: gdb.base/dump.exp: dump array as value, intel hex FAIL: gdb.base/dump.exp: dump struct as value, intel hex FAIL: gdb.base/dump.exp: dump array as memory, ihex FAIL: gdb.base/dump.exp: dump struct as memory, ihex ``` These tests passed on the X86_64, (2) Root cause On LoongArch, variable intarray address 0x120008068 out of range for IHEX, so dump ihex test failed. gdb.base/dump.exp has the following code to check 64-bit address ``` # Check the address of a variable. If it is bigger than 32-bit, # assume our target has 64-bit addresses that are not supported by SREC, # IHEX and TEKHEX. We skip those tests then. set max_32bit_address "0xffffffff" set data_address [get_hexadecimal_valueof "&intarray" 0x100000000] if {${data_address} > ${max_32bit_address}} { set is64bitonly "yes" } ``` We check the "&intarray" on different target as follow: ``` $gdb gdb/testsuite/outputs/gdb.base/dump/dump ... (gdb) start ... On X86_64: (gdb) print /x &intarray $1 = 0x404060 On LoongArch: (gdb) print /x &intarray $1 = 0x120008068 ``` The variable address difference here is due to the link script of linker. ``` On X86_64: $ld --verbose ... PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; On LoongArch: $ld --verbose ... PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x120000000)); . = SEGMENT_START("text-segment", 0x120000000) + SIZEOF_HEADERS; ``` (3) How to fix Because 64-bit variable address out of range for IHEX, it's not an functional problem for LoongArch. Refer to the handling of 64-bit targets in this testsuite, use the "is64bitonly" flag to skip those tests for the target has 64-bit addresses. Signed-off-by: Hui Li --- gdb/testsuite/gdb.base/dump.exp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index bc0ab4a8805..b119b8e9239 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -141,11 +141,14 @@ make_dump_file "dump srec val [set intarr1.srec] intarray" \ make_dump_file "dump srec val [set intstr1.srec] intstruct" \ "dump struct as value, srec" +# 64-bit address out of range for Intel Hex file +if {![string compare $is64bitonly "no"]} { make_dump_file "dump ihex val [set intarr1.ihex] intarray" \ "dump array as value, intel hex" make_dump_file "dump ihex val [set intstr1.ihex] intstruct" \ "dump struct as value, intel hex" +} make_dump_file "dump tekhex val [set intarr1.tekhex] intarray" \ "dump array as value, tekhex" @@ -242,11 +245,14 @@ make_dump_file "dump srec mem [set intarr2.srec] $array_start $array_end" \ make_dump_file "dump srec mem [set intstr2.srec] $struct_start $struct_end" \ "dump struct as memory, srec" +# 64-bit address out of range for Intel Hex file +if {![string compare $is64bitonly "no"]} { make_dump_file "dump ihex mem [set intarr2.ihex] $array_start $array_end" \ "dump array as memory, ihex" make_dump_file "dump ihex mem [set intstr2.ihex] $struct_start $struct_end" \ "dump struct as memory, ihex" +} make_dump_file "dump tekhex mem [set intarr2.tekhex] $array_start $array_end" \ "dump array as memory, tekhex"