Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: FYI: put a QUIT in DWARF expression evaluator
Date: Fri, 08 Jul 2011 19:54:00 -0000	[thread overview]
Message-ID: <m37h7soj4v.fsf@fleche.redhat.com> (raw)

I'm checking this in on the trunk.

Today I wondered what would happen if I modified pr10770.c to fail,
causing an infinite loop while evaluating a DWARF expression.  The
answer is that gdb hangs and I had to kill it from the shell.

This patch adds a QUIT to the DWARF evaluator to let the user interrupt
gdb in this event.

I ran the gdb.dwarf2 tests against this on x86-64 F15.

I also tested the new functionality by hand.

FWIW, as far as I know, no such DWARF has ever been found in the wild.

Tom

2011-07-08  Tom Tromey  <tromey@redhat.com>

	* dwarf2expr.c (execute_stack_op): Add QUIT.

Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.66
diff -u -r1.66 dwarf2expr.c
--- dwarf2expr.c	22 Jun 2011 13:38:21 -0000	1.66
+++ dwarf2expr.c	8 Jul 2011 15:47:04 -0000
@@ -521,6 +521,10 @@
       LONGEST offset;
       struct value *result_val = NULL;
 
+      /* The DWARF expression might have a bug causing an infinite
+	 loop.  In that case, quitting is the only way out.  */
+      QUIT;
+
       switch (op)
 	{
 	case DW_OP_lit0:


             reply	other threads:[~2011-07-08 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08 19:54 Tom Tromey [this message]
2011-07-09  6:40 ` Frank Ch. Eigler
2011-07-19 20:26   ` Tom Tromey

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=m37h7soj4v.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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