Bad File Descriptor

Help
crjjrc
2008-02-14
2013-06-13
  • crjjrc

    crjjrc - 2008-02-14

    Hi. I'm trying to run gldb-gui (or gldb) on a program and I get an error on a select statement.  I invoke gldb like so:

       $ gldb ./myprog
       (gldb) run
       Running.
       select: Bad file descriptor
       Program exited normally.

    When I run "strace gldb ./myprog," the lines right before the error are these:

    time(NULL)                              = 1203011128
    pipe([7, 8])                            = 0
    pipe([9, 10])                           = 0
    clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7fce708) = 22352
    close(8)                                = 0
    close(9)                                = 0
    write(10, "\334\272\0\4", 4)            = 4
    write(10, "\0\0\0\0", 4)                = 4
    write(10, "\0\0\0\1", 4)                = 4
    write(10, "\334\272\0\0", 4)            = 4
    write(10, "\0\0\0\0", 4)                = 4
    rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    select(8, [3 5 7], NULL, NULL, NULL)    = 1 (in [7])
    rt_sigprocmask(SIG_SETMASK, [INT CHLD], NULL, 8) = 0
    waitpid(22352, 0xbfc7d090, WNOHANG)     = 0
    read(7, "\253\315\0\0", 4)              = 4
    read(7, "\0\0\0\0", 4)                  = 4
    read(7, "\0\0\0\0", 4)                  = 4
    rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    select(8, [3 5 7], NULL, NULL, NULL)    = 1 (in [7])
    rt_sigprocmask(SIG_SETMASK, [INT CHLD], NULL, 8) = 0
    waitpid(22352, 0xbfc7d090, WNOHANG)     = 0
    read(7, "\253\315\0\6", 4)              = 4
    read(7, "\0\0\0\0", 4)                  = 4
    write(1, "Running.\n", 9)               = 9
    Running.
    rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
    select(8, [3 5 7], NULL, NULL, NULL)    = 1 (in [7])
    select: Bad file descriptor
    --- SIGCHLD (Child exited) @ 0 (0) ---

      So, it starts running but bails almost immediately on the select statement, which I presume is gldb.c:361 in 20080123.  I only experience this with one OpenGL application so far; others work fine.  I don't know how to account for this difference, nor do I know what the file descriptors are here exactly.  One of 3, 5, and 7 must be bad.

      I'd love to help fix this somehow.  Please let me know how I might provide more info.  Thanks!

    - Chris

     
    • Bruce Merry

      Bruce Merry - 2008-02-14

      That's most curious, particularly since the strace suggests that the select() call returned 1, which is a success. I'd really need to have sample code to debug with. Sorry I can't shed more light on this.

       
    • crjjrc

      crjjrc - 2008-02-14

      The problem that I hoped to track down with gldb-gui apparently ended up being the source of this problem too.  The OpenGL program that was failing uses wxWidgets, which I recently upgraded to v2.9.  A texture that I generated in a window's constructor was not being created correctly, apparently because the latest version of wxWidgets orders operations differently.  (The GL context wasn't valid when the texture was created, I guess.)  So, I moved the texture creation elsewhere, where the context is valid, and the select error goes away.

      Sorry to waste your time!  Thanks for a great tool!

      - Chris

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks