Next: , Previous: , Up: Maps and Map-files   [Contents][Index]


5.6 Constructing Maps

As we have seen, we can define our own maps using map files like self.map, which contain a prologue and a set of map entries. However, sometimes it is useful to create maps “on the fly” while we explore some data with poke.

To make this possible, poke provides a suitable set of dot-commands. Let’s say we are poking some data, and we want to create a map for it. We can do that like this:

(poke) .map create mymap

This creates an empty map named mymap, with no entries:

[mymap](poke) .map show mymap
Offset   Entry

Adding entries is easy. First, we have to map some variable, and then use it as the base for the new entry:

[mymap](poke) var foo = int[3]  0#B
[mymap](poke) .map entry add mymap, foo
[mymap](poke) .map show mymap
Offset   Entry
0x0UL#B  $mymap::foo

Note how the entry $mymap::foo gets created, associated to the current IO space and mapped at the same offset than the variable foo.

We can remove entries from existing maps using the .map entry remove dot-command:

[mymap](poke) .map entry remove mymap, foo
[mymap](poke) .map show mymap
Offset   Entry
[mymap](poke)

We plan to add an additional command to save maps to map files. The idea is that you can create your maps on the fly, save them, and then load them back some other day when you are ready to continue poking. This is not implemented yet though.