From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BINJIgCwhmZUPhsAWB0awg (envelope-from ) for ; Thu, 04 Jul 2024 10:21:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MDQifZr2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7FE731E0D0; Thu, 4 Jul 2024 10:21:52 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 61EF01E030 for ; Thu, 4 Jul 2024 10:21:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6B36384A46B for ; Thu, 4 Jul 2024 14:21:49 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id ADCB53858C41 for ; Thu, 4 Jul 2024 14:21:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADCB53858C41 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 ADCB53858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720102883; cv=none; b=iVZMXBeQAH+z73hcMZVaMfQTl6YNWWvB9CKxVnlTOPF8zUiBYSIPXtswxoNBMCQYKIHSSE0WPLJeJcr0qBwVq4nBSfpn7kFVfREXG0EaUuZ8wuYLQZYTRsEX4qRlm7htejeOjhgpaZAjbfPagf6JoG9WNrLM4zoAeLHtlTD9k/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720102883; c=relaxed/simple; bh=+JE6qbIpfdmQcaDhYtnob8FkLzPl1U+Yph30sXuWRlQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=e+rcyP715egfsd4i3WlQ9gdTz4NMKF/USP9LOisaa4TNCQgJLwHIHa7t0IhfkCNB4l4wWDpZHPTaMiUvGmRcgT4/UWq0uq8WtNcq7ShNBKNp9wTWTpSQJA/cMkia9Klz+mtN85TIvkiYvqkmhKomzaXHCIdlteFUhKWAbi2uAq0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720102877; 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: in-reply-to:in-reply-to:references:references; bh=Zt7b5Besr0pYbcQwHiCDo0ltXGT2rb9v3MAHQ2Wn7Xo=; b=MDQifZr2JBXEKzQ9vn450IYIKjWcFh9RR92Y7Jv6kDwf0wlZ55aPIdA76OxsNp1xjgALH+ Uuy/O356uK6pUt0K3cKlQr1AYdZdHTcktSUjxKTQJD97S/Nt8iTqEn0rFuQgblDVc3JPBl tNRo/ZAz+Y3tEoyK1927NuFRnrilR1I= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608--ZwfgRwbN6Kk7mdTL3-GDA-1; Thu, 04 Jul 2024 10:21:16 -0400 X-MC-Unique: -ZwfgRwbN6Kk7mdTL3-GDA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42490ae735dso7062735e9.0 for ; Thu, 04 Jul 2024 07:21:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720102873; x=1720707673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zt7b5Besr0pYbcQwHiCDo0ltXGT2rb9v3MAHQ2Wn7Xo=; b=EJpahkZS59H7954Je4a4tYSCkU79BpKEmtcSKVEgLg2EKcJQAVZyPjybipf3td3ihx l6yij5SqTOsGkwUXf5t6Q1uzsimzBbjTpg68d3nWMo4FUG5y7R4HxqbyESDj/l7yNiOx jY2b7z1PPEx1RhwFmZYs1bvOhW8J8mqouDq8GjA8d3eqRcZlYosr2TMDMNytnfo8Fto1 wuxBfflInJGkhVEB1kjFnrrVdh9gyTmW9e/8VSxNqjN+G/g7wftGoDgfPoaBdwGf2Vc+ quG9B1WyBQ0VDdhBjSIvpfrxshKNppdGqDVA/WEWKQPJudPpAXfuzjjLWQ0H7rxRqcde 1NGw== X-Gm-Message-State: AOJu0YwSqmZoWkVJxkd7TK6NQyjjjvGAvUC0hON81ukMbi7u0zPUzd0f kueYVG+grErs0/yowA0GchqKSLwLaIwsVaiLY8iTbDas+Rb2BttO8eLK5QrbXvawdHCf0pG/H+o hWZHQNjOPdP2Vn24Wus1iDIZg3XIMlHhW0xCmTkdeM+4rTMG/F02yXZ3+Mli8qPB9F8Du5+5W3J 6BcQy8RWDj4KRoqI7QgulvRryZ18dPa+GX0dT+cWEoeNU= X-Received: by 2002:a05:600c:1688:b0:424:90f4:309d with SMTP id 5b1f17b1804b1-4264a3bd946mr14874215e9.8.1720102873165; Thu, 04 Jul 2024 07:21:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8/41XHKpMKyYmmXWJR84grhQdEV58Sh4/+kyqbVl4av4Hq6KdCnLFnPH9Put8bYfifu0NBQ== X-Received: by 2002:a05:600c:1688:b0:424:90f4:309d with SMTP id 5b1f17b1804b1-4264a3bd946mr14873975e9.8.1720102872680; Thu, 04 Jul 2024 07:21:12 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1d50f5sm26065435e9.9.2024.07.04.07.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 07:21:12 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv4 00/14] Further filename completion improvements Date: Thu, 4 Jul 2024 15:20:55 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: 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=-5.7 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_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org In V4: - Tom asked about V3: "...did you consider changing gdb to have a single way to pass a filename to a command?". Well, I've not done that. But, I have ensured that doing this would be possible in the future, and I've added two patches (the last two) that change a few commands. There are two reasons for no changing everyhing in this series, first I'd probably not change all commands in one commit, that one commit would be huge, so chaning all the commits would add even more commits to this already large series. And second, changing the commands is a breaking change, while just chaning the completion (in line with current command behaviour) is non-breaking. - As such, if folk get nervous about changing the command behaviour, the last two patches of V4 should be considered optional. Patches 1 to 12 are all either new functionality, or non-breaking fixes to existing functionality. If the final two patches are accepted then I would plan to write patches to change all the other commands to accept quoted filenames for arguments. That would be my intention, but of course, this series should be reviewed and accepted or rejected assuming the follow up work never arrives. Personally, I'm OK with that, we currently have two style of filename passing. All I do in this series is acknoweldge that and update the completion to handle it. Keeping a single filename completion function (a) doesn't change the fact that we have two filename argument styles, and (b) ensures that completion for one type of argument will remain broken. - I've restructured patches #1 and #2, I've tried to reduce the size of patch #1, while patch #2 is a simple renaming patch. - Patches #3 to #8 are largely unchanged from v3 -- minor tweaks to accomodate changes in earlier patches only. - Patches #9 onwards are new work. - I think that there is additional refactoring and cleanup that could be performed in the area of filename completion, but I've resisted adding that to this series. How that cleanup would progress would depend on whether I get all commands updated to accept quoted filenames or not. I didn't want to invest a large block of time assuming that I could get such a change into GDB only to have it rejected. If we decide to keep the existing two argumet style approach then I think there are other cleanups we could potentially make in the future. In V3: - Patch #1 from the v2 series was merged. - Remaining patches have been rebased and retested. In V2: - Patches #1 and #2 are new in this iteration. Patches #3 to #8 are the patches from V1 rebased onto these two new patches, - Patch #1 adds documentation for the formatting of filename arguments, this tries to explain the two diffent ways that GDB expects filename arguments to be formatted. - Patch #2 addresses the problem that Lancelot pointed out: some commands don't expect filename arguments to be quoted, or to contain escapes. In this patch I split the filename completion in two so the two different filename argument formats are handled separately... - This clears the way for the rest of the series, which updates how completion works for those filename arguments that do accept quoting and escaping, - Patches #3 to #8 are in principle the same as in V1, but there were some changes after rebasing onto the new patch #2. Andrew Burgess (14): gdb: split apart two different types of filename completion gdb: deprecated filename_completer and associated functions gdb: improve escaping when completing filenames gdb: move display of completion results into completion_result class gdb: simplify completion_result::print_matches gdb: add match formatter mechanism for 'complete' command output gdb: apply escaping to filenames in 'complete' results gdb: improve gdb_rl_find_completion_word for quoted words gdb: implement readline rl_directory_rewrite_hook callback gdb: new extract_single_filename_arg helper function gdb: extend completion of quoted filenames to work in brkchars phase gdb: add remove-symbol-file command completion gdb: allow quoted filenames for commands that have custom completion gdb: 'target ...' commands now expect quoted/escaped filenames gdb/NEWS | 21 + gdb/auto-load.c | 4 +- gdb/breakpoint.c | 4 +- gdb/cli/cli-cmds.c | 35 +- gdb/cli/cli-decode.c | 8 +- gdb/cli/cli-dump.c | 6 +- gdb/compile/compile.c | 11 +- gdb/completer.c | 643 +++++++++++++++--- gdb/completer.h | 90 ++- gdb/corefile.c | 3 +- gdb/corelow.c | 24 +- gdb/doc/gdb.texinfo | 19 + gdb/dwarf2/index-write.c | 8 +- gdb/exec.c | 12 +- gdb/guile/scm-cmd.c | 2 +- gdb/infcmd.c | 12 +- gdb/inferior.c | 2 +- gdb/jit.c | 2 +- gdb/python/py-cmd.c | 2 +- gdb/record-full.c | 4 +- gdb/record.c | 2 +- gdb/skip.c | 2 +- gdb/source.c | 2 +- gdb/symfile.c | 120 +++- gdb/target-descriptions.c | 31 +- gdb/testsuite/gdb.base/batch-exit-status.exp | 4 +- .../gdb.base/filename-completion.exp | 319 +++++++-- gdb/testsuite/gdb.base/sym-file.exp | 258 +++---- gdb/testsuite/gdb.compile/compile.exp | 2 +- gdb/testsuite/lib/gdb.exp | 10 + gdb/tracectf.c | 12 +- gdb/tracefile-tfile.c | 17 +- gdb/utils.c | 18 + gdb/utils.h | 14 + 34 files changed, 1329 insertions(+), 394 deletions(-) base-commit: 2513312930b2b8a0b50fb681f2781372cce3c2f6 -- 2.25.4