Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Doubts with GDB and GDBSERVER
       [not found] <50C5D99A.8040708@larraioz.com>
@ 2012-12-10 12:57 ` John Martin
  2012-12-10 13:38   ` Luis Machado
  0 siblings, 1 reply; 6+ messages in thread
From: John Martin @ 2012-12-10 12:57 UTC (permalink / raw)
  To: gdb


Hello,

I have tried to use gdb and gdbserver to debug App but I have a doubts:

In server side:
gdbserver :12345 ./App

In client side:

GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-geode-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote 192.168.1.150:12345
Remote debugging using 192.168.1.150:12345
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0xb7fe77e0 in ?? ()
(gdb) file App
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
App: No existe el fichero o el directorio.
(gdb)


Is it possible to load symbol table App from target remote?

Best regards.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Doubts with GDB and GDBSERVER
  2012-12-10 12:57 ` Doubts with GDB and GDBSERVER John Martin
@ 2012-12-10 13:38   ` Luis Machado
  2012-12-10 13:46     ` John Martin
  0 siblings, 1 reply; 6+ messages in thread
From: Luis Machado @ 2012-12-10 13:38 UTC (permalink / raw)
  To: John Martin; +Cc: gdb

On 12/10/2012 10:57 AM, John Martin wrote:
>
> Hello,
>
> I have tried to use gdb and gdbserver to debug App but I have a doubts:
>
> In server side:
> gdbserver :12345 ./App
>
> In client side:
>
> GNU gdb (GDB) 7.5
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or
> later<http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i586-geode-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> (gdb) target remote 192.168.1.150:12345
> Remote debugging using 192.168.1.150:12345
> warning: Could not load vsyscall page because no executable was specified
> try using the "file" command first.
> 0xb7fe77e0 in ?? ()
> (gdb) file App
> A program is being debugged already.
> Are you sure you want to change the file? (y or n) y
> App: No existe el fichero o el directorio.
> (gdb)
>
>
> Is it possible to load symbol table App from target remote?
>
> Best regards.
>
>

You need a copy of the binary in the host as well... Try loading the 
symbol file *before* connecting to the remote target too.

Does that work?

Luis


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Doubts with GDB and GDBSERVER
  2012-12-10 13:38   ` Luis Machado
@ 2012-12-10 13:46     ` John Martin
  2012-12-10 13:51       ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: John Martin @ 2012-12-10 13:46 UTC (permalink / raw)
  To: lgustavo; +Cc: gdb

Hello Luis,

Yes, it works.
But I am interesting in load symbols from remote file, then it is not a 
solution for me.

Thank you very much.
Best regards.

El 10/12/12 14:38, Luis Machado escribió:
> On 12/10/2012 10:57 AM, John Martin wrote:
>>
>> Hello,
>>
>> I have tried to use gdb and gdbserver to debug App but I have a doubts:
>>
>> In server side:
>> gdbserver :12345 ./App
>>
>> In client side:
>>
>> GNU gdb (GDB) 7.5
>> Copyright (C) 2012 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or
>> later<http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show 
>> copying"
>> and "show warranty" for details.
>> This GDB was configured as "i586-geode-linux-gnu".
>> For bug reporting instructions, please see:
>> <http://www.gnu.org/software/gdb/bugs/>.
>> (gdb) target remote 192.168.1.150:12345
>> Remote debugging using 192.168.1.150:12345
>> warning: Could not load vsyscall page because no executable was 
>> specified
>> try using the "file" command first.
>> 0xb7fe77e0 in ?? ()
>> (gdb) file App
>> A program is being debugged already.
>> Are you sure you want to change the file? (y or n) y
>> App: No existe el fichero o el directorio.
>> (gdb)
>>
>>
>> Is it possible to load symbol table App from target remote?
>>
>> Best regards.
>>
>>
>
> You need a copy of the binary in the host as well... Try loading the 
> symbol file *before* connecting to the remote target too.
>
> Does that work?
>
> Luis
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Doubts with GDB and GDBSERVER
  2012-12-10 13:46     ` John Martin
@ 2012-12-10 13:51       ` Jan Kratochvil
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2012-12-10 13:51 UTC (permalink / raw)
  To: John Martin; +Cc: lgustavo, gdb

On Mon, 10 Dec 2012 14:46:37 +0100, John Martin wrote:
> Yes, it works.
> But I am interesting in load symbols from remote file, then it is
> not a solution for me.

Look at the manual and the remote: prefix for files.

I also made some experiments with remote: in these slides at the end section
"gdbserver usage":
	http://people.redhat.com/jkratoch/gdb2012.pdf


Regards,
Jan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Doubts with GDB and GDBSERVER
  2012-12-10 15:00 ` John Martin
