]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Strip trailing newlines from input string
authorTom Tromey <tromey@adacore.com>
Thu, 4 Apr 2024 14:40:38 +0000 (08:40 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 15 Apr 2024 15:04:29 +0000 (09:04 -0600)
commitbdcd50f901e3db5b773b6462813a50b9649aad57
tree4bbfa95ae833f6f8b254a3945a48235f67c5e1bb
parent34d5ac9244ccfe566232469ec3bef1329f0bc42e
Strip trailing newlines from input string

A co-worker noticed a strange situation where "target remote" would
fail due to a trailing newline in the address part of the command.
Eventually he tracked this down to the fact that he was pasting the
command into the terminal, and due to bracketed paste mode, the
newline was being preserved by readline.

It seems to me that we basically never want a trailing newline on a
gdb command, so this patch removes it when handling the readline
result.

Co-Authored-By: Kévin Le Gouguec <legouguec@adacore.com>
Approved-By: Luis Machado <luis.machado@arm.com>
Tested-By: Luis Machado <luis.machado@arm.com>
gdb/event-top.c
gdb/testsuite/gdb.base/paste-newline.exp [new file with mode: 0644]