This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH]Fix that GDB will get hang on Windows when using pipe to get stdout and stderr from stub



> -----Original Message-----
> From: Eli Zaretskii [mailto:eliz@gnu.org]
> Sent: Thursday, July 12, 2012 2:36 AM
> To: Terry Guo
> Cc: gdb-patches@sourceware.org; Joey Ye
> Subject: Re: [PATCH]Fix that GDB will get hang on Windows when using
> pipe to get stdout and stderr from stub
> 
> > From: "Terry Guo" <terry.guo@arm.com>
> > Cc: <gdb-patches@sourceware.org>,
> > 	"Joey Ye" <Joey.Ye@arm.com>
> > Date: Wed, 11 Jul 2012 13:00:46 +0800
> >
> > Hi Eli,
> >
> > Could you please help to review this updated patch when you have time?
> > Thanks.
> 
> What exactly changed since the previous version?

Changes are about code secure and readability. No functionality change.

1). Previously I have code:

	char buf[81];
	int to_read = 80;

Now I change it to:

	#define GDB_MI_MSG_WIDTH  80

	char buf[GDB_MI_MSG_WIDTH + 1];
	int to_read = GDB_MI_MSG_WIDTH;

2). Another change is to add string length check. It is:

	s = read (scb->error_fd, &buf, to_read);

	if ((s == -1) || (s == 0 && !close_fd))
		break

	if (s == 0 && close_fd)
		{
			....
		}
	
	/* Current patch add this new line to check length  */
	gdb_assert (s > 0 && s <= GDB_MI_MSG_WIDTH);

	buf[s] = '\0';

The original patch is at 
http://sourceware.org/ml/gdb-patches/2012-06/msg00790.html

The updated patch is at
http://sourceware.org/ml/gdb-patches/2012-07/msg00053.html

BR,
Terry




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]