1<html><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.78.1"><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="intro.html" title="Chapter 1. Introduction"><link rel="next" href="debugfunctions.html" title="Chapter 3. Debug functions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><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="intro.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="debugfunctions.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="howto"></a>Chapter 2. Howto use debugobjects</h1></div></div></div><p> 2 A kernel subsystem needs to provide a data structure which 3 describes the object type and add calls into the debug code at 4 appropriate places. The data structure to describe the object 5 type needs at minimum the name of the object type. Optional 6 functions can and should be provided to fixup detected problems 7 so the kernel can continue to work and the debug information can 8 be retrieved from a live system instead of hard core debugging 9 with serial consoles and stack trace transcripts from the 10 monitor. 11 </p><p> 12 The debug calls provided by debugobjects are: 13 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-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><li class="listitem"><p>debug_object_assert_init</p></li></ul></div><p> 14 Each of these functions takes the address of the real object and 15 a pointer to the object type specific debug description 16 structure. 17 </p><p> 18 Each detected error is reported in the statistics and a limited 19 number of errors are printk'ed including a full stack trace. 20 </p><p> 21 The statistics are available via /sys/kernel/debug/debug_objects/stats. 22 They provide information about the number of warnings and the 23 number of successful fixups along with information about the 24 usage of the internal tracking objects and the state of the 25 internal tracking objects pool. 26 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="debugfunctions.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> 27