Changes between Version 6 and Version 7 of Tools/Memory Checker
- Timestamp:
- Feb 2, 2009, 4:54:32 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tools/Memory Checker
v6 v7 3 3 The Memory checker tool is a software memory access debugger for !SoClib. 4 4 5 = = Overview ==5 = Overview = 6 6 7 7 The Memory checker is able to perform several analysis on memory accesses performed by the running software to track software bugs. Access to uninitialized or freed data and stack overflow are examples of reported behaviors. It acts as the [http://valgrind.org/ valgrind] memory checker tool found on some UNIX. … … 40 40 An exception can be reported to an optional `GdbServer` module to stop processor execution when a suspicious memory access happened. This enables further analysis of buggy software. When using the Memory checker with the `GdbServer`, the Memory checker must wrap the processor directly and must be wrapped in the GdbServer. 41 41 42 = = Usage ==42 = Usage = 43 43 44 == = Adding Memory checker support to your platform ===44 == Adding Memory checker support to your platform == 45 45 46 46 Adding the !GdbServer to your topcell is easy. First include the header: … … 54 54 {{{ 55 55 // Without Memory checker 56 // soclib::caba::VciXcacheWrapper<soclib::common::Mips32ElIss> cpu0("cpu0", 0, maptab, IntTab(0), 1,8,4, 1,8,4);56 // soclib::caba::VciXcacheWrapper<soclib::common::Mips32ElIss> cpu0("cpu0", 0, maptab, IntTab(0), 1,8,4, 1,8,4); 57 57 58 58 // With Memory checker 59 soclib::common::Memchecker<soclib::common::Mips32ElIss>::init(maptab, loader );59 soclib::common::Memchecker<soclib::common::Mips32ElIss>::init(maptab, loader, "tty,ramdac_ctrl"); 60 60 soclib::caba::VciXcacheWrapper<soclib::common::IssMemchecker<soclib::common::Mips32ElIss> > cpu0("cpu0", 0, maptab, IntTab(0), 1,8,4, 1,8,4); 61 61 }}} … … 67 67 }}} 68 68 69 === Using an instrumented operating system === 69 == Initializer description == 70 71 The line: 72 {{{ 73 soclib::common::Memchecker<soclib::common::Mips32ElIss>::init(maptab, loader, "tty,ramdac_ctrl"); 74 }}} 75 tackes the following arguments: 76 * `maptab`: the platform's `!MappingTable`, in order to know where memory is mapped. 77 * `loader`: the platform's `!ElfLoader`, in order to know memory layout, initialized or constant parts, ... 78 * `"tty,ramdac_ctrl"` a list of exclusions in the `!MappingTable` segment's names. You should ignore any segment mapped to a device. 79 80 == Using an instrumented operating system == 70 81 71 82 The running operating system must communicate with the Memory checker to report information about context creation (stack range), and memory-allocator operations. This is done through read/write operations in specific memory locations which are intercepted by the Memory checker and not forwarded to the rest of the platform. … … 78 89 * The Memory checker registers bank is protected by a magic value and is unlikely to be modified by an other running software. 79 90 80 = = Output example ==91 = Output example = 81 92 82 93 With the following code using an unitialized stack variable to set a global: