From: Tom Tromey <tom@tromey.com>
To: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
Cc: Aaron Merey <amerey@redhat.com>, simark@simark.ca
Subject: Re: [PATCH] gdb/source: Fix open_source_file error handling
Date: Wed, 08 Feb 2023 10:44:21 -0700 [thread overview]
Message-ID: <87k00s128a.fsf@tromey.com> (raw)
In-Reply-To: <20230128033748.2839360-1-amerey@redhat.com> (Aaron Merey via Gdb-patches's message of "Fri, 27 Jan 2023 22:37:48 -0500")
>>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
Aaron> Fix this by having open_source_file return a negative errno if it fails
Aaron> to open a source file. Use this value to generate the error message
Aaron> instead of errno. Also add new function throw_sys_errmsg for reporting
Aaron> this value.
I wonder if it's guaranteed somewhere that the errno values are always
positive.
Aaron> +/* Same as perror_with_name except that ERRCODE specifies the error
Aaron> + instead of errno. */
Aaron> +
Aaron> +void
Aaron> +throw_sys_errmsg (const char *string, int errcode)
IMO probably better to just add a parameter to perror_with_name that
defaults to 0, meaning use errno.
However, if you want to go this route, a function that always throws
must be marked ATTRIBUTE_NORETURN.
Tom
prev parent reply other threads:[~2023-02-08 17:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 3:37 Aaron Merey
2023-02-01 19:45 ` Keith Seitz
2023-02-02 1:38 ` Aaron Merey
2023-02-08 17:53 ` Tom Tromey
2023-02-02 10:29 ` Bruno Larsen
2023-02-08 17:44 ` Tom Tromey [this message]
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=87k00s128a.fsf@tromey.com \
--to=tom@tromey.com \
--cc=amerey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).