Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Elizabeth Chastain <chastain@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] gdb/win32-nat.c: check for NULL before calling strtoul
Date: Sat, 17 Mar 2001 23:52:00 -0000	[thread overview]
Message-ID: <200103180752.XAA02531@bosch.cygnus.com> (raw)

This patch fixes PR gdb/43, a coding error in child_attach.  Cygwin's
implementation of strtoul dumps core if the input pointer is NULL.
This means gdb dumps core on a plain "attach" command with no arguments.

This fix enables the test script gdb.base/default.exp to run to
completion.

I tested this on Windows 2000 Professional + cygwin 1.1.8.  I gave a
plain "attach" command by hand and also ran gdb.base/default.exp.

OK to apply?

Michael

===

2001-03-17  Michael Chastain  <chastain@redhat.com>

	* win32-nat.c (child_attach): check args for NULL before passing
	to strtoul.  This fixes PR gdb/43.

Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.25
diff -c -3 -p -r1.25 win32-nat.c
*** gdb/win32-nat.c	2001/03/06 08:21:18	1.25
--- gdb/win32-nat.c	2001/03/18 07:40:02
*************** static void
*** 1015,1025 ****
  child_attach (char *args, int from_tty)
  {
    BOOL ok;
!   DWORD pid = strtoul (args, 0, 0);
  
    if (!args)
      error_no_arg ("process-id to attach");
  
    ok = DebugActiveProcess (pid);
  
    if (!ok)
--- 1015,1026 ----
  child_attach (char *args, int from_tty)
  {
    BOOL ok;
!   DWORD pid;
  
    if (!args)
      error_no_arg ("process-id to attach");
  
+   pid = strtoul (args, 0, 0);
    ok = DebugActiveProcess (pid);
  
    if (!ok)


             reply	other threads:[~2001-03-17 23:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-17 23:52 Michael Elizabeth Chastain [this message]
2001-03-18 12:46 ` 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=200103180752.XAA02531@bosch.cygnus.com \
    --to=chastain@cygnus.com \
    --cc=gdb-patches@sources.redhat.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