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 AC8A43858C54 for ; Fri, 12 May 2023 10:00:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC8A43858C54 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=1683885642; 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=ikEsMnl/8uDqZXBweY2f2qc/qfxgOOpE0x8Kokx79eY=; b=Xk5UTA2qeGt2NYS8P7m/dDvpQip3O06p4ATSKc9T/rhU1SR6JO8g/T/HMZSFCRukuEzPVb PpCOMm+FZgFzwApjhhxd57oHObeMoaM7n9oSVFVIQgl1gSthlcFgPBeDb/5CKoCa6sIAmO DWE7jGF3WXiEAETBpIqVgOC43kw9Clo= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-C5mWXlMbP1qFVbBVIL--UQ-1; Fri, 12 May 2023 06:00:41 -0400 X-MC-Unique: C5mWXlMbP1qFVbBVIL--UQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30633999815so3717195f8f.1 for ; Fri, 12 May 2023 03:00:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683885640; x=1686477640; 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=ikEsMnl/8uDqZXBweY2f2qc/qfxgOOpE0x8Kokx79eY=; b=Lvd5sCXfkLTx3yiCfoUvW8RKUCn9zm5FvufRNQAE8pUvZyF/kn+RuR/S6aljD9KvKu BCPAwYvL9KW2K6CzXn6uBNVS61KvOW91BrnpzfiYSHi3MfscYQ4RPU8H0eFeR/AcgenI tRtS6oLCaeN2e54PCYabku5Gx/G9GfuX9cPQXDOpRjvySQ5tUxoVqswE7dCEmj9L55oM mcvcAQZE43PPYDTVpTjjqKXdYpd30Hbj6aDLdb57/xbtFffyEOJ4QIQTst4V7ISd9UCe +HyoZWML+xEmAMZDJDcg89eDxLJFrBQt8+NtbLVC5rRbQOekw+HEMblhA96xrgFeZvk4 FG9A== X-Gm-Message-State: AC+VfDxWMINk4++mE8xTTYNSbKnIeQgI9zHGG+5dwvcGniFEZFQus4KB d8X7EZ3w4Sf4wo4sRqjlx2abofTKVW+EPbiV0dsWjLSXyECp7niUu5QwDlC0Gt80lCwe4ES2mlJ Gz5z7PZCIqCNovNtdf4GGUN65tbutmQDpu2eYsugRN7iLFpjjHf9HoYTuJznqY9pHyq+r0xvLOo OR3TRy/A== X-Received: by 2002:a5d:43c4:0:b0:307:6278:611a with SMTP id v4-20020a5d43c4000000b003076278611amr17918202wrr.21.1683885639879; Fri, 12 May 2023 03:00:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xodMWOAyjGVeFU/PtHeJGEhWwzUcOGzBgA2rubZOiHFkYKweKVPff1kTgVb9/NFVhcj3Rpg== X-Received: by 2002:a5d:43c4:0:b0:307:6278:611a with SMTP id v4-20020a5d43c4000000b003076278611amr17918182wrr.21.1683885639517; Fri, 12 May 2023 03:00:39 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id s2-20020a5d4ec2000000b003063a92bbf5sm23088405wrv.70.2023.05.12.03.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 03:00:39 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/testsuite: make gdb_supported_languages a caching proc Date: Fri, 12 May 2023 11:00:17 +0100 Message-Id: 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.6 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,SPF_HELO_NONE,SPF_NONE,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 List-Id: Rewrite gdb_supported_languages as a caching proc that actually queries GDB for the list of supported languages, rather than just containing a hard-coded list of languages. There's only one test that uses this proc right now, gdb.python/py-function.exp, and that still passes after this change, with no changes in the test names. --- gdb/testsuite/lib/gdb.exp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 010da097766..52af0c7358f 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -8591,11 +8591,28 @@ proc cd { dir } { } # Return a list of all languages supported by GDB, suitable for use in -# 'set language NAME'. This doesn't include either the 'local' or -# 'auto' keywords. -proc gdb_supported_languages {} { - return [list c objective-c c++ d go fortran modula-2 asm pascal \ - opencl rust minimal ada] +# 'set language NAME'. This doesn't include the languages auto, +# local, or unknown. +gdb_caching_proc gdb_supported_languages {} { + # The extra space after 'complete set language ' in the command below is + # critical. Only with that space will GDB complete the next level of + # the command, i.e. fill in the actual language names. + set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS -batch -ex \"complete set language \""] + + set langs {} + if {[lindex $output 0] == 0} { + foreach line [split [lindex $output 1] \n] { + if {[regexp "set language (\[^\r\]+)" $line full_match lang]} { + # If LANG is not one of the languages that we ignore, then + # add it to our list of languages. + if {[lsearch -exact {auto local unknown} $lang] == -1} { + lappend langs $lang + } + } + } + } + + return $langs } # Check if debugging is enabled for gdb. base-commit: a02fcd08ddc5080696248ed7fb4bf50a24763431 -- 2.25.4