Move implementation of perror_with_name to gdbsupport
authorAaron Merey <amerey@redhat.com>
Fri, 10 Feb 2023 01:28:20 +0000 (20:28 -0500)
committerAaron Merey <amerey@redhat.com>
Sat, 11 Feb 2023 02:04:45 +0000 (21:04 -0500)
commit40dfb28b56fe55a370a35495e0f1eb6c95110f35
treee5a51168f2bf2aef021346f20844ac505dcdd924
parentbad727e2d2d1d7f86e1bcdb8eb9ce778182b5926
Move implementation of perror_with_name to gdbsupport

gdbsupport/errors.h declares perror_with_name and leaves the
implementation to the clients.

However gdb and gdbserver's implementations are essentially the
same, resulting in unnecessary code duplication.

Fix this by implementing perror_with_name in gdbsupport.  Add an
optional parameter for specifying the errno used to generate the
error message.

Also move the implementation of perror_string to gdbsupport since
perror_with_name requires it.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/utils.c
gdbserver/utils.cc
gdbsupport/errors.cc
gdbsupport/errors.h