GDB won't load source file

后端 未结 2 1919
野趣味
野趣味 2020-12-17 17:45
  1. I\'m using arm-linux-gcc to compile a simple C file at host (debian i386) with -g.
  2. Then copy the a.out file to the targ
相关标签:
2条回答
  • 2020-12-17 18:22

    Read carefully the documentation of GDB notably about source path. You want to use the dir command

    Also, switch to a newer gdb (perhaps by compiling gdb from its source code). Current version is 7.7 (so 6.8 is really old)

    0 讨论(0)
  • 2020-12-17 18:28

    AFAIK you need a copy of source on your target machine (where you run the debugger).

    Another way to debug this is to run your code under gdbserver on target machine, then connect to gdbserver from your PC. So, first on target machine do something like:

    gdbserver localhost:9999 a.out
    

    Then on your PC do:

    gdb a.out
    target remote your-target-ip-or-name:9999
    ...
    

    For me compiling with your switches and then trying to list source in gdb lists source as expected. You must not move source or binary around, or gdb will not be able to locate it.

    0 讨论(0)
提交回复
热议问题