David T. Lewis | 1 Jun 2011 12:04
Picon
Favicon

Re: Getting information from broken image

On Wed, Jun 01, 2011 at 07:11:19AM +0200, Mateusz Grotek wrote:
> Hi.
> Is there a way to get data from broken image. I suppose I should split
> my question in two:
> 1. Is there a way to get source code from broken image?
> 2. Is there a way to get objects from broken image and put it into
> another one?

Here are a couple of links that will help with your first question:

  <http://www.youtube.com/watch?v=Q1nOqsSg8Ik>

  <http://wiki.squeak.org/squeak/2168>

Question 2 may be a little more difficult. Can you say how the image
became broken?

Dave
Mateusz Grotek | 2 Jun 2011 12:12
Picon
Favicon

Re: Getting information from broken image

David T. Lewis pisze:
> On Wed, Jun 01, 2011 at 07:11:19AM +0200, Mateusz Grotek wrote:
>> Hi.
>> Is there a way to get data from broken image. I suppose I should split
>> my question in two:
>> 1. Is there a way to get source code from broken image?
>> 2. Is there a way to get objects from broken image and put it into
>> another one?
> 
> Here are a couple of links that will help with your first question:
> 
>   <http://www.youtube.com/watch?v=Q1nOqsSg8Ik>
> 
>   <http://wiki.squeak.org/squeak/2168>
> 
> Question 2 may be a little more difficult. Can you say how the image
> became broken?

The problem is old, and I've already solved it (I used become in the
wrong way). So the question is more theoretical. I donno how the image
is organized, but if it's like a filesystem maybe it would be possible
to create some tool to extract objects from it. I wondered if there is
such a tool. (I suppose the answer is no). Thanks.
Casey Ransberger | 2 Jun 2011 21:26
Picon

Re: Getting information from broken image

Hi,

On Jun 2, 2011, at 3:12 AM, Mateusz Grotek <unoduetre <at> poczta.onet.pl> wrote:

(big snip)

I donno how the image
is organized, but if it's like a filesystem maybe it would be possible
to create some tool to extract objects from it. I wondered if there is
such a tool. (I suppose the answer is no). Thanks.

So it's a big heap of objects, which are comprised mostly of references to other objects. 

I struggled quite a bit at first to map the persistent object memory onto something that I could really recognize, like a filesystem. 

I'm not sure how useful this metaphor is, but here's a try: it's almost like a filesystem in which almost everything is a symbolic link to something else, if you envision the objects as analogous to directories. Oh, and there are cyclical references going on, I don't think the weak metaphor I'm using here can hold that part up very well:)

I can't say anything of real use WRT extracting stuff from a completely hosed image; I've needed at least a recovery console to open in order to make it back to a state that I can recover objects from. Basically the image format is currently beyond my experience, but if I wanted to find out how it works, the first thing I would try is pulling down VMMaker and looking at the Slang code for the object memory itself. This could be terrible advice though, so I'd go for a second opinion if I was you:)

If just you want to move some objects between two images, you might want to check out SmartRefStream. 

I've also longed to see some tools for image exploration/visualization. I'm really excited about the work of Craig Latta in this area. I would strongly recommend that you check out Spoon when you can. 
_______________________________________________
Beginners mailing list
Beginners <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Herbert König | 2 Jun 2011 22:00
Picon

Re[2]: Getting information from broken image

Hi Mateusz,

>>> 2. Is there a way to get objects from broken image and put it into
>>> another one?
http://lists.squeakfoundation.org/pipermail/vm-dev/2010-August/005242.html
might help. It describes the format of the image fileand it from the thread
"[squeak-dev] reading objects of a dead image" on Squeak dev from May
14th 2011.

I seem to remember there was a discussion about a tool to do this but
my Google fu was not strong enough.

--

-- 
Cheers,

Herbert   
Mateusz Grotek | 3 Jun 2011 02:42
Picon
Favicon

Re: Getting information from broken image

> http://lists.squeakfoundation.org/pipermail/vm-dev/2010-August/005242.html
> might help. It describes the format of the image fileand it from the thread
> "[squeak-dev] reading objects of a dead image" on Squeak dev from May
> 14th 2011.
> 

Thanks.
David T. Lewis | 3 Jun 2011 03:15
Picon
Favicon

Re: Getting information from broken image

On Thu, Jun 02, 2011 at 12:12:17PM +0200, Mateusz Grotek wrote:
> David T. Lewis pisze:
> > On Wed, Jun 01, 2011 at 07:11:19AM +0200, Mateusz Grotek wrote:
> >> Hi.
> >> Is there a way to get data from broken image. I suppose I should split
> >> my question in two:
> >> 1. Is there a way to get source code from broken image?
> >> 2. Is there a way to get objects from broken image and put it into
> >> another one?
> > 
> > Here are a couple of links that will help with your first question:
> > 
> >   <http://www.youtube.com/watch?v=Q1nOqsSg8Ik>
> > 
> >   <http://wiki.squeak.org/squeak/2168>
> > 
> > Question 2 may be a little more difficult. Can you say how the image
> > became broken?
> 
> The problem is old, and I've already solved it (I used become in the
> wrong way). So the question is more theoretical. I donno how the image
> is organized, but if it's like a filesystem maybe it would be possible
> to create some tool to extract objects from it. I wondered if there is
> such a tool. (I suppose the answer is no). Thanks.

This may not really be a beginners topic, but in principle you can
operate on your broken image, and potentially get access to the objects
in it. The Squeak virtual machine (the executable program that runs your
image file) is actually written mainly in Squeak (but translated to C
for speed). This is described in an important paper that every new
Squeak user should take a moment to read:
  http://ftp.squeak.org/docs/OOPSLA.Squeak.html

The Squeak virtual machine (VM), written in Squeak, along with some
classes and methods that take the place of the "platform support code"
(high performance code usually written in C to interface the VM to
the operating system, such as Windows or Linux), give you a Squeak
program that we refer to as the "Interpreter Simulator", which basically
means the VM itself running within Squeak. All of this code was
originally distributed in early Squeak images as part of the base
system, but nowadays is maintained separately in the VMMaker package
on www.squeaksource.com.

How does all of this relate to your question? If you have a valid
image file on your disk, as opposed to a corrupt file, and if this
image has some sort of problem caused by using #become in a bad
way (who among us has not tried that?), then in principle you can
load that image file into an InterpretSimulator in another Squeak
image. Once loaded, the VM and the object memory and all of the
objects in your broken image are available to be explored and
manipulated directly in Squeak. So the tool for exploring your
broken image file is .... Squeak itself.

To be realistic, you probably will never actually use this approach,
at least not unless your broken image contains some very valuable
objects, because exploring your image in this way will require
some real knowledge and experience. But it is possible, and it
is at least interesting to know that you could do such a thing
if you have enough curiosity and patience to undertake it.

Dave

Gmane