public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Reinaldo Molina <me@molinamail.com>, gdb <gdb@sourceware.org>
Subject: Re: gdb refuses to connect to localhost
Date: Fri, 25 Dec 2020 17:55:19 -0500	[thread overview]
Message-ID: <d09ee769-fc8a-f8a7-447f-e6e52e3f2d6c@polymtl.ca> (raw)
In-Reply-To: <20201225223622.a7xovhjzndth5a2x@molinamail.com>



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: <LOOPBACK,UP,LOWER_UP> 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

  reply	other threads:[~2020-12-25 22:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 22:36 Reinaldo Molina
2020-12-25 22:55 ` Simon Marchi [this message]
2020-12-25 23:45   ` Reinaldo Molina
2020-12-26  0:00     ` Simon Marchi
2020-12-28 15:56       ` Reinaldo Molina
2020-12-28 22:29         ` Simon Marchi
2020-12-25 23:04 ` Andreas Schwab
2020-12-26  0:00   ` Reinaldo Molina
2020-12-29 15:48 ` Martin Simmons
2020-12-29 15:58   ` Reinaldo Molina
2020-12-29 21:18     ` Simon Marchi
2020-12-30  1:20       ` Reinaldo Molina

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=d09ee769-fc8a-f8a7-447f-e6e52e3f2d6c@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb@sourceware.org \
    --cc=me@molinamail.com \
    /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).