Trouble with gdb 6.8 on Irix, part 2

Dimitrios Apostolou jimis@gmx.net
Mon Jul 7 22:35:00 GMT 2008


I am trying to debug the hanging problem I mentioned earlier. I found a
*very* interesting e-mail at:
http://www.sourceware.org/ml/gdb/1999-q1/msg00064.html

I have exactly the same symptoms, so you should probably read it to
understand what's going on, the author of that e-mail seems to know more
than me. What's happening is that even a hello world program, if linked
to pthread, will cause gdb to print "warning: Signal ? does not exist on
this system." and hang. Gdb 6.3 was printing the same message but exited
to prompt. 6.8 will hang there and top shows the hello program (not gdb)
taking up 100% CPU resources! C-c won't do anything.

So I tried to run gdb within gdb:


$ gcc hello.c -o hello-pthread -lpthread
ld32: WARNING 84: /usr/lib32/libpthread.so is not used for resolving any symbol.

$ gdb -q --args gdb -q hello-pthread
(gdb) set prompt gdb-top:
gdb-top: run
Starting program: /usr/people/jimis/dist/bin/gdb -q hello-pthread
(gdb) run
Starting program: /usr/people/jimis/tmp/c-hello/hello-pthread
warning: Signal ? does not exist on this system.


Program received signal SIGINT, Interrupt.
0x0fa44168 in __ioctl () at ioctl.s:20
20      ioctl.s: No such file or directory.
        in ioctl.s
Current language:  auto; currently asm

gdb-top: bt
#0  0x0fa44168 in __ioctl () at ioctl.s:20
#1  0x0fa442a4 in _ioctl () at /xlv41/6.5.30m/work/irix/lib/libc/libc_n32_M4/sys/ioctlSCI.c:28
#2  0x101a1260 in proc_wait_for_stop (pi=0x103fa548) at .././gdb/procfs.c:1693
#3  0x101a58c4 in procfs_wait (ptid={pid = -1, lwp = 0, tid = 0}, status=0x7fff2760) at .././gdb/procfs.c:4009
#4  0x100f0d6c in wait_for_inferior (treat_exec_as_sigtrap=0) at infrun.c:1032
#5  0x101bdda0 in irix_solib_create_inferior_hook () at solib-irix.c:441
#6  0x100f56c0 in post_create_inferior (target=0x103aa488, from_tty=0) at infcmd.c:435
#7  0x100f5a74 in run_command_1 (args=0x0, from_tty=1, tbreak_at_main=272531560) at infcmd.c:560
#8  0x10058b0c in execute_command (p=0x103abb33 "", from_tty=1) at top.c:449
#9  0x10061cb8 in command_handler (command=0x103abb30 "") at event-top.c:518
#10 0x100622f8 in command_line_handler (rl=0x103a9a2c "") at event-top.c:810
#11 0x10203ab0 in rl_callback_read_char () at callback.c:205
#12 0x100611dc in rl_callback_read_char_wrapper (client_data=0x6) at event-top.c:177
#13 0x100631cc in process_event () at event-loop.c:341
#14 0x10063e04 in gdb_do_one_event (data=0x6) at event-loop.c:378
#15 0x100de9f0 in catch_errors (func=0x10063cf8 <gdb_do_one_event>, func_args=0x0, errstring=0x1030bd30 "", mask=0) at exceptions.c:513
#16 0x1014c7e0 in tui_command_loop (data=0x6) at .././gdb/tui/tui-interp.c:153
#17 0x10045a94 in captured_command_loop (data=0x6) at .././gdb/main.c:99
#18 0x100de9f0 in catch_errors (func=0x10045a70 <captured_command_loop>, func_args=0x0, errstring=0x102bc7c0 "", mask=0)
    at exceptions.c:513
#19 0x10046224 in captured_main (data=0x6) at .././gdb/main.c:882
#20 0x100de9f0 in catch_errors (func=0x10045ad8 <captured_main>, func_args=0x7fff2f10, errstring=0x102bc7c0 "", mask=0)
    at exceptions.c:513
#21 0x10046b4c in gdb_main (args=0x7103) at .././gdb/main.c:891
#22 0x10045a5c in main (argc=6, argv=0x7103) at gdb.c:33

