From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36508 invoked by alias); 8 Mar 2015 07:48:02 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 36415 invoked by uid 89); 8 Mar 2015 07:48:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,MISSING_HEADERS,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: icp-osb-irony-out6.external.iinet.net.au Received: from icp-osb-irony-out6.external.iinet.net.au (HELO icp-osb-irony-out6.external.iinet.net.au) (203.59.1.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 08 Mar 2015 07:47:58 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArILAFP9+1RyxiqH/2dsb2JhbAANT4c8wiuCUQIogUEBAQEBAQGFAwkBAQQjFUABEAsNCwICBRYLAgIJAwIBAgE3AQ0QAwEHAoVtrj1wmyQBAQEBAQEBAwEBAQEBHYEhiXaEbgeCaA+BNgEElg2Eb4VxiSeDQoIiH4Fkgx4BAQU Received: from unknown (HELO [192.168.0.10]) ([114.198.42.135]) by icp-osb-irony-out6.iinet.net.au with ESMTP; 08 Mar 2015 15:47:55 +0800 Message-ID: <54FBFEAC.4020809@netspace.net.au> Date: Sun, 08 Mar 2015 07:48:00 -0000 From: Russell Shaw User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 MIME-Version: 1.0 CC: "gdb@sourceware.org" Subject: Re: Remote debugging References: <54FB02AE.60604@netspace.net.au> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00007.txt.bz2 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 > > 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.