Missing symbol names in gdbserver but not with gdb

I wanted to start using gdbserver for remote debugging and so I tested its functionality on my local machine with a simple test program that generates a segfault shown below:

segfault.c - compiled for an elf named "test"

#define NULL ((void*)0)
int main()
{
    int value = *((int*)NULL);
    return value;
}

      

Now when I run:

#gdb test

(gdb)run

I get:

Starting program: /home/awaibel/digiworkspace/test/Debug/test 

Program received signal SIGSEGV, Segmentation fault.
0x080483bf in main () at ../segfault.c:4
4       int value = *((int*)NULL);

      

however, if I debug it with the gdb server like this:

#gdbserver :65535 test

#gdb test

(gdb)target remote 127.0.0.1:65535

(gdb)continue

it gives me debug info:

Program received signal SIGSEGV, Segmentation fault.
0x080483bf in ?? ()

      

it seems to give the same function address for segfault, but the name and line number are omitted when debugging with a remote debugger. is it possible for the remote debugger to display this information, and if so, how?

I think I should add that the program was compiled with GCC using the "-g" debug flag

+1


source to share


1 answer


Thanks to the comments from markys, I was able to figure out the problem. Since the gdb client parses symbols and not the server, I had to make sure the client knows the full path to the copy of the executable. Since "test" was not in the current directory of the command line that was used to run gdbtest, it did not have a copy of the symbols in use. adding the binary to PATH for the terminal the client is running on solved the problem. Thank.

To summarize:

  • server side:


gdbserver --multi: port "path to executable"

  • client side:

gdb "path to executable" (gdb)> target remote "ip-of-the-remote-device: port"

+2


source







All Articles