updating oE register_block


include std/machine.e 
procedure register_block(machine_addr block_addr, positive_int block_len,  
            valid_memory_protection_constant memory_protection = PAGE_READ_WRITE ) 

Adds a block of memory to the list of safe blocks maintained by safe.e (the debug version of memory.e). The block starts at address a. The length of the block is i bytes.

  1. block_addr : an atom, the start address of the block
  2. block_len : an integer, the size of the block.
  3. protection : a constant integer, of the memory protection constants found in machine.e, that describes what access we have to the memory.

In memory.e, this procedure does nothing. It is there to simplify switching between the normal and debug version of the library.

This routine is only meant to be used for debugging purposes. safe.e tracks the blocks of memory that your program is allowed to peek, poke, mem_copy etc. These are normally just the blocks that you have allocated using Euphoria's allocate routine, and which you have not yet freed using Euphoria's free. In some cases, you may acquire additional, external, blocks of memory, perhaps as a result of calling a C routine.

If you are debugging your program using safe.e, you must register these external blocks of memory or safe.e will prevent you from accessing them. When you are finished using an external block you can unregister it using unregister_block.

Example 1:
 atom addr 
addr = c_func(x, {}) 
register_block(addr, 5) 
poke(addr, "ABCDE") 
See Also:

unregister_block, Safe Mode

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu