Memory write tracing/logging of an application / Watchpoints in Genode/Fiasco.OC

Josef Stark j.stark at ...256...
Sun Feb 4 18:04:00 CET 2018

Hey Martin,

the next problem that I'm facing now is that I don't know how to access 
the instruction that caused the pagefault. I have the instruction 
pointer but not the instruction itself (opcode and operands).
Your vinit code [1] uses an imprint to identify the corresponding 
Rm_client and then find the correct region by the IP address:
> Rm_client * const rm_client = Rm_client::by_id(state.imprint);
> addr_t off, ip = client_state->ip;
> Rm_session_component * const rm = rm_client->session();
> Region * const region = rm->_find_region((void *)ip, &off);
> Dataspace_capability ds_cap = region->ds_cap();
> void * local = env()->rm_session()->attach(ds_cap, 0, region->offset());
> unsigned instr = *(unsigned *)((addr_t)local + off);
However, I'm again wondering if there's an easier way to find the 
dataspace considering that my checkpointer only has this one child (and 
I also know the binary name), and for the thread state it was already 
possible after you explained it to me.
Where do I look? I tried looking through the RAM dataspaces, but so far, 
trial and error didn't yield any success. Probably because I'm doing 
something wrong, and due to the architectural changes introduced between 
12.11 and 16.08 it's again hard for me to re-use vinit code, so maybe 
you can push me in the right direction again.

Another thing that I don't completely understand: The pagefault report 
includes the memory address where the pagefault occured. I can 
successfully find the corresponding data space. Experimenting a bit 
showed me that the reported address seems to be 8-Byte-aligned. (Because 
incrementing the accessed address in the test application byte by byte 
only results in an 8-byte jump of the reported address 'state.addr' 
every 8 bytes. Inside an 8-byte group it stays the same.)
But how can I find out which of the 8 byte(s) was actually accessed? 
Especially considering that single-byte access doesn't have to be 
aligned. I think that for your emulator this information was not 
necessary, so [2] doesn't provide it. But is it even contained in the 

Best regards,

[1] os/src/vinit/include/rm_session/component.h: state()
[2] os/src/vinit/arm_v7a/instruction.h: load_store()

More information about the users mailing list