From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] [gdbserver/win32] fatal "glob could not process pattern '(null)'" error
Date: Fri, 04 May 2018 18:30:00 -0000 [thread overview]
Message-ID: <1525458603-33351-2-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1525458603-33351-1-git-send-email-brobecker@adacore.com>
Trying to start GDBserver on Windows currently yields the following
error...
$ gdbserver.exe --once :4444 simple_main.exe
glob could not process pattern '(null)'.
Exiting
... after which GDB terminates with a nonzero status.
This is because create_process in win32-low.c calls gdb_tilde_expand
with the result of a call to get_inferior_cwd without verifying that
the returned directory is not NULL:
| static BOOL
| create_process (const char *program, char *args,
| DWORD flags, PROCESS_INFORMATION *pi)
| {
| const char *inferior_cwd = get_inferior_cwd ();
| std::string expanded_infcwd = gdb_tilde_expand (inferior_cwd);
This patch avoids this by only calling gdb_tilde_expand when
INFERIOR_CWD is not NULL, which is similar to what is done on
GNU/Linux for instance.
gdb/gdbserver/ChangeLog:
* win32-low.c (create_process): Only call gdb_tilde_expand if
inferior_cwd is not NULL.
---
gdb/gdbserver/win32-low.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 9f0c4e4..db5dd49 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -556,7 +556,6 @@ create_process (const char *program, char *args,
DWORD flags, PROCESS_INFORMATION *pi)
{
const char *inferior_cwd = get_inferior_cwd ();
- std::string expanded_infcwd = gdb_tilde_expand (inferior_cwd);
BOOL ret;
#ifdef _WIN32_WCE
@@ -576,6 +575,7 @@ create_process (const char *program, char *args,
if (inferior_cwd != NULL)
{
+ std::string expanded_infcwd = gdb_tilde_expand (inferior_cwd);
std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
'/', '\\');
wcwd = alloca ((expanded_infcwd.size () + 1) * sizeof (wchar_t));
@@ -607,7 +607,10 @@ Could not convert the expanded inferior cwd to wide-char."));
TRUE, /* inherit handles */
flags, /* start flags */
NULL, /* environment */
- expanded_infcwd.c_str (), /* current directory */
+ /* current directory */
+ (inferior_cwd == NULL
+ ? NULL
+ : gdb_tilde_expand (inferior_cwd).c_str()),
&si, /* start info */
pi); /* proc info */
#endif
--
2.1.4
next prev parent reply other threads:[~2018-05-04 18:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 18:30 [Windows GDBserver] Make GDBserver functional again on Windows Joel Brobecker
2018-05-04 18:30 ` [PATCH 2/3] gdbserver/Windows: Fix "no program to debug" error Joel Brobecker
2018-05-10 0:09 ` Pedro Alves
2018-05-10 16:50 ` Joel Brobecker
2018-05-04 18:30 ` [PATCH 3/3] gdbserver/Windows: crash during connection establishment phase Joel Brobecker
2018-05-04 18:46 ` Pedro Alves
2018-05-04 18:58 ` Joel Brobecker
2018-05-04 19:12 ` Pedro Alves
2018-05-07 21:47 ` Joel Brobecker
2018-05-09 15:54 ` Pedro Alves
2018-05-09 23:09 ` Joel Brobecker
2018-05-09 23:17 ` Pedro Alves
2018-05-10 17:04 ` Joel Brobecker
2018-05-04 20:20 ` Eli Zaretskii
2018-05-04 18:30 ` Joel Brobecker [this message]
2018-05-09 23:50 ` [PATCH 1/3] [gdbserver/win32] fatal "glob could not process pattern '(null)'" error Pedro Alves
2018-05-10 16:48 ` Joel Brobecker
2018-05-04 18:41 ` [Windows GDBserver] Make GDBserver functional again on Windows Sergio Durigan Junior
2018-05-04 18:54 ` Joel Brobecker
2018-05-10 18:19 ` Joel Brobecker
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=1525458603-33351-2-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/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).