[fpc-pascal] Firebird stored procedure exceptions generate access violation

Michael Van Canneyt michael at freepascal.org
Sat Jun 5 12:23:28 CEST 2010



On Sat, 5 Jun 2010, Jim wrote:

> On 5-6-2010 10:47, Michael Van Canneyt wrote:
>> On Sat, 5 Jun 2010, Jim wrote:
> <snip>
>>> Finally, the question:
>>> What I really want is to get a Firebird SQLCODE error code or some other
>>> details that allow me to figure out whether one of my custom exceptions
>>> get called. Also, it seems something is wrong after the error; although
>>> the objects still seem to exist, the database obviously won't insert
>>> anymore.
>>>
>>> How do I get proper error codes and/or fix this code? (Of course,
>>> suggestions on code improvement etc are also welcome)
>>
>> It might be worth putting all parameters in a record definition and pass
>> the
>> record to your function. That makes the procedure declaration somewhat more
>> manageable and understandable. (and definitely more efficent as well).
>>
>> Then, there is an access violation in your code:
>> Try to get a stack trace, we can then tell where the access violation
>> occured, maybe it will tell us a little more.
>
> I've not yet looked into converting the procedure call parameters into a
> record.
> However, using gdb I got the following backtrace:
> gdb flocate
> break fpc_raiseexception
> =>gives Cannot access memory at address 0xc800
> run c:\windows\system32 => passing the directory for flocate to search in.
> ... snip a lot of my program's debug output...
> Debug: 5-6-2010 11:54:30: SaveDirectoryEntry: going to add parameters
> for insert query (nmwcdclsx64.dll)
> Debug: 5-6-2010 11:54:30: SaveDirectoryEntry: insert query code done.
> (nmwcdclsx64.dll)
> Debug: 5-6-2010 11:54:30: SaveDirectoryEntry: going to add parameters
> for insert query (NOISE.CHS)
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000010000ad7d in FINALIZE$_DATEUTILS ()
> (gdb) backtrace
> #0  0x000000010000ad7d in FINALIZE$_DATEUTILS ()
> #1  0x0000000005d73f80 in ?? ()
> #2  0x00000000012baf10 in ?? ()
> #3  0x00000000012baf10 in ?? ()
> #4  0x000000010000715c in FINALIZE$_DATEUTILS ()
> #5  0x0000000000010a70 in ?? ()
> #6  0x0000000077c38f15 in ?? ()
> #7  0x0000000000010000 in ?? ()
> #8  0x0000000005d73f80 in ?? ()
> #9  0x000000000102ef00 in ?? ()
> #10 0x00000001000531b0 in FINALIZE$_DATEUTILS ()
> #11 0x0000000000000000 in ?? ()
>
> Hope this is what you're looking for...

It is, but it doesn't give the expected output. 
Are you using a UDF ?

Michael.



More information about the fpc-pascal mailing list