<br><br><div class="gmail_quote">On Sat, Dec 25, 2010 at 9:23 PM, Hernán Morales Durand <span dir="ltr"><<a href="mailto:hernan.morales@gmail.com">hernan.morales@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Thanks for the answers guys. It is very dissapointing to try a fix<br>
when the VM suddenly dissapears over and over again. I have no time<br>
for building a plugin, so our best options are to wait a fix from<br>
someone with VM/FFI knowledge or slowly specify the struct alignments<br>
of the Z39.50 structures (and not sure if it's the real cause<br>
because... the VMs segfaults).<br></blockquote><div><br></div><div>Program in the debugger. Seriously, run the VM from within gdb. You have the changes file for crash recovery. You use gdb for identifying the cause of the crash. You'll make progress, albeit slowly. Also, try writing a C program that prints out the struct offsets, e.g.</div>
<div><br></div><div>#define printoffset(struct,field) printf("&" #struct "." #field "=%d\n", (char *)&(struct.field) - (char *)&field)</div><div><br></div><div>Better still get the FFI to generate such a file for you automagically that prints out the relevant Smalltalk source.</div>
<div><br></div><div>HTH</div><div>Eliot</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Cheers,<br>
<br>
Hernán<br>
<br>
2010/12/24 David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>>:<br>
><br>
> On Fri, Dec 24, 2010 at 12:44:50PM -0300, Hern??n Morales Durand wrote:<br>
>><br>
>> Hi David,<br>
>><br>
>> 2010/12/24 David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>>:<br>
>> ><br>
>> > Hern??n,<br>
>> ><br>
>> > A segmentation fault that occurs when calling the function in an<br>
>> > external library would most likely indicate that the arguments being<br>
>> > passed to the library function are not correct for some reason.<br>
>> > Probably it is something related to the ExternalStructure as you<br>
>> > mention.<br>
>><br>
>> The strange thing is that in the Windows VM goes fine.<br>
><br>
> There are differences in the Windows an unix implementations, so<br>
> sometimes a declaration that works on Windows may need to be done<br>
> differently on unix. I don't have any examples, but I know I have<br>
> seen this in the past.<br>
><br>
>> Is there a<br>
>> special VM debug flag or parameter specifically for this cases? Maybe<br>
>> I could check with that.<br>
><br>
> I do not know of anything that would help here. In the past I have<br>
> done debugging by setting gdb breakpoints right before running<br>
> the workspace script. It's a real pain but it can be done.<br>
><br>
> I know that this does not answer your question, but if you can<br>
> consider building a plugin rather than using FFI, I think you may<br>
> find it to be easier to debug and more reliable overall.<br>
><br>
> Dave<br>
><br>
>><br>
>> > You must use a normal 32-bit VM and 32-bit libraries. I think that<br>
>> > you are doing this, but I mention it because using 64-bit VM or<br>
>> > libraries will definitely crash FFI.<br>
>> > ??<<a href="http://bugs.squeak.org/view.php?id=7237" target="_blank">http://bugs.squeak.org/view.php?id=7237</a>><br>
>> ><br>
>><br>
>> Yes, I'm sure because Ubuntu 8.10 doesn't allow to install libraries<br>
>> compiled for another architecture.<br>
>><br>
>> Cheers,<br>
>><br>
>> > Dave<br>
>> ><br>
>> > On Fri, Dec 24, 2010 at 08:33:33AM +0100, laurent laffont wrote:<br>
>> >><br>
>> >> Which VM have you used ?<br>
>> >><br>
>> >> I cross post to vm-dev list.<br>
>> >><br>
>> >> Laurent.<br>
>> >><br>
>> >> On Fri, Dec 24, 2010 at 3:54 AM, Hern??n Morales Durand <<br>
>> >> <a href="mailto:hernan.morales@gmail.com">hernan.morales@gmail.com</a>> wrote:<br>
>> >><br>
>> >> > Laurent, not much progress here :(<br>
>> >> > I just reproduced the Unix VM crash. First I've linked the library so<br>
>> >> > we do not have to change every module name call<br>
>> >> ><br>
>> >> > user@ubuntu:/usr/lib$ ln -T -s /usr/lib/libyaz.so.3.0.0 yaz<br>
>> >> ><br>
>> >> > and I've tried to execute the library tracer in the shell script<br>
>> >> ><br>
>> >> > ltrace -f -l /usr/lib/libyaz.so.3.0.0 -o out.txt "$BASE/squeakvm" \<br>
>> >> > ?? ?? ?? ??-plugins "$BASE" \<br>
>> >> > ?? ?? ?? ??-encoding latin1 \<br>
>> >> > ?? ?? ?? ??-vm-display-X11 \<br>
>> >> > ?? ?? ?? ??"$ROOT/Contents/Resources/pharo.image"<br>
>> >> ><br>
>> >> > but it crash the VM too with an unhandled exception even before the<br>
>> >> > GUI is displayed.<br>
>> >> > What I've observed is that every FFI call which receives an<br>
>> >> > ExternalStructure as parameter kills the VM. This is weird because<br>
>> >> > this doesn't happen in the Windows VM. I ran this little script I use<br>
>> >> > to debug the library<br>
>> >> ><br>
>> >> > | conn lib rs rsSize records |<br>
>> >> > lib := Z3950FFILibrary default.<br>
>> >> > conn := lib<br>
>> >> > ?? ?? ?? ??createConnectionTo: #Alabama asZ3950Server hostName<br>
>> >> > ?? ?? ?? ??port: 7090.<br>
>> >> > lib createOptions.<br>
>> >> > lib<br>
>> >> > ?? ?? ?? ??setConnection: conn<br>
>> >> > ?? ?? ?? ??optionName: 'preferredRecordSyntax'<br>
>> >> > ?? ?? ?? ??optionValue: 'USMARC'.<br>
>> >> > rs := lib<br>
>> >> > ?? ?? ?? ??searchPqf: conn<br>
>> >> > ?? ?? ?? ??query: ??'@attr 1=1003 collins'.<br>
>> >> > rsSize := lib resultSetSize: rs.<br>
>> >> > rsSize > 0<br>
>> >> > ?? ?? ?? ??ifFalse: ??[ 'no results' ].<br>
>> >> > records := Array new: rsSize.<br>
>> >> > 0 to: rsSize - 1 do: [: pos |<br>
>> >> > ?? ?? ?? ??record := lib resultSetRecord: rs position: pos.<br>
>> >> > ?? ?? ?? ??record isNil not<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ??ifTrue: ??[<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??records<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??at: pos + 1<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??put: ( lib<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??getRecord: record<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??function: 'render; charset=marc8,<br>
>> >> > iso8859-1'<br>
>> >> > ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??length: nil ). ] ].<br>
>> >> > records<br>
>> >> ><br>
>> >> > and the the doIt just hangs the VM, the console output going through<br>
>> >> > the Debugger is the following:<br>
>> >> ><br>
>> >> > Segmentation fault<br>
>> >> ><br>
>> >> > -1370902312 ContextPart>doPrimitive:method:receiver:args:<br>
>> >> > -1370902404 ContextPart>tryPrimitiveFor:receiver:args:<br>
>> >> > -1370902788 ContextPart>send:to:with:super:<br>
>> >> > -1370902896 ContextPart>send:super:numArgs:<br>
>> >> > -1370902988 InstructionStream>interpretExtension:in:for:<br>
>> >> > -1370903080 InstructionStream>interpretNextInstructionFor:<br>
>> ><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> Hern??n Morales<br>
>> Information Technology Manager,<br>
>> Institute of Veterinary Genetics.<br>
>> National Scientific and Technical Research Council (CONICET).<br>
>> La Plata (1900), Buenos Aires, Argentina.<br>
>> Telephone: +54 (0221) 421-1799.<br>
>> Internal: 422<br>
>> Fax: 425-7980 or 421-1799.<br>
</blockquote></div><br>