public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Russell Shaw <rjshaw@netspace.net.au>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Remote debugging
Date: Sun, 08 Mar 2015 07:48:00 -0000	[thread overview]
Message-ID: <54FBFEAC.4020809@netspace.net.au> (raw)
In-Reply-To: <CAHOBVAe-+XqQEZn5fD8afmKtOqR+PgK4_b=vKxTD1XUsyjypqg@mail.gmail.com>

On 08/03/15 01:09, Ofir Cohen wrote:
> Hi Russel,
> I hope this is what you're looking for.
>
> I see two approaches:
> 1) File system sharing/copying utility
>      Similar to what you suggested, NFS, scp, etc.
>
>      I do remote debugging all the time with gdb and gdbserver, and I have this
>      batch file (both my host and target are Windows OSes) that copies
> my binaries
>      over SMB share.
>
>      If you build your sources frequently, and you're paranoid about
> typing the same commands
>      over and over again, how about adding a post-build command to call
> this script to deploy the files?
>
>
> 2) Transferring files via remote protocol
>       Once you're connected from gdb to gdbserver, you can use the
> following command [1]:
>       remote put <host file> <target file>
>
>       However, this might be an overkill as it will require gdbserver
> [2] to be attached to
>       some dummy process, and will most likely require you to start new
> gdb and gdbserver
>       processes in order to debug the new binary.
>
> I personally consider option #1 as a valid and normal way of
> host2target remote debugging workflow.

Hi,

I put in /home/russell/myprogdir/.gdbinit:

target extended-remote main:1234

cd /home/russell/myprogdir

file myprog
remote put myprog myprog2

break main

run

define hook-run
kill
file myprog
remote put myprog myprog2
end


I was going to do on the laptop (the above test is all in the same directory on 
the same pc):

gdbserver main:1234 myprog2


When testing with gdbserver invoked on the same pc (main) in the same directory 
(/home/russell/myprogdir), "myprog" is truncated to 0 bytes by "remote put 
myprog myprog", so i had to use myprog2 for the copy. I filed a bug for that.

"remote put" should first copy myprog to /tmp/, open the remote myprog for 
writing (which truncates it), then copy from /tmp/. Another way is to note the 
source and dest are the same, and skip the copying.

  reply	other threads:[~2015-03-08  7:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07 13:52 Russell Shaw
2015-03-07 14:09 ` Ofir Cohen
2015-03-08  7:48   ` Russell Shaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-22 14:23 luca risso
2004-03-19 17:59 luca risso
2004-03-19 18:43 ` Daniel Jacobowitz
2003-06-13 14:24 remote debugging nak26
2003-06-13  7:50 Brijesh Shukla
2003-06-13 13:28 ` Quality Quorum
2003-03-20  7:45 Patricia Alba
2002-12-12  9:29 Remote Debugging Tim
2002-12-12 10:30 ` Daniel Jacobowitz
2002-07-22  9:35 remote debugging Vinayak P Risbud
2001-01-25  5:27 malar kavi
2001-01-25 11:46 ` J.T. Conklin
2001-01-23 22:23 malar kavi
2001-01-24  6:16 ` Fernando Nasser
2001-01-24 10:52 ` J.T. Conklin
2000-11-30 22:27 Remote Debugging Yu Xuanwei
2000-12-01 11:40 ` Fernando Nasser
2000-11-29 19:52 Yu Xuanwei
2000-11-28  0:59 Remote debugging Yu Xuanwei
2000-08-15 10:13 remote debugging Shaun Jackman
2000-08-15 12:23 ` Fernando Nasser
2000-04-01  0:00 Remote Debugging Timo Ketola
2000-02-23 19:12 ` Andrew Cagney
2000-04-01  0:00   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54FBFEAC.4020809@netspace.net.au \
    --to=rjshaw@netspace.net.au \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).