Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH/RFA] Fix busted logic in find_saved_register()
@ 2002-04-20 14:48 Jason R Thorpe
  2002-04-20 16:08 ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Jason R Thorpe @ 2002-04-20 14:48 UTC (permalink / raw)
  To: gdb-patches

[-- 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];

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-21  5:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20 14:48 [PATCH/RFA] Fix busted logic in find_saved_register() Jason R Thorpe
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox