public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
@ 2010-11-08 17:45 Matthias.Gerstner at esolutions dot de
  2010-11-09 13:34 ` [Bug gdb/12203] " pedro at codesourcery dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Matthias.Gerstner at esolutions dot de @ 2010-11-08 17:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

           Summary: gdb internal error "infrun.c:2455" after trying to
                    create realtime thread on Linux
           Product: gdb
           Version: 7.0
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: Matthias.Gerstner@esolutions.de


Created attachment 5115
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5115
test program to reproduce the crash

Hello!

I've run into a problem with GDB when the debugged application attempts to
create a realtime thread on Linux e.g. with SCHED_RR as scheduler. If that
operation fails due to missing priveleges (i.e. EPERM is returned from
pthread_create()) then few instructions later gdb crashes with this:

-----
infrun.c:2455: internal-error: handle_inferior_event: Assertion `inf' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) 
-----

The crash is pretty much always reproducable but seems not to be deterministic.
I.e. it doesn't always occur at the same time and place but is subject
differences in runtime. So it's probably caused by some parallel thread or
something.

When the same program is run as root then everything is fine (pthread_create()
doesn't return with EPERM in that case).

My system is a Gentoo Linux running "GNU gdb (Gentoo 7.0.1 p1) 7.0.1". I was
able to reproduce the crash also on a Ubuntu Linux running a somewhat newer
gdb. The problem does *not* occur an older gdb like "GNU gdb 6.8" on my Gentoo
system.

I've attached a small test program that is able to reproduce the crash if you
set a breakpoint in main and step through until a few lines after the call to
pthread_create(). Again this only works if you don't have the priveleges to
create the thread.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12203] gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
  2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
@ 2010-11-09 13:34 ` pedro at codesourcery dot com
  2010-11-09 15:12 ` Matthias.Gerstner at esolutions dot de
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pedro at codesourcery dot com @ 2010-11-09 13:34 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

Pedro Alves <pedro at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |pedro at codesourcery dot
                   |                            |com

--- Comment #1 from Pedro Alves <pedro at codesourcery dot com> 2010-11-08 17:45:45 UTC ---
I think this a duplicate of PR 11692.  Please paste the gdb log leading to the
crash with:

(gdb) set debug infrun 1
(gdb) set debug lin-lwp 1

So we can confirm it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12203] gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
  2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
  2010-11-09 13:34 ` [Bug gdb/12203] " pedro at codesourcery dot com
@ 2010-11-09 15:12 ` Matthias.Gerstner at esolutions dot de
  2010-11-11 18:28 ` pedro at codesourcery dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Matthias.Gerstner at esolutions dot de @ 2010-11-09 15:12 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

--- Comment #2 from Matthias Gerstner <Matthias.Gerstner at esolutions dot de> 2010-11-09 13:34:47 UTC ---
Created attachment 5116
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5116
debug log leading to the crash

please find the attached log as requested

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12203] gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
  2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
  2010-11-09 13:34 ` [Bug gdb/12203] " pedro at codesourcery dot com
  2010-11-09 15:12 ` Matthias.Gerstner at esolutions dot de
@ 2010-11-11 18:28 ` pedro at codesourcery dot com
  2012-07-20 17:27 ` cvs-commit at gcc dot gnu.org
  2012-07-20 17:34 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pedro at codesourcery dot com @ 2010-11-11 18:28 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

Pedro Alves <pedro at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from Pedro Alves <pedro at codesourcery dot com> 2010-11-09 15:11:53 UTC ---
Thanks for the logs.  Yep, it's the same root problem as PR 11692:

LLTA: KILL(SIG0) LWP 6742 (OK)
LLW: PTRACE_CONT LWP 6742, Unknown signal 77 (preempt 'handle')
error creating thread: Operation not permitted
LLW: waitpid 6742 received Trace/breakpoint trap (stopped)
LLTA: KILL(SIG0) LWP 6742 (OK)
LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 6742.
SC:  kill LWP 6741 **<SIGSTOP>**
SC:  lwp kill 0 ERRNO-OK
WL: waitpid LWP 6741 received Stopped (signal) (stopped)
LLW: trap ptid is LWP 6742.
infrun: target_wait (-1, status) =
infrun:   -1 [process -1],
infrun:   status->kind = spurious
infrun.c:2455: internal-error: handle_inferior_event: Assertion `inf' failed.
A problem internal to GDB has been detected,

That target_wait result of "-1, spurious" means that this code in
linux-thread-db.c ran:

     /* Change ptids back into the higher level PID + TID format.  If
     the thread is dead and no longer on the thread list, we will
     get back a dead ptid.  This can occur if the thread death
     event gets postponed by other simultaneous events.  In such a
     case, we want to just ignore the event and continue on.  */

      ptid = thread_from_lwp (ptid);
      if (GET_PID (ptid) == -1)
    ourstatus->kind = TARGET_WAITKIND_SPURIOUS;

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12203] gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
  2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
                   ` (2 preceding siblings ...)
  2010-11-11 18:28 ` pedro at codesourcery dot com
@ 2012-07-20 17:27 ` cvs-commit at gcc dot gnu.org
  2012-07-20 17:34 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-07-20 17:27 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-07-20 17:27:37 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    palves@sourceware.org    2012-07-20 17:27:29

Modified files:
    gdb            : ChangeLog infrun.c linux-thread-db.c 
    gdb/testsuite  : ChangeLog 
Added files:
    gdb/testsuite/gdb.threads: create-fail.c create-fail.exp 

Log message:
    2012-07-20  Pedro Alves  <palves@redhat.com>

    PR threads/11692
    PR gdb/12203

    gdb/
    * infrun.c (handle_inferior_event) <new thread>: Don't special
    case minus_one_ptid.
    <TARGET_WAITKIND_SPURIOUS>: Ditto.
    * linux-thread-db.c (thread_get_info_callback): Don't return early
    if the thread is zombie.
    (thread_from_lwp): Change return type to void.  Rewrite stale
    comment.
    (attach_thread): Don't return early if the thread is zombie,
    instead set its "dying" flag.
    (thread_db_wait): Don't return TARGET_WAITKIND_SPURIOUS anymore.
    (find_new_threads_callback): Don't return early if the thread is
    zombie.

    gdb/testsuite/
    * gdb.threads/create-fail.c: New file.
    * gdb.threads/create-fail.exp: New file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14504&r2=1.14505
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/infrun.c.diff?cvsroot=src&r1=1.551&r2=1.552
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/linux-thread-db.c.diff?cvsroot=src&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3300&r2=1.3301
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.threads/create-fail.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.threads/create-fail.exp.diff?cvsroot=src&r1=NONE&r2=1.1

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/12203] gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux
  2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
                   ` (3 preceding siblings ...)
  2012-07-20 17:27 ` cvs-commit at gcc dot gnu.org
@ 2012-07-20 17:34 ` palves at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: palves at redhat dot com @ 2012-07-20 17:34 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12203

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |7.6

--- Comment #5 from Pedro Alves <palves at redhat dot com> 2012-07-20 17:34:37 UTC ---
Patch checked in.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-07-20 17:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08 17:45 [Bug gdb/12203] New: gdb internal error "infrun.c:2455" after trying to create realtime thread on Linux Matthias.Gerstner at esolutions dot de
2010-11-09 13:34 ` [Bug gdb/12203] " pedro at codesourcery dot com
2010-11-09 15:12 ` Matthias.Gerstner at esolutions dot de
2010-11-11 18:28 ` pedro at codesourcery dot com
2012-07-20 17:27 ` cvs-commit at gcc dot gnu.org
2012-07-20 17:34 ` palves at redhat dot com

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