From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zb8RDuJt5l87YgAAWB0awg (envelope-from ) for ; Fri, 25 Dec 2020 17:55:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 2BF141F0AA; Fri, 25 Dec 2020 17:55:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3CC1C1E965 for ; Fri, 25 Dec 2020 17:55:29 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B10DD385800D; Fri, 25 Dec 2020 22:55:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B10DD385800D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608936928; bh=iTmJeTgXGuMVU1saxNU0D3mGS+ipsybtGqjjeLCHsCc=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Vmp6i+2lHT0txDYUwy3B7aPbZSB37MZrV7dDucNClQcXlFpZJwiGBDTPtmMfxpeM6 7f0VR0/JAjpm24ZaWO/JvawG63fFCdsbpLwfCvyaQGfxKm0Cs3sxLiUv6QT/ToKBcm xehU1s75UY26+bcdRymqPoBWla8fpA8dFHeY72/o= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 04E54385800D for ; Fri, 25 Dec 2020 22:55:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 04E54385800D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 0BPMtJsu012946 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Dec 2020 17:55:24 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 0BPMtJsu012946 Received: from [10.0.0.213] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4D0FF1E965; Fri, 25 Dec 2020 17:55:19 -0500 (EST) Subject: Re: gdb refuses to connect to localhost To: Reinaldo Molina , gdb References: <20201225223622.a7xovhjzndth5a2x@molinamail.com> Message-ID: Date: Fri, 25 Dec 2020 17:55:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201225223622.a7xovhjzndth5a2x@molinamail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 25 Dec 2020 22:55:19 +0000 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" On 2020-12-25 5:36 p.m., Reinaldo Molina via Gdb wrote: > Hey guys! > > Looking for some assistants here. I am trying to debug an application using `gdbserver`, but it seems my `lo` network device is messed up. `gdb` refuses to connect to `localhost` every time. Here is my flow: > > Terminal 1: `gdbserver localhost:8888 build/luajit` > - Variants I've tried: `127.0.0.1:8888` > > Terminal 2: `gdb build/luajit -ex 'target remote localhost:8888'` > > Output from `gdb` on Terminal 2: > > (gdb) target remote :8888 > Remote debugging using :8888 > Ignoring packet error, continuing... > warning: unrecognized item "timeout" in "qSupported" response > Ignoring packet error, continuing... > Remote replied unexpectedly to 'vMustReplyEmpty': timeout That sounds like you are really connecting to something else than gdbserver. > > Output from `ip addr show lo`: > > 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 > link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 > inet 127.0.0.1/8 scope host lo > valid_lft forever preferred_lft forever > inet6 ::1/128 scope host > valid_lft forever preferred_lft forever > > Content from `/etc/hosts` > > # Static table lookup for hostnames. > # See hosts(5) for details. > 127.0.0.1 localhost > ::1 localhost > 127.0.1.1 myhostname.localdomain myhostname > > I'm using the command to monitor the ports: `netstat -tulanp`. Here is the output right after running just `gdbserver`: > > (Not all processes could be identified, non-owned process info > will not be shown, you would have to be root to see it all.) > tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 193337/gdbserver > > Output just after telling `gdb` to connect: > > (Not all processes could be identified, non-owned process info > will not be shown, you would have to be root to see it all.) > tcp 1 0 0.0.0.0:8888 0.0.0.0:* LISTEN 193337/gdbserver > tcp 0 0 127.0.0.1:50720 127.0.0.1:8888 ESTABLISHED 195502/gdb > tcp 478 0 127.0.0.1:8888 127.0.0.1:50720 ESTABLISHED - > > Looks promising but then: > > (Not all processes could be identified, non-owned process info > will not be shown, you would have to be root to see it all.) > tcp 1 0 0.0.0.0:8888 0.0.0.0:* LISTEN 193337/gdbserver > tcp 0 0 127.0.0.1:50720 127.0.0.1:8888 FIN_WAIT2 - > tcp 722 0 127.0.0.1:8888 127.0.0.1:50720 CLOSE_WAIT - I have no clue. Try "set debug remote 1" in GDB before connecting, see what data GDB receives. You can also start GDBserver with --remote-debug to see if there is some chit chat when GDB connects to it. If you don't see anything here, it's probably because GDB ended up connecting to some other program. Simon