coolcokel
V2EX  ›  问与答

c 程序编译问题

  •  
  •   coolcokel · Jan 7, 2019 · 2221 views
    This topic created in 2708 days ago, the information mentioned may be changed or developed.

    最近在做系统还原工作,代码已经编译通过,服务能够跑起来,因为没有日志输出,只能通过 gdb 单步调试,请教下各位如何将日志打印出来,或者有什么好的快速定位问题的方法

    8 replies    2019-01-08 21:31:44 +08:00
    Chenamy2017
        1
    Chenamy2017  
       Jan 7, 2019
    log 文件
    GPIO
        2
    GPIO  
       Jan 7, 2019
    用 pipe 收集错误输出。
    coolcokel
        3
    coolcokel  
    OP
       Jan 7, 2019
    @Chenamy2017 程序没有日志文件
    coolcokel
        4
    coolcokel  
    OP
       Jan 7, 2019
    @GPIO 具体怎么使用呢,刚才百度一圈,仍有疑惑
    GPIO
        5
    GPIO  
       Jan 7, 2019
    @coolcokel 你的程序有标准输出吗?如果有的话可以用 > 或者 >> 将输出定向到文件,或者使用 | 将输出作为另一个程序的输入。
    peihanw
        6
    peihanw  
       Jan 8, 2019
    strace 查看一下系统调用及参数,可能会有些帮助。
    coolcokel
        7
    coolcokel  
    OP
       Jan 8, 2019 via Android
    @GPIO 多谢,程序后面加了-d 0 > log.txt
    coolcokel
        8
    coolcokel  
    OP
       Jan 8, 2019 via Android
    @peihanw 学习一下,之前没用过
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2837 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 02:45 · PVG 10:45 · LAX 19:45 · JFK 22:45
    ♥ Do have faith in what you're doing.