<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Chapter 2. Howto use debugobjects</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Debug objects life time" /><link rel="up" href="index.html" title="Debug objects life time" /><link rel="prev" href="ch01.html" title="Chapter 1. Introduction" /><link rel="next" href="ch03.html" title="Chapter 3. Debug functions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Howto use debugobjects</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter 2. Howto use debugobjects"><div class="titlepage"><div><div><h2 class="title"><a id="howto"></a>Chapter 2. Howto use debugobjects</h2></div></div></div><p> A kernel subsystem needs to provide a data structure which describes the object type and add calls into the debug code at appropriate places. The data structure to describe the object type needs at minimum the name of the object type. Optional functions can and should be provided to fixup detected problems so the kernel can continue to work and the debug information can be retrieved from a live system instead of hard core debugging with serial consoles and stack trace transcripts from the monitor. </p><p> The debug calls provided by debugobjects are: </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>debug_object_init</p></li><li class="listitem"><p>debug_object_init_on_stack</p></li><li class="listitem"><p>debug_object_activate</p></li><li class="listitem"><p>debug_object_deactivate</p></li><li class="listitem"><p>debug_object_destroy</p></li><li class="listitem"><p>debug_object_free</p></li></ul></div><p> Each of these functions takes the address of the real object and a pointer to the object type specific debug description structure. </p><p> Each detected error is reported in the statistics and a limited number of errors are printk'ed including a full stack trace. </p><p> The statistics are available via /sys/kernel/debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the internal tracking objects pool. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 1. Introduction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Debug functions</td></tr></table></div></body></html>