This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem using gdbserver


The problem is solved by using the command "(gdb) file <executable-name>"
instead of "(gdb) symbol-file <executable-name>" and by interchanging the
order of execution of this command and "(gdb) target remote
107.108.3.197:2020"

> Hi,
>
> The set up for GDB as remote debugger (target=arm-linux, host=i386) is
> successful.
> The following is my sample test program "test.c"
> /******************************************************/
> #include <stdio.h>
> int main()
> {
>         int i;
>         printf("Hello World \n");
>         for(i=0; i<3; i++)
>                 printf("Checking counter %d \n", i);
>         return 0;
> }
> /***************************************************/
>
> I compiled the above program using arm-linux-gcc with -g option and kept
in
> the target.
> These are the following snap shots while debugging this program
>
> /********************************* TARGET*********************** *****/
> [root@Linux /mnt]$./gdbserver 107.108.3.197:2020 test
> Process test created; pid = 227
> Remote debugging from host 107.108.4.244
> Hellotest (227): undefined instruction: pc=02000354
> Code: e59f003c ebffffc8 (e7ffdefe) e50b3010 e51b3010
>  World
> test (227): undefined instruction: pc=02000358
> Code: ebffffc8 e3a03000 (e7ffdefe) e51b3010 e3530002
>
> Child terminated with signal = 4
>
> Child terminated with signal = 0x4
> GDBserver exiting
> [root@Linux /mnt]$
>
> /**** ******************************HOST********************* ******/
> (gdb) target remote 107.108.3.197:2020
> Remote debugging using 107.108.3.197:2020
> 0x40002560 in ?? ()
> (gdb) symbol-file test
> Reading symbols from test...done.
> (gdb) list
> 1       #include <stdio.h>
> 2
> 3       int main()
> 4       {
> 5
> 6               int i;
> 7
> 8               printf("Hello World \n");
> 9
> 10
> (gdb) list
> 11              for(i=0; i<3; i++)
> 12                      printf("Checking counter %d \n", i);
> 13
> 14              return 0;
> 15      }
> 16
> (gdb) break 11
> Breakpoint 1 at 0x2000354: file test.c, line 11.
> (gdb) cont
> Continuing.
>
> Breakpoint 1, main () at test.c:11
> 11              for(i=0; i<3; i++)
> (gdb) n
>
> Program received signal SIGILL, Illegal instruction.
> 0x02000358 in main () at test.c:11
> 11              for(i=0; i<3; i++)
> (gdb) n
>
> Program terminated with signal SIGILL, Illegal instruction.
> The program no longer exists.
> (gdb)
>
>
/***************************************************************************
> ******/
>
> I don't know why things are going wrong. Am I missing some thing?? One can
> observe that "Hello World" is printed seperately on the Target. Any kind
of
> help is appreciated in this regard.
>
> Thanks & Regards,
> Balaram.
>
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]