Archive for virtual machine

Another VM debugging trick: halting

Posted in consulting, Smalltalk, Spoon with tags , , , , on 31 December 2013 by Craig Latta

Just another little VM debugging trick I use… In one of my VM plugins I include a little C function called “breakHere”, which Smalltalk can call as a primitive. I put a breakpoint on it in the C debugger, and then have a convenient way to break in the C debugger from Smalltalk.

VM debugging trick: browsing object memory snapshots made from the C debugger in the simulator

Posted in Smalltalk, Spoon with tags , , , , , , on 17 December 2013 by Craig Latta

Recently I made use of a virtual machine debugging trick that I don’t think I’ve written about here. The virtual machine simulator is a great way to browse around the state of object memory at the point of a VM crash, but it’s relatively slow (I measured it at about 3,000 instructions per second in my sonification work). The time it takes to get to that point might be prohibitively long.

Instead, you can run to that point in the C debugger (I use lldb on Mac OS), and make a snapshot by invoking primitiveSnapshot() manually. Then, open a simulator on that snapshot and browse the objects to your heart’s content. Depending on the error, you might even be able to modify the objects such that the active process may proceed, and you can snapshot a repaired object memory from the simulator.

Image

virtual machine sonification

Posted in Smalltalk, Spoon with tags , , , , , , , on 9 December 2013 by Craig Latta

A while back I instrumented the Smalltalk virtual machine to generate visualizations of object memories. Now I’m designing instrumentations for sonification, so that the virtual machine will generate sound as it runs. This could be especially interesting for insights into the virtual machine’s operation, since I think it will run usefully in real time. It might be a useful profiling tool, for example. If you have any ideas for how to map messages and executed instructions to sound, please let me know!

toward a virtual machine browser

Posted in Naiad, Smalltalk, Spoon with tags , , on 27 November 2013 by Craig Latta

I just had an idea for the design of a “virtual machine browser”, for browsing the internal state of a running virtual machine simulator and the objects of the memory it’s running. Something more sophisticated than printing the debug support messages to the Transcript.

a detailed description of Context’s object memory visualization tools

Posted in Appsterdam, consulting, Context, Smalltalk, Spoon with tags , , , , , , , on 22 October 2012 by Craig Latta

direct graphical mapping of the object memory

When I got the current Context snapshot down to about 450 kilobytes, I realized that I could render it as a reasonably-sized picture (within 800 by 600 pixels). I was interested in doing this mostly because I’d never seen a graphical representation of the Smalltalk object memory before. As I proceeded, I found it enabled some pretty useful things.

simulator movies

In Squeak, I made an 8-bit-per-pixel bitmap, put the snapshot bytes into it linearly, and displayed it. It looked like a very peculiar sort of confetti… It wasn’t hard to see a few vague patterns, though. I instrumented the Squeak virtual machine simulator so that it would stop every so often to render a picture. I also chose the color of each pixel based on the class of the object of the corresponding byte.

I ran the simulator through the first 3000 instructions a Context object memory goes through after resuming, stopping after every 50 instructions to render a picture. (The simulated Context system went through its startup routine of reconnecting over the network to a headful system, so that one may browse it via remote messaging.) I put the pictures together into a 30-frames-per-second movie, a new picture every four frames. So here’s an example of extreme slow-motion; in the course of two seconds one sees roughly the first eight microseconds of execution time (as measured on my hardware).

exploring the space

But why just look at the pictures? I changed the normal picture viewer event handler so that when you click on a pixel, a cached simulator tells you more about the object of which the corresponding byte is a part. Coupled with an on-screen magnifying glass, this has turned out to be a valuable tool for finding more objects to delete from the Context snapshot.

Finally, I augmented the simulator to export graphs of all the reference relationships between all the objects in the system. Rummaging around in them in 3D is a lot of fun.

Please feel free to explore the graph data yourself and let me know if you find anything interesting. :) There are 8,628 objects (labelled) and 28,449 connections. It’s in a format for use with the Walrus graph visualizer (a lovely thing!).

I think this stuff gives new meaning to the old jargon phrase “smalltalk image”. :)

I’m writing a C build environment in Smalltalk.

Posted in Appsterdam, consulting, Smalltalk, Spoon with tags , , , on 17 October 2012 by Craig Latta

I can no longer tolerate makefiles, autoconf, and all the other bullshit that currently permeates building C projects like the Squeak virtual machine. We’ve had the ability to manipulate command-line utilities from Smalltalk for years. I’m writing a model of C build artifacts, dependencies, and utilities. I’m collecting transcripts of successful Squeak virtual machine builds from all platforms, from which I will reverse engineer. Please do send yours. Thanks!

%d bloggers like this: