linux 内核数据结构调试

static ssize_t led_max_brightness_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
    global_printf = 0;
    int ret;
unsigned long addr=0xff0000f5;
    ret = find_next_zero_bit(&addr, 32, 0);
    struct sysfs_dirent *sd;
    sd = sysfs_new_dirent("testidr", 0644, 2);
    //sysfs_add_file_mode




#if 0
s3c_pm_dbg( "&sysfs_ino_ida: 0x%x.\r\n", &sysfs_ino_ida );

s3c_pm_dbg( "sysfs_ino_ida.idr.top: 0x%x.\r\n", sysfs_ino_ida.idr.top );
s3c_pm_dbg( "sysfs_ino_ida.idr.id_free: 0x%x.\r\n", sysfs_ino_ida.idr.id_free );
s3c_pm_dbg( "sysfs_ino_ida.idr.layers: 0x%x.\r\n", sysfs_ino_ida.idr.layers );
s3c_pm_dbg( "sysfs_ino_ida.idr.id_free_cnt: 0x%x.\r\n", sysfs_ino_ida.idr.id_free_cnt );
s3c_pm_dbg( "sysfs_ino_ida.idr.lock: 0x%x.\r\n\r\n", sysfs_ino_ida.idr.lock );





s3c_pm_dbg( "sysfs_ino_ida.idr.top->bitmap: 0x%x.\r\n", sysfs_ino_ida.idr.top->bitmap );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[3]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[3] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->count: 0x%x.\r\n", sysfs_ino_ida.idr.top->count );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->layer: 0x%x.\r\n\r\n", sysfs_ino_ida.idr.top->layer );


s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->bitmap: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->bitmap );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->ary[0]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->ary[0] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->ary[1]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->ary[1] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->ary[2]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->ary[2] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->ary[3]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->ary[3] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->count: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[0]->count );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[0]->layer: 0x%x.\r\n\r\n", sysfs_ino_ida.idr.top->ary[0]->layer );


s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->bitmap: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->bitmap );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->ary[0]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->ary[0] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->ary[1]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->ary[1] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->ary[2]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->ary[2] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->ary[30]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->ary[30] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->count: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[1]->count );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[1]->layer: 0x%x.\r\n\r\n", sysfs_ino_ida.idr.top->ary[1]->layer );


s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->bitmap: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->bitmap );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->ary[0]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->ary[0] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->ary[1]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->ary[1] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->ary[2]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->ary[2] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->ary[7]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->ary[7] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->ary[8]: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->ary[8] );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->count: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[2]->count );
s3c_pm_dbg( "sysfs_ino_ida.idr.top->ary[2]->layer: 0x%x.\r\n\r\n", sysfs_ino_ida.idr.top->ary[2]->layer );


//s3c_pm_dbg( "sysfs_ino_ida.idr.top->bitmap: 0x%x.\r\n", sysfs_ino_ida.idr.top->ary[3]->count );
#endif






//main345();
//s3c_pm_dbg( "dev->class->name: %s.\r\n", dev->class->name );
//s3c_pm_dbg( "dev->name: %s.\r\n", dev->init_name);
if( dev->parent ){
//s3c_pm_dbg( "dev->parent->class: %x.\r\n", dev->parent->class );
   //s3c_pm_dbg( "dev->parent->name: %s.\r\n", dev->parent->class->name );
    }


    //s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.name );
//s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.parent->name );
//s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.parent->parent->name );
//s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.parent->parent->parent->name );
//s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.parent->parent->parent->parent->name );
//s3c_pm_dbg( "dev->kobj.name: %s.\r\n", dev->kobj.parent->parent->parent->parent->parent->name );




//s3c_pm_dbg( "dev->bus: %x.\r\n", dev->bus );
    //s3c_pm_dbg( "dev->bus->name: %s.\r\n", dev->bus->name );
//s3c_pm_dbg( "dev->bus->name: %s.\r\n", dev->bus->name );

//led_heartbeat_function
//s3c_pm_dbg("\r\n-----------------------------\r\n");
//s3c_pm_dbg("in leds_init led-class.\r\n");
global_printf=1;


//dump_stack();
    //dev_attr_show  sysfs_read_file


struct led_classdev *led_cdev = dev_get_drvdata(dev);


return sprintf(buf, "%u\n", led_cdev->max_brightness);

}



void s3c_pm_dbg(const char *fmt, ...)
{   
unsigned long flags;


    //return;
if( global_printf ){
        return;
}
    raw_local_irq_save(flags);
    //return;
va_list va;
char buff[256];       
va_start(va, fmt);
vsprintf(buff, fmt, va);
va_end(va);


printascii(buff);
raw_local_irq_restore(flags);
}


//EXPORT_SYMBOL(s3c_pm_dbg);
EXPORT_SYMBOL(s3c_pm_dbg);



uart_rev_a_char

你可能感兴趣的:(linux 内核数据结构调试)