@ 2012-12-13 21:19   ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2012-12-13 21:19 UTC (permalink / raw)
  To: John Martin; +Cc: jan.kratochvil, gdb

>>>>> "John" == John Martin <jmartin@larraioz.com> writes:

John> But gdb does not send me response about size of variable. But if I
John> call again VarInfo function, gdb return me .....

John> I have received the size of var last request and receive new
John> infromation of new var less sizeof.

John> Could somebody known gdb does not return me all request at the
John> same time???

My first guess would be buffering on your end.
If that isn't it, then it must be some kind of gdb bug.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Doubts with GDB and GDBSERVER
       [not found] <50C5F681.8050505@larraioz.com>
@ 2012-12-10 15:00 ` John Martin
  2012-12-13 21:19   ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: John Martin @ 2012-12-10 15:00 UTC (permalink / raw)
  To: jan.kratochvil; +Cc: gdb

Hello Jan,

Great, it works.
Without binary in host computer, I can read symbol table from remote target.


By other hand, I am using GDB with interpreter  MI (Machine Interface).
It works fine but there is a bit problem.
I have tried to send commands from C program to GDB using libmigdb library.

Example code:

//************************************************************************************
void InitGDBmi ()
{
     mi_set_gdb_exe(nameGDB);
     h = mi_connect_local();
     if (!h)
         printf("Connect failed\n");

//    mi_set_console_cb(h,cb_console,NULL);
//    mi_set_target_cb(h,cb_target,NULL);
//    mi_set_log_cb(h,cb_log,NULL);
//    mi_set_async_cb(h,cb_async,NULL);
//    mi_set_to_gdb_cb(h,cb_to,NULL);
     mi_set_from_gdb_cb(h,cb_from,NULL);

     gmi_set_exec(h, "LINMOT_TEST", "-qws");
}

int CallWhatis(char *data)
{
     memset(&mensaje[0], 0, sizeof(mensaje));
     strcpy(mensaje, "whatis ");
     strcat(mensaje, data);
     mi_send(h,"%s\n",mensaje);
     return mi_res_simple_done(h);
}

int CallPtype(char *data)
{
     memset(&mensaje[0], 0, sizeof(mensaje));
     strcpy(mensaje, "ptype ");
     strcat(mensaje, data);
     mi_send(h,"%s\n",mensaje);
     return mi_res_simple_done(h);
}

int CallSizeOf(char *data)
{
     memset(&mensaje[0], 0, sizeof(mensaje));
     strcpy(mensaje, "p sizeof(");
     strcat(mensaje, data);
     strcat(mensaje, ")");
     mi_send(h,"%s\n",mensaje);
     return mi_res_simple_done(h);
}

int CallAddr(char *data)
{
     memset(&mensaje[0], 0, sizeof(mensaje));
     strcpy(mensaje, "p &");
     strcat(mensaje, data);
     mi_send(h,"%s\n",mensaje);
     return mi_res_simple_done(h);
}

//************************************************************************************

In other part of the programm, I call all functions:

void VarInfo (void)
{
         CallWhatis(nameVar);
         CallPtype(nameVar);
         CallAddr(nameVar);
         CallSizeOf(nameVar);
}

And after it, gdb give  a response:

<< &"whatis PCISRAM_FD\n"
<< ~"type = INT\n"
<< ^done
<< (gdb)
<< &"ptype PCISRAM_FD\n"
<< ~"type = short int\n"
<< ^done
<< (gdb)
<< &"p &PCISRAM_FD\n"
<< ~"$1 = (INT *) 0x8670296 <PCISRAM_FD>\n"
<< ^done
<< (gdb)

But gdb does not send me response about size of variable. But if I call 
again VarInfo function, gdb return me .....


<< &"p sizeof(PCISRAM_FD)\n"
<< ~"$2 = 2"
<< ~"\n"
<< ^done
<< (gdb)
<< &"whatis panel_access_code\n"
<< ~"type = INT\n"
<< ^done
<< (gdb) Fwd: Fwd: Fwd: Re:
<< &"ptype panel_access_code\n"
<< ~"type = short int\n"
<< ^done
<< (gdb)
<< &"p &panel_access_code\n"
<< ~"$3 = (INT *) 0x8670324 <panel_access_code>\n"
<< ^done
<< (gdb)

I have received the size of var last request and receive new infromation 
of new var less sizeof.

Could somebody known gdb does not return me all request at the same time???

Best regards.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-13 21:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <50C5D99A.8040708@larraioz.com>
2012-12-10 12:57 ` Doubts with GDB and GDBSERVER John Martin
2012-12-10 13:38   ` Luis Machado
2012-12-10 13:46     ` John Martin
2012-12-10 13:51       ` Jan Kratochvil
     [not found] <50C5F681.8050505@larraioz.com>
2012-12-10 15:00 ` John Martin
2012-12-13 21:19   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox