From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>
Subject: Re: [PATCH] windows-nat: Decode system error numbers
Date: Wed, 09 Nov 2011 16:58:00 -0000 [thread overview]
Message-ID: <201111091658.00913.pedro@codesourcery.com> (raw)
In-Reply-To: <83obwlgsc5.fsf@gnu.org>
On Wednesday 09 November 2011 16:42:50, Eli Zaretskii wrote:
> > Date: Wed, 9 Nov 2011 12:02:40 +0000
> > From: "Maciej W. Rozycki" <macro@codesourcery.com>
> >
> > + const char *msg = "Unspecified error.";
> > + unsigned long err;
> > + char buf[1025];
> > + size_t size;
> > +
> > + if (ok)
> > + return;
> > +
> > + err = GetLastError();
> > + size = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
> > + | FORMAT_MESSAGE_IGNORE_INSERTS,
> > + NULL,
> > + err,
> > + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
> > + buf, (sizeof (buf) - 1) / sizeof (TCHAR), NULL);
>
> Will this DTRT with Cygwin, which AFAIK wants the wide versions of the
> APIs? Is, for example, "char buf[1025];" appropriate in that case?
Yeah, if UNICODE is defined, FormatMessage maps to FormatMessageW and
buf will be filled with a wide string, though I'm not sure
if __USEWIDE implies UNICODE.
gdbserver/win32-low.c has strwinerror for this. It'd be nice if
windows-nat.c also abstracted this equally or similarly.
--
Pedro Alves
next prev parent reply other threads:[~2011-11-09 16:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 12:03 Maciej W. Rozycki
2011-11-09 15:25 ` Joel Brobecker
2011-11-09 16:45 ` Eli Zaretskii
2011-11-09 16:58 ` Pedro Alves [this message]
2011-11-09 17:03 ` Eli Zaretskii
2011-11-09 17:26 ` Pedro Alves
2011-11-09 17:07 ` Corinna Vinschen
2011-11-13 23:47 ` Christopher Faylor
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=201111091658.00913.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=macro@codesourcery.com \
/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