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

5.4 Multiple Maps

It is perfectly possible (and useful!) to load more than one map in the same IO space. It is very natural for a single file, for example, to contain data that can be interpreted in several ways, or of different nature.

Let’s for example open again an ELF file, this time compiled with -g:

(poke) .file foo.o

We now load our self map, to get a view of the file as a collection of sections:

(poke) .map load self

And now we load the dwarf map that comes with poke, to get a view of the file as having debugging information encoded in DWARF:

[self(poke) .map load dwarf

See how the prompt now reflects the fact that the current IO space contains DWARF info! Let’s take a look:

[dwarf,self](poke) .info maps
IOS   Name    Source
#0    dwarf   /home/jemarch/gnu/hacks/poke/maps/
#0    self    ./
[dwarf,self](poke) .map show dwarf
Offset    Entry
0x5bUL#B  $dwarf::info

Now we can access entries from any of the loaded maps, i.e. access the file in terms of different perspectives. As an ELF file:

[dwarf,self](poke) $self::shdr[1]
Elf64_Shdr {

And as a file containing DWARF info:

[dwarf,self](poke) $dwarf::info
Dwarf_CU_Header {

If you are curious about how the DWARF entries are defined, look at maps/ in the poke source distribution, or in your installed poke (.info maps will tell you the file the map got loaded from.)

It is possible to unload or remove a map from a given IO space using the .map remove dot-command. Say we are done looking at the DWARF in foo.o, and we are no longer interested in it as a file containing debugging info. We can do:

[dwarf,self](poke) .map remove dwarf

Note how the prompt was updated accordingly: only self remains as a loaded map on this file.

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