Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init()
@ 2002-04-20 20:25 Andrew Cagney
  2002-04-22  4:08 ` Richard Earnshaw
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-04-20 20:25 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

The macro NUM_PSEUDO_REGS refers to ``current_gdbarch'' and not 
``gdbarch''.  Hence the equation in the patch was picking up the number 
of pseudo-registers from the previously selected architecture (which may 
not even be ARM), outch!  No wonder macro's are bad :-)

The attached calls gdbarch_num_pseudo_regs() directly with the correct 
architecture.  (It also fixes a core dump that my next patch will cause ...)

Committed as fairly obvious.

Andrew

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

2002-04-20  Andrew Cagney  <ac131313@redhat.com>

	* arm-tdep.c (arm_gdbarch_init): Use gdbarch_num_pseudo_regs
	instead of NUM_PSEUDO_REGS.

Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.48
diff -u -r1.48 arm-tdep.c
--- arm-tdep.c	19 Feb 2002 19:20:31 -0000	1.48
+++ arm-tdep.c	21 Apr 2002 03:15:38 -0000
@@ -3015,7 +3015,8 @@
 
   prologue_cache.saved_regs = (CORE_ADDR *)
     xcalloc (1, (sizeof (CORE_ADDR)
-		 * (gdbarch_num_regs (gdbarch) + NUM_PSEUDO_REGS)));
+		 * (gdbarch_num_regs (gdbarch)
+		    + gdbarch_num_pseudo_regs (gdbarch))));
 
   return gdbarch;
 }

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

* Re: [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init()
  2002-04-20 20:25 [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init() Andrew Cagney
@ 2002-04-22  4:08 ` Richard Earnshaw
  2002-04-22  6:59   ` Andrew Cagney
  2002-04-24 11:23   ` Andrew Cagney
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Earnshaw @ 2002-04-22  4:08 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches, Richard.Earnshaw

> Hello,
> 
> The macro NUM_PSEUDO_REGS refers to ``current_gdbarch'' and not 
> ``gdbarch''.  Hence the equation in the patch was picking up the number 
> of pseudo-registers from the previously selected architecture (which may 
> not even be ARM), outch!  No wonder macro's are bad :-)
> 
> The attached calls gdbarch_num_pseudo_regs() directly with the correct 
> architecture.  (It also fixes a core dump that my next patch will cause ...)
> 
> Committed as fairly obvious.
> 
> Andrew
> 
> 2002-04-20  Andrew Cagney  <ac131313@redhat.com>
> 
> 	* arm-tdep.c (arm_gdbarch_init): Use gdbarch_num_pseudo_regs
> 	instead of NUM_PSEUDO_REGS.

Argh! As you will see from the comment, I'd already fixed a similar 
problem to avoid using SIZEOF_FRAME_SAVED_REGS, but missed that part.  Can 
you update the comment as well?

  /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still
     references the old architecture vector, not the one we are
     building here.  */

R.


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

* Re: [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init()
  2002-04-22  4:08 ` Richard Earnshaw
@ 2002-04-22  6:59   ` Andrew Cagney
  2002-04-24 11:23   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-04-22  6:59 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb-patches

> Hello,
>> 
>> The macro NUM_PSEUDO_REGS refers to ``current_gdbarch'' and not 
>> ``gdbarch''.  Hence the equation in the patch was picking up the number 
>> of pseudo-registers from the previously selected architecture (which may 
>> not even be ARM), outch!  No wonder macro's are bad :-)
>> 
>> The attached calls gdbarch_num_pseudo_regs() directly with the correct 
>> architecture.  (It also fixes a core dump that my next patch will cause ...)
>> 
>> Committed as fairly obvious.
>> 
>> Andrew
>> 
>> 2002-04-20  Andrew Cagney  <ac131313@redhat.com>
>> 
>> * arm-tdep.c (arm_gdbarch_init): Use gdbarch_num_pseudo_regs
>> instead of NUM_PSEUDO_REGS.
> 
> 
> Argh! As you will see from the comment, I'd already fixed a similar 
> problem to avoid using SIZEOF_FRAME_SAVED_REGS, but missed that part.  Can 
> you update the comment as well?

M'kay.

>   /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still
>      references the old architecture vector, not the one we are
>      building here.  */

BTW, once the patch:
http://sources.redhat.com/ml/gdb-patches/2002-04/msg00711.html
goes through the problem should largely ``go away''.

Andrew


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

* Re: [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init()
  2002-04-22  4:08 ` Richard Earnshaw
  2002-04-22  6:59   ` Andrew Cagney
@ 2002-04-24 11:23   ` Andrew Cagney
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-04-24 11:23 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gdb-patches

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


> Argh! As you will see from the comment, I'd already fixed a similar 
> problem to avoid using SIZEOF_FRAME_SAVED_REGS, but missed that part.  Can 
> you update the comment as well?
> 
>   /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still
>      references the old architecture vector, not the one we are
>      building here.  */
> 

(and NUM_REGS). I committed the attached.

Andrew



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

Wed Apr 24 14:22:21 2002  Andrew Cagney  <cagney@redhat.com>
 
 	* arm-tdep.c (arm_gdbarch_init): Add comment that NUM_REGS nor
  	NUM_PSEUDO_REGS can be used.
 
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.52
diff -c -r1.52 arm-tdep.c
*** arm-tdep.c	23 Apr 2002 18:10:06 -0000	1.52
--- arm-tdep.c	24 Apr 2002 18:21:17 -0000
***************
*** 3035,3040 ****
--- 3035,3043 ----
    if (prologue_cache.saved_regs != NULL)
      xfree (prologue_cache.saved_regs);
  
+   /* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still
+      references the old architecture vector, not the one we are
+      building here.  */
    prologue_cache.saved_regs = (CORE_ADDR *)
      xcalloc (1, (sizeof (CORE_ADDR)
  		 * (gdbarch_num_regs (gdbarch)

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

end of thread, other threads:[~2002-04-24 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20 20:25 [patch:arm] Don't use NUM_PSEUDO_REGS in arm_gdbarch_init() Andrew Cagney
2002-04-22  4:08 ` Richard Earnshaw
2002-04-22  6:59   ` Andrew Cagney
2002-04-24 11:23   ` Andrew Cagney

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