Re: Getting information from broken image
David T. Lewis <lewis <at> mail.msen.com>
2011-06-03 01:15:37 GMT
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:
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
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.