gdb-top: list
1688        win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
1689        /* We been runnin' and we stopped -- need to update status.  */
1690        pi->status_valid = 0;
1691      }
1692    #else   /* ioctl method */
1693      win = (ioctl (pi->ctl_fd, PIOCWSTOP, &pi->prstatus) >= 0);
1694      /* Above call also refreshes the prstatus.  */
1695      if (win)
1696        {
1697          pi->status_valid = 1;


And even if the gdb process is stopped, the hello-pthread program still
eats up 100% CPU. You can find the full backtrace attached. 

As for the "Signal ?" string, may I propose it gets replaced by
something better? Please see the attached patch. After applying it the
message I am getting is: 

warning: Signal 143 does not exist on this system.

However I can't find this signal documented anywhere for Irix. So what
do you think?


Thanks in advance, 
Dimitris


P.S. Please CC me because I'm not subscribed to the list

-------------- next part --------------
gdb-top: bt-full
#0  0x0fa44168 in __ioctl () at ioctl.s:20
No locals.
#1  0x0fa442a4 in _ioctl () at /xlv41/6.5.30m/work/irix/lib/libc/libc_n32_M4/sys/ioctlSCI.c:28
No locals.
#2  0x101a1260 in proc_wait_for_stop (pi=0x103fa548) at .././gdb/procfs.c:1693
        win = 0
#3  0x101a58c4 in procfs_wait (ptid={pid = -1, lwp = 0, tid = 0}, status=0x7fff2760) at .././gdb/procfs.c:4009
        pi = (procinfo *) 0x103fa548
        wstat = 0
        temp_tid = -1
        retval = {pid = -1, lwp = 0, tid = 0}
        temp_ptid = {pid = 0, lwp = 0, tid = 0}
        why = 272276104
        what = 0
        flags = -1
        retry = 1
#4  0x100f0d6c in wait_for_inferior (treat_exec_as_sigtrap=0) at infrun.c:1032
        old_cleanups = (struct cleanup *) 0x103e6160
        ecss = {ws = {kind = TARGET_WAITKIND_EXITED, value = {integer = 270148256, sig = 270148256, related_pid = 270148256, 
      execd_pathname = 0x101a22a0 "", syscall_id = 270148256}}, wp = 0x7fff2760, stepping_over_breakpoint = 0, random_signal = 0, 
  stop_func_start = 0, stop_func_end = 0, stop_func_name = 0x0, sal = {symtab = 0x0, section = 0x0, line = 0, pc = 0, end = 0, 
    explicit_pc = 0, explicit_line = 0}, current_line = 0, current_symtab = 0x0, handling_longjmp = 0, ptid = {pid = 0, lwp = 0, 
    tid = 272606536}, saved_inferior_ptid = {pid = 0, lwp = 270139392, tid = 0}, step_after_step_resume_breakpoint = 0, 
  stepping_through_solib_after_catch = 0, stepping_through_solib_catchpoints = 0x0, new_thread_event = 0, tmpstatus = {
    kind = TARGET_WAITKIND_EXITED, value = {integer = 0, sig = TARGET_SIGNAL_0, related_pid = 0, execd_pathname = 0x0, syscall_id = 0}}, 
  infwait_state = infwait_normal_state, waiton_ptid = {pid = -1, lwp = 0, tid = 0}, wait_some_more = 0}
        ecs = (struct execution_control_state *) 0x7fff2760
#5  0x101bdda0 in irix_solib_create_inferior_hook () at solib-irix.c:441
No locals.
#6  0x100f56c0 in post_create_inferior (target=0x103aa488, from_tty=0) at infcmd.c:435
No locals.
#7  0x100f5a74 in run_command_1 (args=0x0, from_tty=1, tbreak_at_main=272531560) at infcmd.c:560
        exec_file = 0x103e3bf8 "/usr/people/jimis/tmp/c-hello/hello-pthread"
#8  0x10058b0c in execute_command (p=0x103abb33 "", from_tty=1) at top.c:449
        arg = 0x0
        c = (struct cmd_list_element *) 0x103cf638
        flang = language_fortran
        warned = 0
        line = 0x103abb30 ""
#9  0x10061cb8 in command_handler (command=0x103abb30 "") at event-top.c:518
        old_chain = (struct cleanup *) 0x0
        time_at_cmd_start = 207922
        space_at_cmd_start = 0
#10 0x100622f8 in command_line_handler (rl=0x103a9a2c "") at event-top.c:810
        linebuffer = 0x103ec378 "run"
        linelength = 80
        p = 0x103a9940 "\020:???0"
        p1 = 0x10368120 ""
        nline = 0x4 <Address 0x4 out of bounds>
        repeat = 1
#11 0x10203ab0 in rl_callback_read_char () at callback.c:205
        line = 0x103e8048 "run"
        eof = 272531528
        olevel = {64424509440, 0, 0, 9223090561878097920, 2159093248, 0, 1, 0, 272236544, 272281920, 1, 270546612, 0, 272196304, 1, 
  272523416, 263517716, 4, 227, 19421773393035264, 32, 0, 272256684, 2097152, 272255276, 272181968, 272181968, 268841024, 268828672, 12, 
  270415648, 0, 18446744071629211443, 272196304, 2147428832, 268841160, 270454396, 1, 0, 1024, 270454396, 18446744071629211443, 
  4625196817309499392, 0, 4607182418800017408, 0 <repeats 29 times>, 72057596201026560, 0, 1, 16384, 18446744073709538470, 0, 
  18446744073709538456, 0, 0, 18446744071577681920, 16, 0, 18446744073709551615, 87, 18446744071562962776, 18446744071562772800, 
  18446744071562962900, 18446744071566000128, 4295173635, 200, 2500, 12884967424, 65537, 0, 1, 18446744071573678080, 0 <repeats 28 times>}
#12 0x100611dc in rl_callback_read_char_wrapper (client_data=0x6) at event-top.c:177
No locals.
#13 0x100631cc in process_event () at event-loop.c:341
        event_ptr = (gdb_event *) 0x6
        proc = (event_handler_func *) 0x100639c0 <handle_file_event>
        fd = 0
#14 0x10063e04 in gdb_do_one_event (data=0x6) at event-loop.c:378
No locals.
#15 0x100de9f0 in catch_errors (func=0x10063cf8 <gdb_do_one_event>, func_args=0x0, errstring=0x1030bd30 "", mask=0) at exceptions.c:513
        val = 0
        exception = {reason = 0, error = GDB_NO_ERROR, message = 0x0}
#16 0x1014c7e0 in tui_command_loop (data=0x6) at .././gdb/tui/tui-interp.c:153
        result = 160
#17 0x10045a94 in captured_command_loop (data=0x6) at .././gdb/main.c:99
No locals.
#18 0x100de9f0 in catch_errors (func=0x10045a70 <captured_command_loop>, func_args=0x0, errstring=0x102bc7c0 "", mask=0)
    at exceptions.c:513
        val = 0
        exception = {reason = 0, error = GDB_NO_ERROR, message = 0x0}
#19 0x10046224 in captured_main (data=0x6) at .././gdb/main.c:882
        context = (struct captured_main_args *) 0x7fff36a6
        argc = 272275784
        argv = (char **) 0x103a995c
        quiet = 1
        batch = 0
        set_args = 0
        symarg = 0x7fff3022 "hello-pthread"
        execarg = 0x7fff3022 "hello-pthread"
        pidarg = 0x0
        corearg = 0x0
        pid_or_core_arg = 0x0
        cdarg = 0x0
        ttyarg = 0x0
        print_help = 0
        print_version = 0
        cmdarg = (struct cmdarg *) 0x103abac0
        cmdsize = 1
        ncmd = 0
        dirarg = (char **) 0x103abad0
        dirsize = 1
        ndir = 0
        homebuf = {st_dev = 0, st_pad1 = {0, 0, 0}, st_ino = 0, st_mode = 0, st_nlink = 0, st_uid = 0, st_gid = 0, st_rdev = 0, 
  st_pad2 = {0, 0}, st_size = 0, st_pad3 = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {
    tv_sec = 0, tv_nsec = 0}, st_blksize = 0, st_blocks = 0, st_fstype = '\0' <repeats 15 times>, st_projid = 0, st_pad4 = {0, 0, 0, 0, 
    0, 0, 0}}
        cwdbuf = {st_dev = 0, st_pad1 = {0, 0, 0}, st_ino = 0, st_mode = 0, st_nlink = 0, st_uid = 0, st_gid = 0, st_rdev = 0, st_pad2 = {
    0, 0}, st_size = 0, st_pad3 = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, 
    tv_nsec = 0}, st_blksize = 0, st_blocks = 0, st_fstype = '\0' <repeats 15 times>, st_projid = 0, st_pad4 = {0, 0, 0, 0, 0, 0, 0}}
        homedir = 0x7fff36a6 "/usr/people/jimis"
        i = 0
        time_at_startup = 74243
#20 0x100de9f0 in catch_errors (func=0x10045ad8 <captured_main>, func_args=0x7fff2f10, errstring=0x102bc7c0 "", mask=0)
    at exceptions.c:513
        val = 0
        exception = {reason = 0, error = GDB_NO_ERROR, message = 0x0}
#21 0x10046b4c in gdb_main (args=0x7103) at .././gdb/main.c:891
No locals.
#22 0x10045a5c in main (argc=6, argv=0x7103) at gdb.c:33
        args = {argc = 3, argv = 0x7fff2f44, use_windows = 0, interpreter_p = 0x102bc370 "console"}
gdb-top: frame 2
#2  0x101a1260 in proc_wait_for_stop (pi=0x103fa548) at .././gdb/procfs.c:1693
1693      win = (ioctl (pi->ctl_fd, PIOCWSTOP, &pi->prstatus) >= 0);
Current language:  auto; currently c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb_signals.c.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20080707/937abfdd/attachment.bin>


More information about the Gdb mailing list