gcc_gdb

1. (arm-linux-)gcc编译过程
    预处理:    处理以“#”开头的行
        (arm-linux-)gcc -E hello.c -o hello.i
    编译: compiling C->asm, 会根据语法规则把C代码编译成相应的汇编代码
        (arm-linux-)gcc -S hello.i(.c) -o hello.s
    汇编: assembling  根据语法规则把汇编程序编译成相应的机器指令(0101)
            (arm-linux-)gcc -c hello.s -o hello.o
            or
            (arm-linux-)as hello.s  -o hello.o
    
    链接:linking, ld,装入,解决冲突(重定位)
            (arm-linux-)ld  -Ttext=30008000  hello.o a.o b.o -o hello

            arm-linux-gcc hello.s
2. gdb调试
    gcc -g hello.c -o hello
    
    gdb hello
        gdb调试命令
    (gdb)b   
            breakpoint 断点,设置断点info
            “断点”:运行在此处,就暂停
            b   行号
            b 符号(函数名,语句标号)
            设置多个断点
    
    (gdb) info b
            information of breakpoints
            查看断点信息
    (gdb) r
            runnihelp ng
            运行代码
            
    (gdb) l
            list
            查看文件
    (gdb) p  n
            print
            输出变量n的值
    (gdb) n
            next
            单步运行
            n与s的命令,仅在当前行为子函数调用时,
            n把子函数调用当作是一条语句,
            s(step)进入子函数中执行
    (gdb) s
            step
            单步运行
    (gdb) chh
            continue
            恢复程序运行
    (gdb) quit
            退出
    (gdb) help command
            帮助

   


   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值