在crash中可以用whatis命令查看数据类型信息以及函数的原型。
如果想知道某个数据是什么类型那么可以用下面的方法:
查看结构体的定义
crash> whatis mm_struct struct mm_struct { struct { struct maple_tree mm_mt; unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned lon; unsigned long mmap_base; unsigned long mmap_legacy_base; ...
上面显示mm_struct是一个结构体,那么也可以用struct
命令:
crash> struct mm_struct struct mm_struct { struct { struct maple_tree mm_mt; unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned lon; unsigned long mmap_base; unsigned long mmap_legacy_base; ...
查看联合体的定义
crash> whatis snd_pcm_sync_id union snd_pcm_sync_id { unsigned char id[16]; unsigned short id16[8]; unsigned int id32[4]; } SIZE: 16
查看typedef类型
crash> whatis call_single_data_t typedef struct __call_single_data { struct __call_single_node node; smp_call_func_t func; void *info; } call_single_data_t; SIZE: 32 crash> whatis cpumask_var_t typedef struct cpumask { unsigned long bits[1]; } [1] cpumask_var_t; SIZE: 8 crash> whatis smp_call_func_t typedef void (*)(void *) smp_call_func_t; SIZE: 8
查看枚举类型的定义
crash> whatis acpi_execute_type typedef enum { OSL_GLOBAL_LOCK_HANDLER = 0 OSL_NOTIFY_HANDLER = 1 OSL_GPE_HANDLER = 2 OSL_DEBUGGER_MAIN_THREAD = 3 OSL_DEBUGGER_EXEC_THREAD = 4 OSL_EC_POLL_HANDLER = 5 OSL_EC_BURST_HANDLER = 6 } acpi_execute_type; crash> whatis pageflags enum pageflags { PG_locked = 0 PG_referenced = 1 PG_uptodate = 2 PG_dirty = 3 PG_lru = 4 PG_active = 5 PG_workingset = 6 PG_waiters = 7 PG_error = 8 PG_slab = 9 PG_owner_priv_1 = 10 PG_arch_1 = 11 ... };
查看函数原型
crash> whatis blk_update_request bool blk_update_request(struct request *, blk_status_t, unsigned int);
查看全局变量的类型
crash> whatis cfd_data struct call_function_data cfd_data;