public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26995] New: GDB hangs when non-leader thread doing an exec on a non-pthread program
@ 2020-12-01 21:20 simark at simark dot ca
  2020-12-01 21:20 ` [Bug gdb/26995] " simark at simark dot ca
  0 siblings, 1 reply; 2+ messages in thread
From: simark at simark dot ca @ 2020-12-01 21:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26995

            Bug ID: 26995
           Summary: GDB hangs when non-leader thread doing an exec on a
                    non-pthread program
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

The tests gdb.threads/non-ldr-exc-*.exp test different variations of a
non-leader threads doing an exec.  The exec'd executable is always an
executable linked with pthreads, as the executable execs itself (and it's a
threaded program, due to the nature of the test).

I noticed that when a threaded program execs a non-pthread program, the lwp
list in linux-nat.c does not get properly cleaned, the threads that disappear
due to the exec are left in there.  When we try to run the exec'd program until
its end, GDB hangs because the linux-nat target thinks that some threads still
exist, when they don't.

I will upload a patch that modifies gdb.threads/non-ldr-exc-1.exp to expose
this.

Once the test binaries are generated (after trying to run the test once), it is
possible to compare both cases like this.  This is the version where we exec a
pthread-linked program, and it runs until exit:

$ ./gdb -nx --data-directory=data-directory
testsuite/outputs/gdb.threads/non-ldr-exc-1/non-ldr-exc-1-pthreads -ex start
-ex c


And this is the version when it hangs at exit:

$ ./gdb -nx --data-directory=data-directory
testsuite/outputs/gdb.threads/non-ldr-exc-1/non-ldr-exc-1 -ex start -ex c

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/26995] GDB hangs when non-leader thread doing an exec on a non-pthread program
  2020-12-01 21:20 [Bug gdb/26995] New: GDB hangs when non-leader thread doing an exec on a non-pthread program simark at simark dot ca
@ 2020-12-01 21:20 ` simark at simark dot ca
  0 siblings, 0 replies; 2+ messages in thread
From: simark at simark dot ca @ 2020-12-01 21:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26995

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Created attachment 13018
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13018&action=edit
Patch to modify gdb.threads/non-ldr-exc-1.exp to show the bug

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-01 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 21:20 [Bug gdb/26995] New: GDB hangs when non-leader thread doing an exec on a non-pthread program simark at simark dot ca
2020-12-01 21:20 ` [Bug gdb/26995] " simark at simark dot ca

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).