Message ID | cover.1707409662.git.aburgess@redhat.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 2EEB13858439 for <patchwork@sourceware.org>; Thu, 8 Feb 2024 16:29:24 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 BB3773858C5F for <gdb-patches@sourceware.org>; Thu, 8 Feb 2024 16:28:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB3773858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BB3773858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707409732; cv=none; b=imb4RaDRNawani1N5dDmls3VF+85aHVb9QruK6LUVIzcycJ6oEhPPhHdcZ0QETjAAh54zeXaK2P3VojWVSkeovZY5SU00PQUd2vW4ssTgwhv4gs0fsoyNGBX2xnjQKkeVX0pg3cOWnhMzRBc7m0GzdjalTLF98lcvw1/9iY5+TQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707409732; c=relaxed/simple; bh=GVDykYzX/JQw3ltbcYevbxHx8uMrmQlW8v6VQFmr5Ag=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=EG4qsOhYc37Imobj03BlbYpbC9K9Qbeh5vzTRWG9Qt/Vkni/z6uIjdq4p8ylILsrOJcXWMrc1lpQm2trXWegfN/BCuOkvipOOM68yrdeotKYrDijsq/BqZvJO7gDiE9J+5zQC5bMuqmhuqk55S8KibOwf5KTBAC7LqhmKGzNlwk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707409729; 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=jDSP9UW022mZP0HdFEkttjLfDElCgi3RFnqeaEFWo28=; b=Ace8ag6jLGZt/PwWGgBcHcMqu2ozNd5nCuCed2wZVE1ebnuJBOtGQM24VAv88DjiHhiIym t38f32NH9ORtIaqQhMPeuAixZzsBqXZkRCd+Tg1em+DvobFNB4U18VTgRu7P0YmQdtV9bh l7EJGdcttoPyDQWbyI7oevuMdC1MYsY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-mLTDhmBPM76Iawmjrry7oQ-1; Thu, 08 Feb 2024 11:28:47 -0500 X-MC-Unique: mLTDhmBPM76Iawmjrry7oQ-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40fd2fe490bso5113775e9.0 for <gdb-patches@sourceware.org>; Thu, 08 Feb 2024 08:28:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707409726; x=1708014526; 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=jDSP9UW022mZP0HdFEkttjLfDElCgi3RFnqeaEFWo28=; b=RItttXsV6XrU6Jz3y1rTgEJER0oLi7E4kScumETrSxG59VDL/SkIw4u28fSBjQTSXL 3ouEYVos03mmix8UUGmIkR8ghgL3ybvbQK6eeWdD2XWQU2br2j+UnXrR7PmFQ/JWdiHD 0Tfg7EhByoqd7yc22uIngbr02WQLj4dXyFmaK/KSdcmu30YRfqbvoMEUH3aNj1eI0fok sgReqrhs52JtP9szAO7L3i1SNYM5/pdrBdsZU49XyixDQYbbwT+8uksvYr4w/fHnjbQ5 qlDMCod9oU/xwikVlSUUi9Y/Q7T2ZUY1tYS7v2CnJ3eAwEmlQDWO89DKk0LEAP18KEvQ RNFw== X-Gm-Message-State: AOJu0YzcdZWgAFmWJ3OHIkRZb/zoi1t1kxHROZkJuhMvWEJYeAeF7enh 9ZC6rkMVs6Q/pVZCiw+T+1pBmwYVSVzKbVEJDOqZ6nEQ3o475nU0Qolaf8Irg5fzuwlCdJdqn+c MYdSkc+bKFq4Cl6dpU1qtWyCtvf5KSDZLM8Xw5Obr5X9dg4qy616dpiyfZrdCBa5SKolePeaKg9 X/TnMdW99G6Y0mzBEPlnvqHioHQGh4dqFhCx1QLrPQFCs= X-Received: by 2002:a05:600c:4f51:b0:40f:b69e:aa1e with SMTP id m17-20020a05600c4f5100b0040fb69eaa1emr2771703wmq.13.1707409726025; Thu, 08 Feb 2024 08:28:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFazNpWn+M0qSn2msQNJctStfiea8taHc7U8xRCMPvJgedndd7wW0ni+NRmcHczSPnaq/IaZA== X-Received: by 2002:a05:600c:4f51:b0:40f:b69e:aa1e with SMTP id m17-20020a05600c4f5100b0040fb69eaa1emr2771668wmq.13.1707409725301; Thu, 08 Feb 2024 08:28:45 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id u6-20020a05600c19c600b004104ecb39d1sm762869wmq.32.2024.02.08.08.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 08:28:45 -0800 (PST) From: Andrew Burgess <aburgess@redhat.com> To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> Subject: [PATCH 0/4] Rewrite gdb_argv using extract_string_maybe_quoted Date: Thu, 8 Feb 2024 16:28:39 +0000 Message-Id: <cover.1707409662.git.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=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Rewrite gdb_argv using extract_string_maybe_quoted
|
|
Message
Andrew Burgess
Feb. 8, 2024, 4:28 p.m. UTC
This short series is really a refactor, though it does fix one tiny bug in gdb_argv which can be seen in the Python API's gdb.string_to_argv. See patch #4 for details. Patches #1 and #3 are purely about adding more unit tests. Patches #2 and #4 are the real GDB changes. This series feeds into two other projects that I'm working on, one of which is already on the mailing list, and the other is still in progress. The first patch in this series: https://inbox.sourceware.org/gdb-patches/cover.1704809585.git.aburgess@redhat.com is for libiberties buildargv function. Using that function is good (code reuse), but we already have extract_string_maybe_quoted which is a GDB local copy of the core loop from within buildargv. I therefore claim that using buildargv is good, but using extract_string_maybe_quoted is better -- the more heavily used GDB's utility functions are, the more confident we can be that they are correct. The second place where this refactor will help is, I think, is with addign support for filename command options (e.g. -option FILENAME), in this case, when completing, we need to be able to skip over FILENAME, which requires having a version of extract_string_maybe_quoted that can adapt to the escaping which is applied to FILENAME. The extract_string_maybe_quoted changes in this series will be helpful here. All feedback welcome. Thanks, Andrew --- Andrew Burgess (4): gdb/unittests: add extract_string_maybe_quoted self tests gdbsupport: allow for configuration of extract_string_maybe_quoted gdb/unittests: additional tests for gdb_argv class gdbsupport: rewrite gdb_argv to use extract_string_maybe_quoted gdb/Makefile.in | 2 + gdb/testsuite/gdb.python/py-cmd.exp | 8 ++ gdb/unittests/extract-string-selftests.c | 96 +++++++++++++++ gdb/unittests/gdb_argv-selftests.c | 134 +++++++++++++++++++++ gdb/utils.c | 26 ---- gdbsupport/buildargv.h | 50 +++++--- gdbsupport/common-utils.cc | 80 +++++++------ gdbsupport/common-utils.h | 144 ++++++++++++++++++++++- 8 files changed, 464 insertions(+), 76 deletions(-) create mode 100644 gdb/unittests/extract-string-selftests.c create mode 100644 gdb/unittests/gdb_argv-selftests.c base-commit: e58beedf2c8a1e0c78e0f57aeab3934de9416bfc