From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: bug-gdb@cugnus.com, gdb-patches@cygnus.com Subject: Patch for Hurd gdb bug Date: Sun, 25 Apr 1999 12:40:00 -0000 Message-id: <199904251843.UAA00144@delius.kettenis.nl> X-SW-Source: 1999-04/msg00043.html Hi, The 19990412 snapshot compiles fine for the Hurd. Thanks for integrating my patches! I'll try to track gdb development from now on, on behalf of the Hurd developers. Here is a patch for a nasty bug that makes it impossible to attach to a crashed program. (The Hurd has this nice feature that it is possible to suspend programs that crashed. You can then attach the debugger to investigate why the program crashed. Very useful, especially since we do not have core dumps yet.) The problem is that inf_set_traced() ultimately calls inf_validate_task_sc(), which under certain circumstances calls target_terminal_inferior() to restore the terminal state. However since the terminal state has not yet been saved (this happens after gnu_attach() returns) this results in a segmentation fault. I think calling target_terminal_init() in gnu_attach() is the most effective and noninvasive way to solve the problem. At this point all initializations that target_terminal_init() depends on have been performed and calling target_terminal_init() twice seems to be no problem. Mark 1999-04-25 Mark Kettenis * gnu-nat.c (gnu_attach): Call target_terminal_init before calling inf_set_traced, since that function calls code that might try to restore the terminal settings. --- /home/kettenis/tmp/gdb-19990412/gdb/gnu-nat.c Sat Apr 3 01:11:56 1999 +++ gdb-19990412/gdb/gnu-nat.c Sun Apr 25 15:54:22 1999 @@ -2004,6 +2004,10 @@ attach_flag = 1; push_target (&gnu_ops); + /* We have to initialize the terminal settings now, since the code + below might try to restore them. */ + target_terminal_init (); + inf_update_signal_thread (inf); inf_set_traced (inf, inf->want_signals); >From jimb@cygnus.com Mon Apr 26 09:32:00 1999 From: Jim Blandy To: Mark Kettenis Cc: gdb-patches@cygnus.com, bug-gdb@cugnus.com Subject: Re: Patch for Hurd gdb bug Date: Mon, 26 Apr 1999 09:32:00 -0000 Message-id: References: <199904251843.UAA00144@delius.kettenis.nl> X-SW-Source: 1999-04/msg00044.html Content-length: 725 Mark Kettenis writes: > Here is a patch for a nasty bug that makes it impossible to attach to > a crashed program. (The Hurd has this nice feature that it is possible > to suspend programs that crashed. You can then attach the debugger to > investigate why the program crashed. Very useful, especially since we > do not have core dumps yet.) Thanks for the fix! It should be in future snapshots (although it will not be in 4.18.1). 1999-04-26 Jim Blandy 1999-04-25 Mark Kettenis * gnu-nat.c (gnu_attach): Call target_terminal_init before calling inf_set_traced, since that function calls code that might try to restore the terminal settings. >From assign@gnu.org Thu Apr 01 00:00:00 1999 From: assignments To: gdb-patches@cygnus.com Subject: GDB Date: Thu, 01 Apr 1999 00:00:00 -0000 Message-id: <199902121721.MAA17106@delysid.gnu.org> X-SW-Source: 1999-q1/msg00039.html Content-length: 606 The following disclaimers and/or assignments concerning GDB have recently been added to the file copyright.list here at the Free Software Foundation. If you have any questions or corrections, please send them to my general work address, 3diff@gnu.org. Thanks! Brian Youmans Assignments Clerk GDB BFD MMALLOC OPCODES Apple Computer, Inc. 1999-01-22 Assigns past and future changes. GDB Robert Hohne Germany 1968 1999-01-26 Assigns past and future changes. robert.hoehne@gmx.net From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: bug-gdb@cugnus.com, gdb-patches@cygnus.com Subject: Patch for Hurd gdb bug Date: Sun, 25 Apr 1999 11:42:00 -0000 Message-ID: <199904251843.UAA00144@delius.kettenis.nl> X-SW-Source: 1999-q2/msg00043.html Message-ID: <19990425114200.plxiJp3G58Zh66uV0_x1chC94i6hAqvGVWHTv7NOcKk@z> Hi, The 19990412 snapshot compiles fine for the Hurd. Thanks for integrating my patches! I'll try to track gdb development from now on, on behalf of the Hurd developers. Here is a patch for a nasty bug that makes it impossible to attach to a crashed program. (The Hurd has this nice feature that it is possible to suspend programs that crashed. You can then attach the debugger to investigate why the program crashed. Very useful, especially since we do not have core dumps yet.) The problem is that inf_set_traced() ultimately calls inf_validate_task_sc(), which under certain circumstances calls target_terminal_inferior() to restore the terminal state. However since the terminal state has not yet been saved (this happens after gnu_attach() returns) this results in a segmentation fault. I think calling target_terminal_init() in gnu_attach() is the most effective and noninvasive way to solve the problem. At this point all initializations that target_terminal_init() depends on have been performed and calling target_terminal_init() twice seems to be no problem. Mark 1999-04-25 Mark Kettenis * gnu-nat.c (gnu_attach): Call target_terminal_init before calling inf_set_traced, since that function calls code that might try to restore the terminal settings. --- /home/kettenis/tmp/gdb-19990412/gdb/gnu-nat.c Sat Apr 3 01:11:56 1999 +++ gdb-19990412/gdb/gnu-nat.c Sun Apr 25 15:54:22 1999 @@ -2004,6 +2004,10 @@ attach_flag = 1; push_target (&gnu_ops); + /* We have to initialize the terminal settings now, since the code + below might try to restore them. */ + target_terminal_init (); + inf_update_signal_thread (inf); inf_set_traced (inf, inf->want_signals);