Hi Vincent,

On Thu, Dec 4, 2014 at 7:39 AM, Blondeau Vincent <
[email protected]> wrote:

>  Finally, I succeeded to retrieve my code !
>
>
>
> I tried with the Cog VM Simulator to open my image.
>
> It opened my crashed image in the simulator without any problem (it seems
> that the failing primitive has been caught).
>
> But I cannot interact with the image through the simulator workspace and
> the morph.
>
> It seems that you can launch some code by doit to export a package named
> MyPackage:
>
>
>
> cos systemAttributes
>
>                                at: 2 put: '-doit';
>
>                                at: 3 put:    (‘RPackage
> named:’’MYPackage’) fileout ’]
>
>
>
> But this did not work because my code contains shared pools and it cannot
> be filed out…
>
>
>
>
>
> In parallel, I tried the other solution of Clement by changing the
> bytecode in the .image itself.
>
>
>
> If the problem comes from a native boost primitive, you should use a cogvm
> : (e.g.
> http://www.mirandabanda.org/files/Cog/VM/VM.r3056/cogwin-14.29.3056.zip)
> to launch the failing image.
>
> After that, you should see the crash log and see which are the code that
> is failing (apparently one of the top method in the stack).
>
> The best is to have the Smalltalk code of this method because you have to
> retrieve the associated bytecode. Else either you try to remember exactly
> the content of the method or you take another method in the stack where you
> have the code.
>
>
>
> Once you have  identified the method, extract the bytecode:
>
> on Pharo4 with the right click on the method name and by printing ‘self
> bytecode hex’
>
> on Pharo3 inspect the class containing the method, find the right compiled
> method and print ‘self bytecode hex’
>
>
>
> After that open the broken image with a hexadecimal editor (I use HxD
> under w7) (do a COPY before).
>
> Find the bytecode of the method and replace it by several 120 (78 in hex).
>
> As the bytecodes are not unique, it is possible to do several
> replacements. If you don’t want that, you can find another bytecode
> available in the stack trace. Longest is the bytecode, less will be the
> number of finding matches.
>
>
>
> Try to reopen your image with the cogwm. If it doesn’t work either you
> broke a critical method of your image (so try again with another bytecode)
> either you have another failure so you start again to find the good method.
>

You make me proud!! That's a great way to do it.  Brings back memories of
similar holes I'v dug for myself and crawled out of.  Well done!


>
>
> Once you can open it. Save your code!!!
>
> The file out didn’t work for me so I commited with Monticello in local and
> it worked!
>
>
>
> So don’t forget to commit!
>
>
>
> Vincent
>
>
>
>
>
> *De :* Blondeau Vincent
> *Envoyé :* mercredi 3 décembre 2014 18:41
> *À :* Pharo Development List
> *Objet :* RE: [Pharo-dev] Code retrieval on primitive failed
>
>
>
>
>
>
>
> *De :* Pharo-dev [mailto:[email protected]
> <[email protected]>] *De la part de* Clément Bera
> *Envoyé :* mercredi 3 décembre 2014 17:54
> *À :* Pharo Development List
> *Objet :* Re: [Pharo-dev] Code retrieval on primitive failed
>
>
>
> Please send the full stack trace. You don't have only three lines, do you ?
>
>
>
> No, indeed (the full stack is attached).
>
>
>
> There's one solution that Igor does sometimes that you can try...For that
> you need to remember what code you changed that now crashes the image in
> smalltalk. Do you know what code crash your image ?
>
> Could you rewrite it (exactly the same code) in a fresh image ?
>
> If so the process is as follow:
>
> - rewrite the crashing code in a fresh image
>
> - extract the bytecode from the compiled method
>
> - open a copy of your image with an hexadecimal editor, look for the
> bytecode pattern, replace it by returnself (byte 120 the number of times
> needed)
>
> - try open your copy. Do as little things as possible (typically, only
> file out your packages, monticello will most probably not work)
>
>
>
> Ok I will try this but this is more a generic printing method that is the
> problem (see trace)… And not a specific method…
>
> I tried but it seems not adapted to my case…
>
>
>
> The alternative is to open your image on top of the cog simulator. Word
> has been that there's a Pharo 3 image running the cog simulator, you can
> use that to debug the code and fix it. Alternatively use a squeak vmmaker
> image that you can build with this script:
>
> $ svn co http://www.squeakvm.org/svn/squeak/branches/Cog/image
>
> $ cd ./image
>
> $ ./buildsqueaktrunkvmmakerimage.sh
>
>  You put a halt on the implementation of primitive 117 in the simulator
> (named primitives call such as NB calls) to catch the crash and fix it from
> there in the simulator.
>
>
>
> That seems better ! I am trying this way.
>
>
>
> Good luck and have fun :-)
>
>
>
> Thanks :)
>
>
>
>
>
> 2014-12-03 17:04 GMT+01:00 Blondeau Vincent <
> [email protected]>:
>
> Hello everyone,
>
>
>
> I am doing some developments with NativeBoost and unfortunaly I succeed to
> save my image in a unstable state.
>
> I am using the last moose image i.e.: Pharo3.0 - Latest update: #30860.
>
>
>
> So when I want to launch my image, I get a primitive faillure.
>
> The interesting part of the stack trace is :
>
> Stack backtrace:
>
>                 [07EE7A1B] ??? + 0 in (null)
>
>                 [00539AB5] ??? + 1284789 in Pharo.exe
>
>
>
> Smalltalk stack dump:
>
>   0x2410b8 M NBFFICallout class(NBNativeCodeGen class)>retrySend:
> 0x4c70b4c: a(n) NBFFICallout class
>
>   0x2410ec I NBFFICallout class(NBNativeCodeGen class)>retrySend:
> 0x4c70b4c: a(n) NBFFICallout class
>
> 0x78a0d90 s RDoubleVector(OrderedCollection)>at:
>
>
>
> Then I wanted to retrieve my changes on a new image but, as the doIts are
> not recorded, I have neither the method deletions nor all the operations on
> classes nor the trait methods that are recorded as Doits with preamble:
>  Trait method.
>
>
>
> I tried to launch my image with squeak (which doesn’t support NativeBoost)
> to hope saving or commit my code. But as I am calling a primitive at
> startup of the image to initialize the external environement. I got the
> following trace :
>
> [31m==== Startup Error: PrimitiveFailed: primitive #isEnabled in
> NativeBoost class failed
>
> [0mNativeBoost class(Object)>>primitiveFailed:
>
> NativeBoost class(Object)>>primitiveFailed
>
> NativeBoost class>>isEnabled
>
> NativeBoost class>>forCurrentPlatform
>
> NativeBoost class>>loadSymbol:fromModule:
>
> RSession class(Object)>>nbGetSymbolAddress:module:
>
>
>
> So what can I do to retrieve all my code without loose a day to rewrite it?
>
>
>
> Thanks in advance
>
>
>
> Vincent
>
>
>
>
>  ------------------------------
>
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le secret
> professionnel. Si vous recevez ce message par erreur, merci d'en avertir
> immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
> pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra
> être recherchée quant au contenu de ce message. Bien que les meilleurs
> efforts soient faits pour maintenir cette transmission exempte de tout
> virus, l'expéditeur ne donne aucune garantie à cet égard et sa
> responsabilité ne saurait être recherchée pour tout dommage résultant d'un
> virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Worldline liability
> cannot be triggered for the message content. Although the sender endeavours
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
>
>
>
> ------------------------------
>
> Ce message et les pièces jointes sont confidentiels et réservés à l'usage
> exclusif de ses destinataires. Il peut également être protégé par le secret
> professionnel. Si vous recevez ce message par erreur, merci d'en avertir
> immédiatement l'expéditeur et de le détruire. L'intégrité du message ne
> pouvant être assurée sur Internet, la responsabilité de Worldline ne pourra
> être recherchée quant au contenu de ce message. Bien que les meilleurs
> efforts soient faits pour maintenir cette transmission exempte de tout
> virus, l'expéditeur ne donne aucune garantie à cet égard et sa
> responsabilité ne saurait être recherchée pour tout dommage résultant d'un
> virus transmis.
>
> This e-mail and the documents attached are confidential and intended
> solely for the addressee; it may also be privileged. If you receive this
> e-mail in error, please notify the sender immediately and destroy it. As
> its integrity cannot be secured on the Internet, the Worldline liability
> cannot be triggered for the message content. Although the sender endeavours
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
>



-- 
best,
Eliot

Reply via email to