From patchwork Tue Jan 9 14:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 56590 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 B78803857C5E for ; Tue, 9 Jan 2024 14:27:25 +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.133.124]) by sourceware.org (Postfix) with ESMTPS id 4686D3858416 for ; Tue, 9 Jan 2024 14:26:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4686D3858416 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 4686D3858416 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=1704810412; cv=none; b=GjovsmRb3UaNVYpC9Lsr+SeODNrQad9/WIfG1PigdgX2mfMySmF6XehhptXscA2hDAhqnH9gKyQR74ZKHJBDGHa2bEcmw2sFWrk3cpMzvC1dHd/JFEOqrMu8hJ7kxx6AXzfI4S8Ij5jpyKKp7Gh3V3KAT5YzNen+ccLznoGIF+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704810412; c=relaxed/simple; bh=BlHQ0tGqjaz9mJUen/Z4Yibtr3Y9F9/M21lj4gBE2sA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=C5lPEdvxZn5mbO6AcC6ctna9C3BRKFKUNpV3aHGQLrDC4vL+nGPTQX0rUKZ6XY/rke+/FkvCfG3XSUD6Tr4Ht0uZfyEyooigij1geBB3Gvl7UUfH6Gzn4gsyI+Uyz3Kumcnhz77VYTDS4TVRDqYW1vDmReuhg6N2deUv8KNLTK8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704810410; 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=m2nUAVABOUJ0QsPJqM+RdFVA8WrAvsGiG5w2gj7bSRg=; b=YmJqEhOfJZ5y/HVlsmAP/nOR2COese2b58elkkn0nzP4++nduGOuevDDfqEaWtRV+rSaQ/ I5/ZpewFb0FEXXwg1/cGIDuQ0thmlOvbQkA3Z4fJMew2SmW2vI+d9boRjEQn0kPZObIfnT ZpPHIe0CPQL/jy3egJtOvFNopqv3vhw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-5jYEwJ2BOg2YAJy2VISQRA-1; Tue, 09 Jan 2024 09:26:43 -0500 X-MC-Unique: 5jYEwJ2BOg2YAJy2VISQRA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-33693a2dae7so1782771f8f.3 for ; Tue, 09 Jan 2024 06:26:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704810402; x=1705415202; 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=m2nUAVABOUJ0QsPJqM+RdFVA8WrAvsGiG5w2gj7bSRg=; b=Qb6XvMnWfS4DAObkaMls/v2rC1fEB1Rmy+QO1MPpnOOG3hGwl4ucXgXaBmQkhot8mG /PhXUSGjOlocMdT7wZmERJYCUnP7SU5zc0n/xD6tnkpoCAfPd0l2RyFGnWTaTrlrFoAf dX7cMMhQX0DqW7rJLyJmmQBdLa8zrOcPoCJyUl+haaI6C+WyziVQkaXUMbASxX4xPqjS VDx5pV7TElrFvTKSiPk72uYBDW3UTgh0gMXJ1Up7GHWi+Qs0CWmhQoReEKExhCIZvjmu 9xyBQbRrjYACgs2C/SUbWs8ClOldvIaKssnKNgd7yu1Dhh4xk1gdEzpyqgAM29IfHeEu nyBg== X-Gm-Message-State: AOJu0YyI0RAU7fSAjs2MaRmK7IIDFE6uYiDLKgkr/76tE9dxhMkztwPm bgHF0gzM11kIVLAFBu2IVbEaoNeAhRJgNr6pqW4aRxg4gvq6J/uvshCRBfIk+1EZv1DsqVnk5C8 fExPAZS25G5/2pdw7CRTco3PXrxLWEG8AvXoRtfjhC0ovUN/qOjj+uLw3TOGYVOVAlr531L6zMl 3V/QGhNiuJA03GUA== X-Received: by 2002:adf:e648:0:b0:337:70ad:b37c with SMTP id b8-20020adfe648000000b0033770adb37cmr501501wrn.34.1704810402095; Tue, 09 Jan 2024 06:26:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+ihsCfVS4O/ZlFjcdIEVqtyJ6melzkpd5TY4rwZeuj2S9PhMUemLxlzewl8X7AZqm50z+cQ== X-Received: by 2002:adf:e648:0:b0:337:70ad:b37c with SMTP id b8-20020adfe648000000b0033770adb37cmr501494wrn.34.1704810401625; Tue, 09 Jan 2024 06:26:41 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id b6-20020a5d6346000000b0033667867a66sm2552684wrw.101.2024.01.09.06.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 06:26:41 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , Michael Weghorn Subject: [PATCH 00/16] Inferior argument (inc for remote targets) changes Date: Tue, 9 Jan 2024 14:26:23 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-7.3 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_H3, RCVD_IN_MSPIKE_WL, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This series relates to bug PR gdb/28392. For background, check out this series: https://inbox.sourceware.org/gdb-patches/20211022071933.3478427-1-m.weghorn@posteo.de which is a previous attempt to address this bug. It might also be worth reading: https://inbox.sourceware.org/gdb-patches/2b98ca58e47638b4760d86bd6e1fa9a9a79fa2ad.1695817255.git.aburgess@redhat.com which is a previous series of mine which covers some of the work from the original patch series. This series does include many ideas taken from the original patch series (thanks for Michael (original series author) for his work). I think this iteration does include some additional fixes beyond the original series, also there are more tests and documentation changes in this version. There is one small problem: patch #1 is within libiberty. I have posted this to the gcc list here: https://inbox.sourceware.org/gcc-patches/24a8d878590403540bc9b579ba58805985a4d2f7.1701881419.git.aburgess@redhat.com/ However, GCC is currently in stage 4 of its release cycle, so I'm not expecting to see that patch merged before April, I've expanded on this more within the patch #1 email. Still, there's plenty here to comment on, and I figure between now and April I can address any feedback that's given. Thanks, Andrew --- Andrew Burgess (14): libiberty/buildargv: POSIX behaviour for backslash handling gdb/testsuite: add some xfail in gdb.base/startup-with-shell.exp gdb: remove the !startup_with_shell path from construct_inferior_arguments gdbserver: convert program_args to a single string gdbsupport: have construct_inferior_arguments take an escape function gdbsupport: split escape_shell_characters in two gdb: move remote arg splitting and joining into gdbsupport/ gdb/python: change escaping rules when setting arguments gdb: add remote argument passing self tests gdb/gdbserver: pass inferior arguments as a single string gdb: allow 'set args' and run commands to contain newlines gdb/gdbserver: remove some uses of free_vector_argv gdb: new maintenance command to help debug remote argument issues gdb/gdbserver: rework argument splitting and joining Michael Weghorn (2): gdb: Support some escaping of args with startup-with-shell being off gdb/gdbserver: add a '--no-escape-args' command line option gdb/Makefile.in | 1 + gdb/NEWS | 41 +++ gdb/doc/gdb.texinfo | 191 ++++++++++++- gdb/doc/python.texi | 7 +- gdb/infcmd.c | 128 ++++++++- gdb/inferior.c | 8 - gdb/inferior.h | 7 +- gdb/main.c | 30 +- gdb/nat/fork-inferior.c | 84 ++---- gdb/python/py-inferior.c | 7 +- gdb/remote.c | 94 ++++++- gdb/testsuite/gdb.base/args.exp | 137 ++++++--- gdb/testsuite/gdb.base/inferior-args.exp | 215 +++++++++++++-- .../gdb.base/maint-test-remote-args.exp | 40 +++ gdb/testsuite/gdb.base/startup-with-shell.exp | 143 ++++++++-- gdb/testsuite/gdb.python/py-inferior.exp | 36 ++- gdb/testsuite/gdb.server/inferior-args.c | 27 ++ gdb/testsuite/gdb.server/inferior-args.exp | 157 +++++++++++ gdb/unittests/remote-arg-selftests.c | 172 ++++++++++++ gdbserver/linux-low.cc | 5 +- gdbserver/linux-low.h | 2 +- gdbserver/netbsd-low.cc | 6 +- gdbserver/netbsd-low.h | 2 +- gdbserver/server.cc | 74 +++-- gdbserver/server.h | 5 + gdbserver/target.h | 6 +- gdbserver/win32-low.cc | 7 +- gdbserver/win32-low.h | 2 +- gdbsupport/Makefile.am | 1 + gdbsupport/Makefile.in | 13 +- gdbsupport/common-inferior.cc | 207 +++++++++----- gdbsupport/common-inferior.h | 29 +- gdbsupport/remote-args.cc | 260 ++++++++++++++++++ gdbsupport/remote-args.h | 44 +++ libiberty/argv.c | 8 +- libiberty/testsuite/test-expandargv.c | 34 +++ 36 files changed, 1927 insertions(+), 303 deletions(-) create mode 100644 gdb/testsuite/gdb.base/maint-test-remote-args.exp create mode 100644 gdb/testsuite/gdb.server/inferior-args.c create mode 100644 gdb/testsuite/gdb.server/inferior-args.exp create mode 100644 gdb/unittests/remote-arg-selftests.c create mode 100644 gdbsupport/remote-args.cc create mode 100644 gdbsupport/remote-args.h base-commit: b7a5722ebdd24a0d15d56e96d30a649ea1d7b0ee