T32로 디버깅을 하다보면 struct의 선언부를 확인하고 싶을 때가 있어요.
예를 들어서 struct tty_struct 구조체의 멤버를 갑자기 확인하고 싶은 경우,
 
"do do_struct.cmm tty_struct" 요렇게 입력하면 상세 멤버 변수를 확인할 수 있어요.
struct tty_struct struct tty_struct struct(620 bytes, [0] int magic (signed 32 bits),
                                                      [4] struct kref kref struct(4 bytes, [0] atomic_t refcount struct(4 bytes, [0] int counter (signed 3
                                                      [8] struct device * dev (pointer to struct device, 32 bits),
                                                      [12] struct tty_driver * driver (pointer to struct tty_driver, 32 bits),
                                                      [16] struct tty_operations * ops (pointer to struct tty_operations, 32 bits),
                                                      [20] int index (signed 32 bits),
                                                      [24] struct ld_semaphore ldisc_sem struct(40 bytes, [0] long int count (signed 32 bits), [4] raw_spi
                                                      [64] struct tty_ldisc * ldisc (pointer to struct tty_ldisc, 32 bits),
                                                      [68] struct mutex atomic_write_lock struct(40 bytes, [0] atomic_t count struct(4 bytes, [0] int coun
                                                      [108] struct mutex legacy_mutex struct(40 bytes, [0] atomic_t count struct(4 bytes, [0] int counter
                                                      [148] struct mutex throttle_mutex struct(40 bytes, [0] atomic_t count struct(4 bytes, [0] int counte
                                                      [188] struct rw_semaphore termios_rwsem struct(36 bytes, [0] long int count (signed 32 bits), [4] st
                                                      [224] struct mutex winsize_mutex struct(40 bytes, [0] atomic_t count struct(4 bytes, [0] int counter
                                                      [264] spinlock_t ctrl_lock struct(16 bytes, [0] union (untagged) union(16 bytes, [0] struct raw_spin
                                                      [280] spinlock_t flow_lock struct(16 bytes, [0] union (untagged) union(16 bytes, [0] struct raw_spin
                                                      [296] struct ktermios termios struct(44 bytes, [0] tcflag_t c_iflag (unsigned 32 bits), [4] tcflag_t
                                                      [340] struct ktermios termios_locked struct(44 bytes, [0] tcflag_t c_iflag (unsigned 32 bits), [4] t
                                                      [384] struct termiox * termiox (pointer to struct termiox, 32 bits),
                                                      [388] char [64] name (array of char, 64 bytes, 0..63),
                                                      [452] struct pid * pgrp (pointer to struct pid, 32 bits),
                                                      [456] struct pid * session (pointer to struct pid, 32 bits),
                                                      [460] long unsigned int flags (unsigned 32 bits),
                                                      [464] int count (signed 32 bits),
                                                      [468] struct winsize winsize struct(8 bytes, [0] short unsigned int ws_row (unsigned 16 bits), [2] s
                                                      [476.0] long unsigned int stopped:1 (unsigned 32 bits),
                                                      [476.1] long unsigned int flow_stopped:1 (unsigned 32 bits),
                                                      [476.2] long unsigned int unused:30 (unsigned 32 bits),
                                                      [480] int hw_stopped (signed 32 bits),
                                                      [484.0] long unsigned int ctrl_status:8 (unsigned 32 bits),
                                                      [485.0] long unsigned int packet:1 (unsigned 32 bits),
                                                      [485.1] long unsigned int unused_ctrl:23 (unsigned 32 bits),
                                                      [488] unsigned int receive_room (unsigned 32 bits),
                                                      [492] int flow_change (signed 32 bits),
                                                      [496] struct tty_struct * link (pointer to struct tty_struct, 32 bits),
                                                      [500] struct fasync_struct * fasync (pointer to struct fasync_struct, 32 bits),
                                                      [504] int alt_speed (signed 32 bits),
                                                      [508] wait_queue_head_t write_wait struct(24 bytes, [0] spinlock_t lock struct(16 bytes, [0] union (
                                                      [532] wait_queue_head_t read_wait struct(24 bytes, [0] spinlock_t lock struct(16 bytes, [0] union (u
                                                      [556] struct work_struct hangup_work struct(16 bytes, [0] atomic_long_t data struct(4 bytes, [0] int
                                                      [572] void * disc_data (pointer to void, 32 bits),
                                                      [576] void * driver_data (pointer to void, 32 bits),
                                                      [580] struct list_head tty_files struct(8 bytes, [0] struct list_head * next (pointer to struct list
                                                      [588.0] unsigned char closing:1 (unsigned 8 bits),
                                                      [592] unsigned char * write_buf (pointer to unsigned char, 32 bits),
                                                      [596] int write_cnt (signed 32 bits),
                                                      [600] struct work_struct SAK_work struct(16 bytes, [0] atomic_long_t data struct(4 bytes, [0] int co
                                                      [616] struct tty_port * port (pointer to struct tty_port, 32 bits))
 
do_struct.cmm이란 T32 script의 구현부는 아래와 같습니다.
Area.Create IO 80. 100.
Area.Select IO
Area IO
 
;=====specify the output directory of dump file, start =====
ENTRY &struct_name
 
v.type % %m %l %hi %sp struct &struct_name
ENDDO
 
참 유용하죠.

+ Recent posts