RE: Problems: Remote debugging over UDP.

Atul Talesara
2004-02-24T13:01:45Z

Is it that "gdbserver" doesn't talk over UDP???
Because when I do the following:

gdbserver udp:my_system:9000 test_program

I don't see the port "9000" (with netstat -elp)to be occupied
by any of the processes! Whereas I can see the port used when
I do the same over TCP.

Also, "strace" revealed that gdbserver NEVER opens a SOCK_DGRAM
(UDP) socket!!! Here are the last few lines that actually opens
the socket:

-------------------------------------------------------
.
.
.

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
^^^^^^^^^^^^^^
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sin_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
listen(3, 1) = 0
accept(3, <unfinished ...>
^^^^^^^^^^^^^^^ <-- I kill strace here
-------------------------------------------------------

At this point when I again do netstat, I see gdbserver running
on some ephemeral TCP port and not UDP port 9000 :-(
since port '0' is passed to "bind()" call.

This is the GDB that I'm using and gdbserver coupled with it.
-------------------------------------------------------
bash-2.05b$ ~/local/bin/gdb -v
GNU gdb 20040223
Copyright 2004 Free Software Foundation, Inc.
-------------------------------------------------------

Thanks in advance.

Atul P Talesara
------------------------------------------------------------------
When "Winning" and "Losing" don't have any meaning, that is when
the real game happens, play happens. Otherwise it is war.
War has a significance for Winning or Losing.
-Sri Sri
------------------------------------------------------------------

> -----Original Message-----
> From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com]
> On Behalf Of Atul Talesara
> Sent: Monday, February 23, 2004 6:41 PM
> To: gdb@sources.redhat.com
> Subject: Problems: Remote debugging over UDP.
>
> Hello Everybody,
> I have had problems while attempting remote debugging over UDP.
> For ease, I used same system as target and host. Also, I'm
> logged in as "root" on both the consoles.
>
> On Target I do the following:
> ------------------------------
> gdbserver udp:localhost:9090 ./hello
> ^^^
>
> I get the following output:
> Process ./hello created; pid=2135
>
>
> On Host I do:
> --------------
> gdb ./hello
>
> gdb> target remote udp:localhost:9090
> ^^^
>
> and get the following o/p:
> Remote debugging using udp:localhost:9090
> Couldn't establish connection to remote target
> putpkt: write failed: connection refused.
>
>
> When I omit the "UDP" part, i.e. use TCP, everything
> works smoothly w same steps! Am I missing something important
> here because of which GDB over UDP is not working? Can anyone
> pl provide some inputs?
>
>
> Thanks and Regards,
> Atul P Talesara
> ------------------------------------------------------------------
> When "Winning" and "Losing" don't have any meaning, that is when
> the real game happens, play happens. Otherwise it is war.
> War has a significance for Winning or Losing.
> -Sri Sri
> ------------------------------------------------------------------