This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Trouble with gdb 6.8 on Irix, part 2


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

Attachment: bt_full.txt
Description: Text document

--- gdb/signals/signals.c.orig  Mon Jul  7 16:53:17 2008
+++ gdb/signals/signals.c       Mon Jul  7 17:24:04 2008
@@ -229,13 +229,18 @@
 char *
 target_signal_to_name (enum target_signal sig)
 {
+  static char signo_str[10];
+
   if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST
       && signals[sig].name != NULL)
     return signals[sig].name;
   else
+  {
     /* I think the code which prints this will always print it along
        with the string, so no need to be verbose (very old comment).  */
-    return "?";
+    snprintf(signo_str, 10, "%d", sig);
+    return signo_str;
+  }
 }
 
 /* Given a name, return its signal.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]