Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Graeme Geldenhuys
Paul Ishenin het geskryf:
 12.03.2010 23:51, Paul Ishenin wrote:

 If something more is required please let me know and I will search.
 Also found the next document with more info:
 http://www.agner.org/optimize/calling_conventions.pdf

And here is more information.


  http://docwiki.embarcadero.com/RADStudio/en/Program_Control



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unable to open file on Linux randomly in a CGI application when using templates

2010-03-15 Thread Jonas Maebe


On 15 Mar 2010, at 03:17, ABorka wrote:


On 3/14/2010 16:08, Jonas Maebe wrote:


On 14 Mar 2010, at 23:39, ABorka wrote:

I have a CGI application with a datamodule that is using templates  
to generate the response pages (accessing a MySQL database through  
ZEOS).
Every once in a while, I'm getting an Unable to open file  
exception that points to one of the templates the website is using.


What could be the problem?


Maybe you run out of file handles?

If that is the case, shouldn't something be in the syslog or some  
other log?


No. It's a generic user error like any other.

Is there any way I can check this for sure like last system error  
string or something?


You can call sysutils.GetLastOSError and look up the number in errno.inc

The exception message only says that Unable to open file  
filepath_filename.


I checked the /proc/sys/fs/file-max  and it shows 294692


The per-user open file handles limit is different. You can see it in  
the output of ulimit -a under bash (if it says unlimited, it means  
that it uses the system limit). Maybe you leak file handles somewhere.  
You can look in /proc/pid/fd from time to time to see whether the  
number of open files keeps growing over time.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Jonas Maebe


On 15 Mar 2010, at 04:01, Paul Ishenin wrote:


12.03.2010 21:49, Jonas Maebe wrote:

The default calling convention could be used. This would only work  
for
routines with simple return types though (types that are not  
returned

via a hidden first parameter).


I don't think any/default calling convention have result return in  
EAX as fpc do.


All calling conventions on i386 (except for safecall) return simple  
results in eax.



Also for methods self needs to be passed.


That's true, but GDB already does that when calling a method,  
including for Pascal (the only problem in that respect is that without  
the hacky patch mentioned earlier, GDB's Pascal parser does not  
support expressing method calls).



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Jonas Maebe


On 15 Mar 2010, at 07:49, Graeme Geldenhuys wrote:


And here is more information.

 http://docwiki.embarcadero.com/RADStudio/en/Program_Control


Thank you, that is the information that was needed:

For a string, dynamic array, method pointer, or variant result, the  
effects are the same as if the function result were declared as an  
additional var parameter following the declared parameters. In other  
words, the caller passes an additional 32-bit pointer that points to a  
variable in which to return the function result.


This explains http://bugs.freepascal.org/view.php?id=15691


Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Paul Ishenin

15.03.2010 17:01, Jonas Maebe wrote:


the only problem in that respect is that without the hacky
patch mentioned earlier, GDB's Pascal parser does not support expressing
method calls.


The remaining question for me is whether you will implement that hacky 
patch :) ?


Best regards,
Paul Ishenin.


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Jonas Maebe


On 15 Mar 2010, at 11:12, Paul Ishenin wrote:


15.03.2010 17:01, Jonas Maebe wrote:


the only problem in that respect is that without the hacky
patch mentioned earlier, GDB's Pascal parser does not support  
expressing

method calls.


The remaining question for me is whether you will implement that  
hacky patch :) ?


It has to be fixed first so it is no longer hacky. I don't know when I  
will have time for that.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Flávio Etrusco
On Mon, Mar 15, 2010 at 7:31 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 15 Mar 2010, at 11:12, Paul Ishenin wrote:

 15.03.2010 17:01, Jonas Maebe wrote:

 the only problem in that respect is that without the hacky
 patch mentioned earlier, GDB's Pascal parser does not support expressing
 method calls.

 The remaining question for me is whether you will implement that hacky
 patch :) ?

 It has to be fixed first so it is no longer hacky. I don't know when I will
 have time for that.


 Jonas

Is it available somewhere?

Best regards,
Flávio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] properties with getter evaluation in gdb

2010-03-15 Thread Jonas Maebe

On 15 Mar 2010, at 14:13, Flávio Etrusco wrote:

 On Mon, Mar 15, 2010 at 7:31 AM, Jonas Maebe jonas.ma...@elis.ugent.be 
 wrote:
 
 On 15 Mar 2010, at 11:12, Paul Ishenin wrote:
 
 15.03.2010 17:01, Jonas Maebe wrote:
 
 the only problem in that respect is that without the hacky
 patch mentioned earlier, GDB's Pascal parser does not support expressing
 method calls.
 
 The remaining question for me is whether you will implement that hacky
 patch :) ?
 
 It has to be fixed first so it is no longer hacky. I don't know when I will
 have time for that.
 
 Is it available somewhere?

I've attached pascalmethodcall.patch. It's against gdb cvs head from June last 
year, so it may no longer cleanly apply (but it's pretty small, so I don't 
expect many problems).

However, unless you declare your methods as cdecl, you're not going to be able 
to call them successfully.


Jonas


pascalmethodcall.patch
Description: Binary data
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Unable to open file on Linux randomly in a CGI application when using templates

2010-03-15 Thread ABorka

Thanks for the help.

It appears that the GetLastOSError is 9 for these errors.
In the errno.inc for Linux, that is
  ESysEBADF   = 9;{ Bad file number }

I'm not exactly sure what this means though.
Right now as a workaround, when this happens, I do a sleep(100) and 
retry the page generation and it seems to work.


This only happens when multiple simultaneous requests arrive to the 
apache server (ex: a dozen iframes hitting cgi calls from a 3rd party 
website, requesting the same template to be used to generate a response 
web page with different parameters).


I would like to eliminate this problem in a more elegant way (fix) if it 
is possible.


AB

On 3/15/2010 02:58, Jonas Maebe wrote:



I have a CGI application with a datamodule that is using templates
to generate the response pages (accessing a MySQL database through
ZEOS).
Every once in a while, I'm getting an Unable to open file
exception that points to one of the templates the website is using.

What could be the problem?


Maybe you run out of file handles?


If that is the case, shouldn't something be in the syslog or some
other log?


No. It's a generic user error like any other.


Is there any way I can check this for sure like last system error
string or something?


You can call sysutils.GetLastOSError and look up the number in errno.inc


The exception message only says that Unable to open file
filepath_filename.

I checked the /proc/sys/fs/file-max and it shows 294692


The per-user open file handles limit is different. You can see it in the
output of ulimit -a under bash (if it says unlimited, it means that
it uses the system limit). Maybe you leak file handles somewhere. You
can look in /proc/pid/fd from time to time to see whether the number
of open files keeps growing over time.


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel