使用attr高效除錯驅動

2021-06-17 20:58:28 字數 1358 閱讀 2278

檔案中

struct kobject ****_kobj;

#define ***_attr(_name) \

static struct kobj_attribute _name##_attr = ,                                      \

.show   = _name##_show,                 \

.store  = _name##_store,                \

檔案中//state_show是驅動除錯的讀函式

//buf是除錯的資料互動口當執行:cat state 時buf中的資料就會補讀出來,

static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,

char *buf)

#endif

#ifdef config_hibernation

s += sprintf(s, "%s\n", "disk");

#else

if (s != buf)

/* convert the last space to a newline */

*(s-1) = '\n';

#endif

return (s - buf);

}//state_store是驅動除錯的寫函式

//buf是除錯的資料互動口當執行:echo mm > state 時buf中的資料就是mm,然後驅動就可以對buf中的資料進行使用

static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,

const char *buf, size_t n)

state = decode_state(buf, n);

if (state < pm_suspend_max)

error = pm_suspend(state);

else if (state == pm_suspend_max)

error = hibernate();

else

error = -einval;

out:

pm_autosleep_unlock();

return error ? error : n;

}***_attr(state);

static struct attribute * g = ;

static struct attribute_group attr_group = ;

static int __init ***_init(void)//驅動init函式

使用OkHttp高效開發除錯

本文使用的okhttp版本是okhttp3,使用okhttp2的情況稍有不同,使用okhttp2的同學替換為okhttp3也不麻煩,api都很接近 當然,如果想要使用okhttp2使用stetho 也是可以的,可以參考官方文件。先貼出gradle依賴,基本上我使用的都是最新版本的庫。全域性統一使用的...

softice除錯驅動

作業系統 win2000sp4 虛擬機器 vmware5.5 softice driverstudio3.2自帶的softice 二 安裝注意事項 win2000sp4的安裝略過 vmware5.5 1 vmtools會對softice有影響,導致無法ctrl d撥出softice 2 如果你已經安...

Windbg Vmware驅動除錯

windbg vmware驅動除錯 1.編譯好你的驅動,假設名為showssdt.sys,並把驅動符號檔案showssdt.pdb傳送到mysyssymbols資料夾下 之前設定的自己的除錯符號資料夾 2.啟動虛擬機器,選擇除錯方式進入系統 3.在windbg中按下ctrl break,輸入bu s...