아래 cmm 을 실행하면 디바이스에 존재하는 struct device 인스턴스 정보를 모두 볼 수 있습니다.
;****************************************************************************
;** dpm_device_list_dump.cmm
;**
;** This cmm file is designed to dump all dpm_list.
;**
;**
;****************************************************************************
;**
;** EDIT HISTORY FOR MODULE
;**
;**
;** when who what, where, why
;** -------- --- ------------------------------------------------------
;** 01/30/2021 austindh.kim@gmail.com CREATE
Area.Create IO 80. 100.
Area.Select IO
Area IO
;=====specify the output directory of dump file, start =====
DIALOG.DIR D:\kernel_panic\*
ENTRY &ramdump_dir
&dump_debug_file="&ramdump_dir"+"/dpm_device_debug.c"
printer.FILE &dump_debug_file
printer.OPEN &dump_debug_file
&CURRENT_DPM_LIST=0x0
&FIRST_DPM_LIST=0x0
//offset of struct device.power.entry
&OFFSET_DEVICE_POWER_ENTRY=0x0
&CURRENT_DEVICE_ADDRESS=0x0
&LOOP_CONDITION=0x0
// default symbols, start
y.create.var __guillerMo_char_start 0xc000d000 char [300]
y.create.done
y.create.var __guillerMo_char_end 0xc000e000 char [300]
y.create.done
y.create.var __guillerMo_char_dpm_noirq 0xc000f000 char [300]
y.create.done
v __guillerMo_char_start="============= START ==========="
v __guillerMo_char_end="============== END ============"
v __guillerMo_char_dpm_noirq="@@@@@@@@DPM_NOIRQ_LIST@@@@@@@@@@@"
// default symbols, end
y.create.var __guillerMo_dpm_list 0 struct list_head
y.create.done
y.create.var __guillerMo_device 0 struct device
y.create.done
symbol.modify.address __guillerMo_dpm_list VAR.VALUE(&dpm_list)
gosub getDeviceOffsetAddress
&FIRST_DPM_LIST=VAR.VALUE(&dpm_list)
&CURRENT_DPM_LIST=&FIRST_DPM_LIST
while &LOOP_CONDITION!=0x7
(
&CURRENT_DEVICE_ADDRESS=&CURRENT_DPM_LIST-&OFFSET_DEVICE_POWER_ENTRY
symbol.modify.address __guillerMo_device &CURRENT_DEVICE_ADDRESS
// start logging display struct device*
wp.v.v %string.on __guillerMo_char_start
wp.v.v %string.on __guillerMo_device.kobj.name
wp.v.v %all %L __guillerMo_device
wp.v.v %string.on __guillerMo_char_end
// end logging display struct device*
&CURRENT_DPM_LIST=V.VALUE( ((struct list_head *)&CURRENT_DPM_LIST)->next )
if &CURRENT_DPM_LIST==&FIRST_DPM_LIST
(
&LOOP_CONDITION=0x7
)
)
// start logging dpm_noirq_list for struct device*
wp.v.v %string.on __guillerMo_char_dpm_noirq
&FIRST_DPM_LIST=VAR.VALUE(&dpm_noirq_list)
&CURRENT_DPM_LIST=&FIRST_DPM_LIST
&LOOP_CONDITION=0x0
while &LOOP_CONDITION!=0x7
(
&CURRENT_DEVICE_ADDRESS=&CURRENT_DPM_LIST-&OFFSET_DEVICE_POWER_ENTRY
symbol.modify.address __guillerMo_device &CURRENT_DEVICE_ADDRESS
// start logging display struct device*
wp.v.v %string.on __guillerMo_char_start
wp.v.v %string.on __guillerMo_device.kobj.name
wp.v.v %all %L __guillerMo_device
wp.v.v %string.on __guillerMo_char_end
// end logging display struct device*
&CURRENT_DPM_LIST=V.VALUE( ((struct list_head *)&CURRENT_DPM_LIST)->next )
if &CURRENT_DPM_LIST==&FIRST_DPM_LIST
(
&LOOP_CONDITION=0x7
)
)
printer.close
y.create.RESET
enddo
; *************************************************************************
; getDeviceOffsetAddress
;
; This function determines offset of struct device.power.entry
; *************************************************************************
getDeviceOffsetAddress:
LOCAL &local_power_entry &local_power_offset
&local_power_entry=0x0
&local_power_offset=0x0
symbol.modify.address __guillerMo_device VAR.VALUE(&dpm_list)
&local_power_entry=V.ADDRESS(__guillerMo_device.power.entry)
&local_power_offset=&local_power_entry-V.ADDRESS(__guillerMo_device)
&OFFSET_DEVICE_POWER_ENTRY=&local_power_offset
RETURN
// end of getDeviceOffsetAddress
'[Debugging] Tips' 카테고리의 다른 글
[리눅스커널] 디바이스 트리: of_root 디버깅 (0) | 2023.05.04 |
---|---|
[TRACE32] 메모리 덤프에서 검색(서치)하는 명령어: data.find (0) | 2023.05.04 |
[GDB] Arm(Armv7): C 코드와 어셈블리 코드를 동시에 디버깅하기 (0) | 2023.05.04 |
[리눅스커널] 디버깅: TRACE32: 모듈 타입 드라이버 심벌(*.ko)을 로딩해 깨진 콜 스택 복원 (0) | 2023.05.04 |
[라즈베리파이] crash-utility 설치(Arm64) (0) | 2023.05.04 |