0
点赞
收藏
分享

微信扫一扫

iOS高级强化--005:nm命令

扒皮狼 2021-09-23 阅读 100

nm命令:打印nlist结构的符号表Symbol Table

常用命令参数

nm -pa a.o

nlist

定义符号的具体表示含义:

struct nlist {
    // 表示垓符号在string table的索引
    union {
        //在Mach-0中不使用此字段
        char *n_name;
        // 索引
        long n_strx;
    } n_un;
    unsigned char n_type;  /* type flag, see below */
    unsigned char n_sect;  /* section number or NO_ SECT */
    short          n_desc; /* see <mach-o/stab.h> */
    unsigned long n_value; /* value of this symbol (or stab offset) */
};
#define N_GSYM    0x20 /* 全局符号: name, ,N0_ SECT,type,0 */
#define N_FNAME   0x22 /* procedure name (f77 kludge): name,,N0_ SECT,0,0 */
#define N_FUN     0x24 /* 方法/函数: name,,n_ sect,linenumber , address */
#define N_STSYM   0x26 /* 静态符号: name,,n sect, type , address */
#define N_LCSYM   0x28 /* .lcomm 符号: name,,n sect , type , address */
#define N_BNSYM   0x2e /* nsect符号开始: 0,,n sect,0, address */
#define N_OPT     0x3c /* emitted with gccZ_ compiled and in gcc source */
#define N_RSYM    0x40 /* 寄存器符号: name,NO_ _SECT, type,register */
#define N_SLINE   0x44 /* 代码行数: 0,,n ,sect,linenumber , address */
#define N_ENSYM   0x4e /* nsect符号结束: ø,,n sect,ø, address */
#define N_SSYM    0x60 /* 结构体符号: name,, NO SECT, type,struct_ offset */
#define N_SO      0x64 /* 源码名称: name,,n sect, 0, address */
#define N_OSO     0x66 /* 目标代码名称: name, ,0,0,st_ mtime */
#define N_LSYM    0x80 /* 本地符号: name, ,N0_ SECT,type ,offset */
#define N_BINCL   0x82 /* include file 开始: name,,NO_ SECT,0,sum */
#define N_SOL     0x84 /* #included file 名称: name,,n sect ,0, address */
#define N_PARAMS  0x86 /* 编译器参数: name,,NO_ SECT,0,0 */
#define N_VERSION 0x88 /* 编译器版本: name,,N0_ SECT,0,0 */
#define N_OLEVEL  0x8A /* 编译器-O级别: name,NO_ _SECT,0,0 */
#define N_PSYM    0xa0 /* 参数: name,,No_ _SECT, type,offset */
#define N_EINCL   0xa2 /* include file 结束: name,,NO_ SECT,0,0 */
#define N_ENTRY   0xa4 /* alternate entry: name, ,n. sect,linenumber , address */
#define N_LBRAC   0xc0 /* 左括号: 0,,N0_ SECT,nesting level,address */
#define N_EXCL    0xc2 /* deleted include file: name, ,NO_ SECT,0,sum */
#define N_RBRAC   0xe0 /* 右括号: 0,,N0. _SECT ,nesting level , address */
#define N_BCOMM   0xe2 /* 通用符号开始: name,,NO. SECT,0,0 */
#define N_ECOMM   0xe4 /* 通用符号结束: name,n. sect,0,0 */
#define N_ECOML   0xe8 /* end common (local name): 0,,n_ sect , 0, address */
#define N_LENG    0xfe /* second stab entry with length information */

/*
 * for the berkeley pascal compiler, pC(1):
 */
#define N_ _PC    0x30 /* global pascal symbol: name, ,NO_ SECT, subtype,line */
在LLVM项目中调试nm命令
举报

相关推荐

0 条评论