Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jason R Thorpe <thorpej@wasabisystems.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH/RFA] Fix busted logic in find_saved_register()
Date: Sat, 20 Apr 2002 14:48:00 -0000	[thread overview]
Message-ID: <20020420144817.W1627@dr-evil.shagadelic.org> (raw)

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

find_saved_register() is used by mips_get_saved_register() and
the alpha_get_saved_register() in my (updated) multi-arch changes
for the Alpha target.

While investigating some testsuite failures, it appeared that
there is no way thjat find_saved_register() could possibly work
on either MIPS or Alpha, since the first thing it does on either
of those platforms is dereference a NULL pointer (said pointer is
initlaized to NULL at the top of the function).

I believe the following patch makes find_saved_register() actually
implement the logic it claims to.  It certainly fixes the problem
I had with GDB dumping core, and fixes the relevant testsuite failures.

OK to commit?

	* frame.c (find_saved_register): Avoid a NULL pointer
	dereference and actually walk the frame list.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

[-- Attachment #2: frame-patch --]
[-- Type: text/plain, Size: 798 bytes --]

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.7
diff -c -r1.7 frame.c
*** frame.c	17 Apr 2002 21:55:12 -0000	1.7
--- frame.c	20 Apr 2002 21:30:25 -0000
***************
*** 83,91 ****
    while (1)
      {
        QUIT;
!       frame1 = get_next_frame (frame1);
!       if (frame1 == 0 || frame1 == frame)
  	break;
        FRAME_INIT_SAVED_REGS (frame1);
        if (frame1->saved_regs[regnum])
  	addr = frame1->saved_regs[regnum];
--- 83,92 ----
    while (1)
      {
        QUIT;
!       frame1 = get_next_frame (frame);
!       if (frame1 == 0)
  	break;
+       frame = frame1;
        FRAME_INIT_SAVED_REGS (frame1);
        if (frame1->saved_regs[regnum])
  	addr = frame1->saved_regs[regnum];

             reply	other threads:[~2002-04-20 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-20 14:48 Jason R Thorpe [this message]
2002-04-20 16:08 ` Andrew Cagney
2002-04-20 16:26   ` Jason R Thorpe
2002-04-20 17:00     ` Andrew Cagney
2002-04-20 18:54       ` Jason R Thorpe
2002-04-20 22:35         ` Andrew Cagney

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=20020420144817.W1627@dr-evil.shagadelic.org \
    --to=thorpej@wasabisystems.com \
    --cc=gdb-patches@sources.redhat.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