* gdbserver "load" command
@ 2010-05-17 7:38 Venkata Subbarao
2010-05-17 9:17 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Venkata Subbarao @ 2010-05-17 7:38 UTC (permalink / raw)
To: gdb
Hi,
I am trying to debug a i386 program using gdb. All I wanted to do is
to run gdbserver without the binary file and load the program using
"load" command. So following were the steps followed by me. I request
you to help me in this regard.
I have downloaded and installed GNU debugger. I ran the gdbserver as follows.
gdbserver --multi :9999
Then I ran the gdb client and tried to load the program using the
following command
gdb> target remote :9999
(This resulted in error The target is not running (try
extended-remote?). So I had to use the following command)
gdb> target extended-remote :9999
gdb> load
This printed following error.
Loading section .interp, size 0x13 lma 0x8048114
Load failed
I have following questions:
1) What is the difference between gdbserver and gdb stub ?
2) How can i load a program dynamically using "load" command in gdb ?
I kindly request you to help me in this regard.
Thanks in advance,
-- Subbarao.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdbserver "load" command
2010-05-17 7:38 gdbserver "load" command Venkata Subbarao
@ 2010-05-17 9:17 ` Pedro Alves
2010-05-18 15:05 ` Venkata Subbarao
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-05-17 9:17 UTC (permalink / raw)
To: gdb; +Cc: Venkata Subbarao
On Monday 17 May 2010 08:38:34, Venkata Subbarao wrote:
> 2) How can i load a program dynamically using "load" command in gdb ?
Use "run" instead.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdbserver "load" command
2010-05-17 9:17 ` Pedro Alves
@ 2010-05-18 15:05 ` Venkata Subbarao
2010-05-18 15:22 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Venkata Subbarao @ 2010-05-18 15:05 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb
Sorry, But how can I run without loading the file.
I have tried with "remote put" and I have succeeded with it. But I
wanted to use "load" followed by "continue" command.
I am also curious to know what actually happens when we say "load"
command. Where does it dump the file contents ? I request you to
kindly help me.
Thanks in advance,
--Subbarao
On Mon, May 17, 2010 at 2:47 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Monday 17 May 2010 08:38:34, Venkata Subbarao wrote:
>
>> 2) How can i load a program dynamically using "load" command in gdb ?
>
> Use "run" instead.
>
> --
> Pedro Alves
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdbserver "load" command
2010-05-18 15:05 ` Venkata Subbarao
@ 2010-05-18 15:22 ` Pedro Alves
2010-05-20 14:08 ` Venkata Subbarao
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2010-05-18 15:22 UTC (permalink / raw)
To: Venkata Subbarao; +Cc: gdb
On Tuesday 18 May 2010 16:05:17, Venkata Subbarao wrote:
> Sorry, But how can I run without loading the file.
You don't need to, and shouldn't use load when debugging
an unix like process. "load" only makes sense for embedded
debugging --- it copies the program straight into the target's
memory. When debugging on linux, or full blown OS, you want to
create a new process, and that's what "run" does.
> I have tried with "remote put" and I have succeeded with it.
That's good. After that, tell gdbserver which program to run
with "(gdb) set remote exec-file myprog". Then you can just
type "run" to launch a new process, just like you were
debugging natively.
If you instead start gdbserver like so:
$ gdbserver :9999 myprog
gdbserver will start the myprog program for you; This means
there'll already by a process running when you connect with
gdb.
> But I
> wanted to use "load" followed by "continue" command.
Don't.
> I am also curious to know what actually happens when we say "load"
> command. Where does it dump the file contents ?
To the debuggee/`inferior process' memory. It doesn't make much sense
to use "load" when debugging a unix-like process.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdbserver "load" command
2010-05-18 15:22 ` Pedro Alves
@ 2010-05-20 14:08 ` Venkata Subbarao
0 siblings, 0 replies; 5+ messages in thread
From: Venkata Subbarao @ 2010-05-20 14:08 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb
Thank you very much.
--Subbarao
On Tue, May 18, 2010 at 8:51 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Tuesday 18 May 2010 16:05:17, Venkata Subbarao wrote:
>> Sorry, But how can I run without loading the file.
>
> You don't need to, and shouldn't use load when debugging
> an unix like process. "load" only makes sense for embedded
> debugging --- it copies the program straight into the target's
> memory. When debugging on linux, or full blown OS, you want to
> create a new process, and that's what "run" does.
>
>> I have tried with "remote put" and I have succeeded with it.
>
> That's good. After that, tell gdbserver which program to run
> with "(gdb) set remote exec-file myprog". Then you can just
> type "run" to launch a new process, just like you were
> debugging natively.
>
> If you instead start gdbserver like so:
>
> $ gdbserver :9999 myprog
>
> gdbserver will start the myprog program for you; This means
> there'll already by a process running when you connect with
> gdb.
>
>> But I
>> wanted to use "load" followed by "continue" command.
>
> Don't.
>
>> I am also curious to know what actually happens when we say "load"
>> command. Where does it dump the file contents ?
>
> To the debuggee/`inferior process' memory. It doesn't make much sense
> to use "load" when debugging a unix-like process.
>
> --
> Pedro Alves
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-20 14:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-17 7:38 gdbserver "load" command Venkata Subbarao
2010-05-17 9:17 ` Pedro Alves
2010-05-18 15:05 ` Venkata Subbarao
2010-05-18 15:22 ` Pedro Alves
2010-05-20 14:08 ` Venkata Subbarao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox