]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdbserver: better handling for missing argument values
authorAndrew Burgess <aburgess@redhat.com>
Fri, 1 Aug 2025 11:26:41 +0000 (12:26 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 23 Sep 2025 17:40:00 +0000 (18:40 +0100)
commit1ff92d0903f6d660131e93f4274e0db9d42a7f25
tree86fdcd4667b61943ce12da57687a615b155ee622
parentce1b10c1ab3fc6f32621f1f23cc116ee8e39d473
gdbserver: better handling for missing argument values

By passing ':' within the optstring to getopt_long, the getopt_long
call will now return ':' for missing value errors and '?' for unknown
argument errors, rather than returning '?' for all error types.

We can now print a different error message for missing argument
values.  For example:

  $ gdbserver --debug-file :54321 /tmp/hello
  Missing argument value for: --debug-file

Compared to:

  $ gdbserver --unknown :54321 ~/tmp/hello.x
  Unknown argument: --unknown

Current HEAD gdbserver treats every error as the 'Unknown argument'
error.

While I was messing with the code that prints these error messages,
I've wrapped then with _(...) to allow for internationalisation.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.server/argument-errors.exp [new file with mode: 0644]
gdbserver/server.cc