Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Luis <luis.machado.foss@gmail.com>
Cc: Kevin Buettner <kevinb@redhat.com>,
	gdb-patches@sourceware.org, Michael Weghorn <m.weghorn@posteo.de>,
	Eli Zaretskii <eliz@gnu.org>,
	Guinevere Larsen <guinevere@redhat.com>
Subject: Re: [PATCH] gdb/gdbserver: pass inferior arguments as a single string
Date: Tue, 16 Sep 2025 15:55:02 +0100	[thread overview]
Message-ID: <87ldmeh2gp.fsf@redhat.com> (raw)
In-Reply-To: <CANnS9rswCFWa7_-QgR9xWFdD533FRAZzfaY6oJzOPpsD7OZh8w@mail.gmail.com>

Luis <luis.machado.foss@gmail.com> writes:

> I think I'm running into a change in behavior for --args, where it now says
> no program was specified when previously it was ok.
>
> Just a standard....
>
> ./gdb/gdb -ex run --args gdb/gdb gdb/gdb -ex start

And to debug it, I did:

 gdb --args ./gdb/gdb -ex run --args gdb/gdb gdb/gdb -ex start

It's GDB all the way down!

Anyway.

The patch below fixes this problem.  I still need to write a test for
this and write a commit message.  I'll try to do that later today, or it
might have to be first thing tomorrow.

Good news is this bug is not in GDB 17 branch.

Thanks,
Andrew

---

diff --git i/gdb/main.c w/gdb/main.c
index 04c33638bec..f3049600a06 100644
--- i/gdb/main.c
+++ w/gdb/main.c
@@ -866,9 +866,14 @@ captured_main_1 (struct captured_main_args *context)
       {
 	int option_index;
 
+	/* If the previous argument was --args or --no-escape-args, then
+	   stop argument processing.  */
+	if (set_args != NO_ARGS)
+	  break;
+
 	c = getopt_long_only (argc, argv, "",
 			      long_options, &option_index);
-	if (c == EOF || set_args != NO_ARGS)
+	if (c == EOF)
 	  break;
 
 	/* Long option that takes an argument.  */


  parent reply	other threads:[~2025-09-16 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 10:31 Andrew Burgess
2025-06-24 21:50 ` Kevin Buettner
2025-09-12 10:13   ` Andrew Burgess
2025-09-16  8:55     ` Luis
2025-09-16 14:34       ` Andrew Burgess
2025-09-16 14:55       ` Andrew Burgess [this message]
2025-09-16 16:21       ` Andrew Burgess
2025-09-16 23:25         ` Luis
2025-09-17  0:19         ` Luis
2025-09-17  8:57           ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ldmeh2gp.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    --cc=kevinb@redhat.com \
    --cc=luis.machado.foss@gmail.com \
    --cc=m.weghorn@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox