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]

[PATCH?] GDB HEAD (partly) broken for GNU/Hurd


Hello again!

On Sat, Oct 11, 2008 at 07:26:11PM +0200, I wrote:
> Unfortunately no luck so far.  wait_for_inferior / handle_inferior_event
> (which was used in the old code) is too complex as to be quickly
> understandable for me.  And I guess I'm estimating correctly that it's
> ``simply'' some side-effect of these that the old code works, while the
> new doesn't?  Perhaps having a look at the logs I appended below some of
> you GDB gurus is able to spot the obvious?

Ha, I, myself, am the GDB guru here ;-)!  I had a look at the log again,
experimented some more, and finally got it going with the following
patch.  However, I have absolutely no idea whether that is correct in all
cases, etc.  Should perhaps target_wait (a.k.a. gnu-nat.c's gnu_wait) be
doing that?


Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.45
diff -u -p -r1.45 fork-child.c
--- fork-child.c	22 Sep 2008 15:16:51 -0000	1.45
+++ fork-child.c	11 Oct 2008 17:34:33 -0000
@@ -427,6 +427,7 @@ startup_inferior (int ntraps)
      have stopped one instruction after execing the shell.  Here we
      must get it up to actual execution of the real program.  */
 
+  /* TODO.  How to keep this synchronized with gnu-nat.c's own counting?  */
   if (exec_wrapper)
     pending_execs++;
 
@@ -439,6 +440,8 @@ startup_inferior (int ntraps)
       memset (&ws, 0, sizeof (ws));
       resume_ptid = target_wait (pid_to_ptid (-1), &ws);
 
+      switch_to_thread (resume_ptid);
+
       /* Mark all threads non-executing.  */
       set_executing (pid_to_ptid (-1), 0);
 


    (gdb) r
    Starting program: /media/data/home/tschwinge/tmp/n1/hurd/ext2fs.static 
    [New Thread 27194.5]
    
    Program received signal SIGSEGV, Segmentation fault.
    convert_options (argp=0x813f0bc, parent=0x0, parent_index=0, group=0x81712e8, cvt=0x101fad0) at argp.h:579
    579     argp.h: No such file or directory.
            in argp.h
    (gdb) bt
    #0  convert_options (argp=0x813f0bc, parent=0x0, parent_index=0, group=0x81712e8, cvt=0x101fad0) at argp.h:579
    #1  0x080b4675 in convert_options (argp=0x101f980, parent=0x0, parent_index=0, group=0x81712e8, cvt=0x101fad0) at argp-parse.c:407
    #2  0x080b4834 in __argp_parse (argp=0x101f980, argc=1, argv=0x101fc14, flags=<value optimized out>, end_index=0x0, input=0x101fb3c) at argp-parse.c:435
    #3  0x08056dad in diskfs_init_main (startup_argp=0x0, argc=1, argv=0x101fc14, store_parsed=0x8153284, bootstrap=0x101fb8c) at ../../hurd.work/libdiskfs/init-main.c:37
    #4  0x0804bd9b in main (argc=1, argv=0x101fc14) at ../../hurd.work/ext2fs/ext2fs.c:172
    (gdb) info threads 
      5 Thread 27194.5  0x080b5a8c in mach_msg_trap ()
    * 4 Thread 27194.4  convert_options (argp=0x813f0bc, parent=0x0, parent_index=0, group=0x81712e8, cvt=0x101fad0) at argp.h:579

As it should be!  :-)


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


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