[Bug gdb/19558] New: Trying to attach the same process twice borks gdbserver

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] New: Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

            Bug ID: 19558
           Summary: Trying to attach the same process twice borks
                    gdbserver
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com
  Target Milestone: ---

Trying to attach to the same process twice (a bad manipulation from the user)
leads to gdbserver's internal state to be messed up.

I started gdbserver with:

$ gdbserver --multi :1234

Then, in gdb:

$ gdb
(gdb) tar ext :1234
...
(gdb) attach 5549
...
(gdb) add-inferior
(gdb) inferior 2
(gdb) attach 5549
Attaching to process 5549
Attaching to process 5549 failed


gdbserver displays the right error:

gdbserver: Cannot attach to process 5549: Operation not permitted (1), process
5549 is already traced by process 5379

but then it appears that gdb disconnects, because gdbserver prints this again:

Listening on port 1234

Then, pretty everything in the gdb session is broken.

(gdb) inferior 1
(gdb) info threads
Unknown remote qXfer reply: OK

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

Simon Marchi <simon.marchi at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.dumais at ericsson dot com,
                   |                            |simon.marchi at ericsson dot com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

Simon Marchi <simon.marchi at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.khouzam at ericsson dot com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

--- Comment #1 from Marc Dumais <marc.dumais at ericsson dot com> ---
It seems that this issue can be reproduced with a single attach, if the attach
somehow fails. For example, if the user doesn't have permission to attach to
the process.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #2 from Pedro Alves <palves at redhat dot com> ---
Is this a regression?

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

--- Comment #3 from Marc Dumais <marc.dumais at ericsson dot com> ---
(In reply to Pedro Alves from comment #2)
> Is this a regression?

Hi Pedro,

It doesn't seem to be. I have reproduced this with a few versions, down-to
7.6.1, but did not try older versions.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
Thanks Marc.  (Trying to access where this one stands re. priority for gdb
7.11.)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/19558] Trying to attach the same process twice borks gdbserver

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=19558

--- Comment #5 from Simon Marchi <simon.marchi at ericsson dot com> ---
Another consequence of the same bug, if you start gdbserver with --once,
gdbserver exits when an attach fails.  I don't think that's right.

--
You are receiving this mail because:
You are on the CC list for the bug.