Source code in on machine A, binary is on machine B, is there a way for GDB to refer

This is a discussion on Source code in on machine A, binary is on machine B, is there a way for GDB to refer within the C++ Programming forums, part of the General Programming Boards category; A gdb problem. Source code in on machine A, its binary is on machine B. Binary was complied using -g ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    Source code in on machine A, binary is on machine B, is there a way for GDB to refer

    A gdb problem.

    Source code in on machine A, its binary is on machine B. Binary was complied using -g option.
    When I debug it using gdb, it only shows the line number, not the code content at the line. Is there a way for GDB to refer source code at machine B during debug?

    Thank you!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,649

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    I carefully read the webpage, it does not solve my problem:
    Suppose code on A machine is at 129.1.1.1:/home/test/code/

    I am debugging on B machine.
    I launched gdb example_test
    (gdb) set substitute-path /home/test/code/ 129.1.1.1:/home/test/code/

    No symbol "substitute" in current context.

    It seems "dir" or "set substitute-path" is just referring code on the same machine, but not between 2 machines?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Unless you can use NFS to mount a directory on machine A onto machine B, you have to copy the source from one to the other. It can be a real pain to do that, but it's unfortunately not possible to solve in any other way. [At least, I can't think of any other way].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    Thank you!
    One more question: why "set substitute-path" doesn't work in my gdb?

    (gdb) set substitute-path
    No symbol "substitute" in current context.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Search for patterns in source code
    By MiamiCuse in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-23-2005, 11:28 PM
  2. learning to work with SDKs & source code out there...
    By psasidisrcum in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2005, 09:26 PM
  3. Linux source code
    By afreedboy in forum Linux Programming
    Replies: 6
    Last Post: 06-25-2004, 10:12 AM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. C source code for int25 or code help
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 09-26-2001, 02:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21