[xdebug-general] Re: XDEBUG_CONFIG and reading source files

From: Blake Schwendiman <blake[@]mediafence.com>
Date: Wed May 05 2004 - 18:08:55 CEST

Here's a small patch for the bugs I had mentioned. There is actually one
real bug and then some performance enhancements.

diff -b xdebug/usefulstuff.c ext/xdebug/usefulstuff.c
56a57,61
>
> if ( ( newl < READ_BUFFER_SIZE ) && ( 0 != newl ) )
{ // eof
> buffer[newl] = delim;
> newl++;
> }
diff -b xdebug/xdebug_handler_dbgp.c ext/xdebug/xdebug_handler_dbgp.c
272c272
< fd = open(file, 0);

---
> 	fd = open(file, O_RDONLY);
285a286,287
> 		if ( NULL == line )
> 		  break;
287a290,293
> 
> 	if ( i > 0 )
> 	  return source.d;
> 
298c304
< 	} while (i < end + 1 - begin);
---
> 	} while ((i < end + 1 - begin) && (NULL != line));
934c940
< 		begin = strtol(CMD_OPTION('e'), NULL, 10);
---
> 		end = strtol(CMD_OPTION('e'), NULL, 10);
The last change line is the bug.  It was impossible to set the beginning and
end arguments to the "source" command in dbgp because the 'end' variable was
never getting set.
Anyway, I'll keep in touch.
Blake
-----Original Message-----
From: Derick Rethans [mailto:derick@xdebug.org] 
Sent: Tuesday, May 04, 2004 12:41 AM
To: Blake Schwendiman
Cc: xdebug-general@lists.xdebug.org
Subject: Re: [xdebug-general] XDEBUG_CONFIG and reading source files
Hello Blake,
On Mon, 3 May 2004, Blake Schwendiman wrote:
> I have two questions.  The first is a result of simply trying to get 
> the debugger (ver 2.0.0 debugclient in DBGp mode) to stop.  Apparently 
> I have to set an environment variable (XDEBUG_CONFIG) to something in 
> order for the magic_cookie variable to be set (CLI mode) which is a 
> prerequisite for the debugger to "kick in".  Is that right?
Yes, you can also configure some options here, like:
derick@kossu:/dat/dev/php/xdebug$ export XDEBUG_CONFIG=remote_enable=1\
remote_port=9000\ remote_host=127.0.0.1
derick@kossu:/dat/dev/php/xdebug$ set | grep XDEBUG
XDEBUG_CONFIG='remote_enable=1 remote_port=9000 remote_host=127.0.0.1'
> The second is more like a suggestion than a question.  The function 
> fd_read_line_delim in usefulstuff.c never finds the delimiter if it 
> doesn't exist at the end of the source file:
>
>  while (context->buffer_size < 1 || 
> context->buffer[context->buffer_size - 1] != delim) {
>
> I generally do not place any characters after the ?> in my PHP 
> scripts, so this function doesn't work correctly when I'm using a 
> small file that does not have a "\n" at the very end.  If I add the 
> "\n" to the file, then everything is fantastic.  Related to this, I've 
> noticed that the return_source function reads 0 - 999,999 times even 
> if the entire file has been exhausted after just a couple of lines.
>
> I have some other things that I need to do right away, but if I get a 
> chance and I haven't heard from you, I may try to patch these last two 
> items later.
Okay, I'll have a look if I find some time this week.
regards,
Derick
PS: Please use a subject in your mails.
Received on Wed May 5 18:10:43 2004

This archive was generated by hypermail 2.1.8 : Fri Jul 04 2008 - 21:00:10 CEST