Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@wins.uva.nl>
To: bug-gdb@cugnus.com, gdb-patches@cygnus.com
Subject: Patch for Hurd gdb bug
Date: Sun, 25 Apr 1999 11:42:00 -0000	[thread overview]
Message-ID: <199904251843.UAA00144@delius.kettenis.nl> (raw)
Message-ID: <19990425114200.plxiJp3G58Zh66uV0_x1chC94i6hAqvGVWHTv7NOcKk@z> (raw)

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  <kettenis@gnu.org>

	* 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);
 


             reply	other threads:[~1999-04-25 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-25 12:40 Mark Kettenis [this message]
1999-04-25 11:42 ` Mark Kettenis
1999-04-26  8:22 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199904251843.UAA00144@delius.kettenis.nl \
    --to=kettenis@wins.uva.nl \
    --cc=bug-gdb@cugnus.com \
    --cc=gdb-patches@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox