Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sources.redhat.com
Subject: [commit] Move zero PC check to frame.c; Was: [RFC] Infinite backtraces...
Date: Sun, 12 Dec 2004 16:36:00 -0000	[thread overview]
Message-ID: <41BC70D0.9070001@gnu.org> (raw)
In-Reply-To: <20041208014443.GG6359@tausq.org>

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

Randolph Chung wrote:
>>I had the same analysis that it should never happen. If Andrew agrees,
>>I would recommend simply putting an assertion instead. Putting a dummy
>>value is not that satisfactory, as you don't know what this is going
>>to be used for.
> 
> 
> i've committed the following
> 
> 2004-12-05  Randolph Chung  <tausq@debian.org>
> 
> 	* hppa-tdep.c (hppa_stub_Frame_unwind_cache): Stop unwinding if 
> 	unwinding from a frame with pc == 0.
> 	(hppa_stub_frame_this_id): Likewise.
> 	(hppa_stub_frame_prev_register): Only provide real values if the frame
> 	cache is not NULL.

FYI,

> Index: hppa-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
> retrieving revision 1.185
> diff -u -p -r1.185 hppa-tdep.c
> --- hppa-tdep.c	6 Dec 2004 03:32:26 -0000	1.185
> +++ hppa-tdep.c	8 Dec 2004 01:41:08 -0000
> @@ -2111,17 +2124,21 @@ hppa_stub_frame_unwind_cache (struct fra
>    struct gdbarch *gdbarch = get_frame_arch (next_frame);
>    struct hppa_stub_unwind_cache *info;
>    struct unwind_table_entry *u;
>  
>    if (*this_cache)
>      return *this_cache;
>  
> +  if (frame_pc_unwind (next_frame) == 0)
> +    return NULL;
> +

I've checked in the attached.  This test is generic so might as well 
live in frame.c (you'll note that I've made the conditions on which it 
triggers more robust).

committed,
Andrew


[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1685 bytes --]

2004-12-12  Andrew Cagney  <cagney@gnu.org>

	* frame.c (get_prev_frame): When unwinding normal frames, check
	that the PC isn't zero.
	* hppa-tdep.c (hppa_stub_frame_unwind_cache): Delete check for a
	zero PC.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.196
diff -p -u -r1.196 frame.c
--- frame.c	8 Dec 2004 01:56:16 -0000	1.196
+++ frame.c	12 Dec 2004 16:23:55 -0000
@@ -1257,6 +1257,18 @@ get_prev_frame (struct frame_info *this_
       return NULL;
     }
 
+  /* Assume that the only way to get a zero PC is through something
+     like a SIGSEGV or a dummy frame, and hence that NORMAL frames
+     will never unwind a zero PC.  */
+  if (this_frame->level > 0
+      && get_frame_type (this_frame) == NORMAL_FRAME
+      && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
+      && get_frame_pc (this_frame) == 0)
+    {
+      frame_debug_got_null_frame (gdb_stdlog, this_frame, "zero PC");
+      return NULL;
+    }
+
   return get_prev_frame_1 (this_frame);
 }
 
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.189
diff -p -u -r1.189 hppa-tdep.c
--- hppa-tdep.c	8 Dec 2004 06:12:40 -0000	1.189
+++ hppa-tdep.c	12 Dec 2004 16:23:57 -0000
@@ -2105,9 +2105,6 @@ hppa_stub_frame_unwind_cache (struct fra
   if (*this_cache)
     return *this_cache;
 
-  if (frame_pc_unwind (next_frame) == 0)
-    return NULL;
-
   info = FRAME_OBSTACK_ZALLOC (struct hppa_stub_unwind_cache);
   *this_cache = info;
   info->saved_regs = trad_frame_alloc_saved_regs (next_frame);

  reply	other threads:[~2004-12-12 16:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 22:46 Joel Brobecker
2004-12-02 23:13 ` Joel Brobecker
2004-12-03  2:43   ` Randolph Chung
2004-12-03  2:57     ` Joel Brobecker
2004-12-03  4:53       ` Randolph Chung
2004-12-03 19:36         ` Joel Brobecker
2004-12-03 18:03           ` Randolph Chung
2004-12-03 18:20             ` Joel Brobecker
2004-12-03 18:22               ` Randolph Chung
2004-12-06  7:25               ` Randolph Chung
2004-12-07 10:07                 ` Joel Brobecker
2004-12-07 16:31                   ` Randolph Chung
2004-12-07 16:37                     ` Joel Brobecker
2004-12-07 16:52                       ` Randolph Chung
2004-12-08  1:51                       ` Randolph Chung
2004-12-12 16:36                         ` Andrew Cagney [this message]
2004-12-03 18:22           ` Joel Brobecker
2004-12-06  4:15           ` Randolph Chung
2004-12-07  9:40             ` Joel Brobecker
2004-12-03 18:28 ` Andrew Cagney
2004-12-03 18:49   ` Joel Brobecker
2004-12-03 19:26     ` Andrew Cagney
2004-12-03 20:19       ` Joel Brobecker
2004-12-03 21:44         ` Andrew Cagney
2004-12-03 22:16           ` Joel Brobecker
2004-12-03 22:23             ` Daniel Jacobowitz
2004-12-03 22:25               ` Joel Brobecker

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=41BC70D0.9070001@gnu.org \
    --to=cagney@gnu.org \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.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