Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Remove all current_gdbarch's in mn10300
@ 2008-01-11 16:54 Markus Deuling
  2008-01-14 14:10 ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Deuling @ 2008-01-11 16:54 UTC (permalink / raw)
  To: GDB Patches, Ulrich Weigand

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

Hi,

this patch removes the last occurences of current_gdbarch in mn10300 target. Tested by building mn1030 target.

Ok to commit ?

ChangeLog:

	* mn10300-tdep.h (AM33_MODE): Add gdbarch as parameter.
	* mn10300-tdep.c (set_reg_offsets, mn10300_analyze_prologue): Use
	get_frame_arch to get at the current_architecture. Update AM33_MODE
	call.


Regards,
Markus



-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-mn10300 --]
[-- Type: text/plain, Size: 1795 bytes --]

diff -urpN src/gdb/mn10300-tdep.c dev/gdb/mn10300-tdep.c
--- src/gdb/mn10300-tdep.c	2008-01-11 15:42:53.000000000 +0100
+++ dev/gdb/mn10300-tdep.c	2008-01-11 17:49:02.000000000 +0100
@@ -307,12 +307,14 @@ set_reg_offsets (struct frame_info *fi, 
 		  int stack_extra_size,
 		  int frame_in_fp)
 {
+  struct gdbarch *gdbarch;
   struct trad_frame_cache *cache;
   int offset = 0;
   CORE_ADDR base;
 
   if (fi == NULL || this_cache == NULL)
     return;
+  gdbarch = get_frame_arch (fi);
 
   cache = mn10300_frame_unwind_cache (fi, this_cache);
   if (cache == NULL)
@@ -329,7 +331,7 @@ set_reg_offsets (struct frame_info *fi, 
 
   trad_frame_set_this_base (cache, base);
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (gdbarch)== 2)
     {
       /* If bit N is set in fpregmask, fsN is saved on the stack.
 	 The floating point registers are saved in ascending order.
@@ -385,7 +387,7 @@ set_reg_offsets (struct frame_info *fi, 
       trad_frame_set_reg_addr (cache, E_D2_REGNUM, base + offset);
       offset += 4;
     }
-  if (AM33_MODE)
+  if (AM33_MODE (gdbarch))
     {
       if (movm_args & movm_exother_bit)
         {
@@ -604,7 +606,7 @@ mn10300_analyze_prologue (struct frame_i
 	goto finish_prologue;
     }
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (get_frame_arch (fi))== 2)
     {
       /* Determine if any floating point registers are to be saved.
 	 Look for one of the following three prologue formats:
diff -urpN src/gdb/mn10300-tdep.h dev/gdb/mn10300-tdep.h
--- src/gdb/mn10300-tdep.h	2008-01-01 23:53:12.000000000 +0100
+++ dev/gdb/mn10300-tdep.h	2008-01-11 17:47:42.000000000 +0100
@@ -77,4 +77,4 @@ struct gdbarch_tdep
   int am33_mode;
 };
 
-#define AM33_MODE (gdbarch_tdep (current_gdbarch)->am33_mode)
+#define AM33_MODE(gdbarch) (gdbarch_tdep (gdbarch)->am33_mode)

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

* Re: [patch] Remove all current_gdbarch's in mn10300
  2008-01-11 16:54 [patch] Remove all current_gdbarch's in mn10300 Markus Deuling
@ 2008-01-14 14:10 ` Ulrich Weigand
  2008-01-15  5:07   ` Markus Deuling
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-01-14 14:10 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

> @@ -604,7 +606,7 @@ mn10300_analyze_prologue (struct frame_i

> -  if (AM33_MODE == 2)
> +  if (AM33_MODE (get_frame_arch (fi))== 2)

This is incorrect, as mn10300_analyze_prologue may be called 
with a NULL fi value (from mn10300_skip_prologue).  I guess
the right way would be to allow the caller to pass an explicit
gdbarch ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch] Remove all current_gdbarch's in mn10300
  2008-01-14 14:10 ` Ulrich Weigand
@ 2008-01-15  5:07   ` Markus Deuling
  2008-01-15 20:38     ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Deuling @ 2008-01-15  5:07 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

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

Ulrich Weigand schrieb:
> Markus Deuling wrote:
> 
>> @@ -604,7 +606,7 @@ mn10300_analyze_prologue (struct frame_i
> 
>> -  if (AM33_MODE == 2)
>> +  if (AM33_MODE (get_frame_arch (fi))== 2)
> 
> This is incorrect, as mn10300_analyze_prologue may be called 
> with a NULL fi value (from mn10300_skip_prologue).  I guess
> the right way would be to allow the caller to pass an explicit
> gdbarch ...
> 

Hi Uli,

thank you for review. I attached a new version of the patch. Tested by building mn10300 target
(--enable-targets=all). Ok to commit ?


ChangeLog:

	* mn10300-tdep.h (AM33_MODE): Add gdbarch as parameter.
	* mn10300-tdep.c (set_reg_offsets, mn10300_analyze_prologue): Use
	get_frame_arch to get at the current_architecture. Update AM33_MODE
	call.
	(mn10300_analyze_prologue): Add gdbarch as parameter. Update caller.
	(mn10300_frame_unwind_cache): Use get_frame_arch to get at the current
	architecture.
	(set_reg_offsets, mn10300_analyze_prologue): Fix indentation.



-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-mn10300 --]
[-- Type: text/plain, Size: 4104 bytes --]

diff -urpN src/gdb/mn10300-tdep.c dev/gdb/mn10300-tdep.c
--- src/gdb/mn10300-tdep.c	2008-01-11 15:42:53.000000000 +0100
+++ dev/gdb/mn10300-tdep.c	2008-01-15 06:02:31.000000000 +0100
@@ -307,6 +307,7 @@ set_reg_offsets (struct frame_info *fi, 
 		  int stack_extra_size,
 		  int frame_in_fp)
 {
+  struct gdbarch *gdbarch;
   struct trad_frame_cache *cache;
   int offset = 0;
   CORE_ADDR base;
@@ -317,6 +318,7 @@ set_reg_offsets (struct frame_info *fi, 
   cache = mn10300_frame_unwind_cache (fi, this_cache);
   if (cache == NULL)
     return;
+  gdbarch = get_frame_arch (fi);
 
   if (frame_in_fp)
     {
@@ -324,12 +326,13 @@ set_reg_offsets (struct frame_info *fi, 
     }
   else
     {
-      base = frame_unwind_register_unsigned (fi, E_SP_REGNUM) + stack_extra_size;
+      base = frame_unwind_register_unsigned (fi, E_SP_REGNUM)
+	       + stack_extra_size;
     }
 
   trad_frame_set_this_base (cache, base);
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (gdbarch)== 2)
     {
       /* If bit N is set in fpregmask, fsN is saved on the stack.
 	 The floating point registers are saved in ascending order.
@@ -342,7 +345,8 @@ set_reg_offsets (struct frame_info *fi, 
 	    {
 	      if (fpregmask & (1 << i))
 		{
-		  trad_frame_set_reg_addr (cache, E_FS0_REGNUM + i, base + offset);
+		  trad_frame_set_reg_addr (cache, E_FS0_REGNUM + i,
+					   base + offset);
 		  offset += 4;
 		}
 	    }
@@ -385,7 +389,7 @@ set_reg_offsets (struct frame_info *fi, 
       trad_frame_set_reg_addr (cache, E_D2_REGNUM, base + offset);
       offset += 4;
     }
-  if (AM33_MODE)
+  if (AM33_MODE (gdbarch))
     {
       if (movm_args & movm_exother_bit)
         {
@@ -515,7 +519,7 @@ set_reg_offsets (struct frame_info *fi, 
    frame chain to not bother trying to unwind past this frame.  */
 
 static CORE_ADDR
-mn10300_analyze_prologue (struct frame_info *fi, 
+mn10300_analyze_prologue (struct gdbarch *gdbarch, struct frame_info *fi, 
 			  void **this_cache, 
 			  CORE_ADDR pc)
 {
@@ -604,7 +608,7 @@ mn10300_analyze_prologue (struct frame_i
 	goto finish_prologue;
     }
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (gdbarch)== 2)
     {
       /* Determine if any floating point registers are to be saved.
 	 Look for one of the following three prologue formats:
@@ -818,7 +822,8 @@ mn10300_analyze_prologue (struct frame_i
  finish_prologue:
   /* Note if/where callee saved registers were saved.  */
   if (fi)
-    set_reg_offsets (fi, this_cache, movm_args, fpregmask, stack_extra_size, frame_in_fp);
+    set_reg_offsets (fi, this_cache, movm_args, fpregmask, stack_extra_size,
+		     frame_in_fp);
   return addr;
 }
 
@@ -828,7 +833,7 @@ mn10300_analyze_prologue (struct frame_i
 static CORE_ADDR
 mn10300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  return mn10300_analyze_prologue (NULL, NULL, pc);
+  return mn10300_analyze_prologue (gdbarch, NULL, NULL, pc);
 }
 
 /* Simple frame_unwind_cache.  
@@ -837,6 +842,7 @@ struct trad_frame_cache *
 mn10300_frame_unwind_cache (struct frame_info *next_frame,
 			    void **this_prologue_cache)
 {
+  struct gdbarch *gdbarch;
   struct trad_frame_cache *cache;
   CORE_ADDR pc, start, end;
   void *cache_p;
@@ -844,9 +850,10 @@ mn10300_frame_unwind_cache (struct frame
   if (*this_prologue_cache)
     return (*this_prologue_cache);
 
+  gdbarch = get_frame_arch (next_frame);
   cache_p = trad_frame_cache_zalloc (next_frame);
-  pc = gdbarch_unwind_pc (get_frame_arch (next_frame), next_frame);
-  mn10300_analyze_prologue (next_frame, &cache_p, pc);
+  pc = gdbarch_unwind_pc (gdbarch, next_frame);
+  mn10300_analyze_prologue (gdbarch, next_frame, &cache_p, pc);
   cache = cache_p;
 
   if (find_pc_partial_function (pc, NULL, &start, &end))
diff -urpN src/gdb/mn10300-tdep.h dev/gdb/mn10300-tdep.h
--- src/gdb/mn10300-tdep.h	2008-01-01 23:53:12.000000000 +0100
+++ dev/gdb/mn10300-tdep.h	2008-01-15 05:53:58.000000000 +0100
@@ -77,4 +77,4 @@ struct gdbarch_tdep
   int am33_mode;
 };
 
-#define AM33_MODE (gdbarch_tdep (current_gdbarch)->am33_mode)
+#define AM33_MODE(gdbarch) (gdbarch_tdep (gdbarch)->am33_mode)

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

* Re: [patch] Remove all current_gdbarch's in mn10300
  2008-01-15  5:07   ` Markus Deuling
@ 2008-01-15 20:38     ` Ulrich Weigand
  2008-01-16  4:58       ` Markus Deuling
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-01-15 20:38 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

> 	* mn10300-tdep.h (AM33_MODE): Add gdbarch as parameter.
> 	* mn10300-tdep.c (set_reg_offsets, mn10300_analyze_prologue): Use
> 	get_frame_arch to get at the current_architecture. Update AM33_MODE
> 	call.
> 	(mn10300_analyze_prologue): Add gdbarch as parameter. Update caller.
> 	(mn10300_frame_unwind_cache): Use get_frame_arch to get at the current
> 	architecture.
> 	(set_reg_offsets, mn10300_analyze_prologue): Fix indentation.

This is OK, but please fix this small whitespace issue:

> +  if (AM33_MODE (gdbarch)== 2)

Space between ')' and '=='.

> +  if (AM33_MODE (gdbarch)== 2)

Likewise.


Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch] Remove all current_gdbarch's in mn10300
  2008-01-15 20:38     ` Ulrich Weigand
@ 2008-01-16  4:58       ` Markus Deuling
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Deuling @ 2008-01-16  4:58 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

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

Ulrich Weigand schrieb:
> Markus Deuling wrote:
> 
>> 	* mn10300-tdep.h (AM33_MODE): Add gdbarch as parameter.
>> 	* mn10300-tdep.c (set_reg_offsets, mn10300_analyze_prologue): Use
>> 	get_frame_arch to get at the current_architecture. Update AM33_MODE
>> 	call.
>> 	(mn10300_analyze_prologue): Add gdbarch as parameter. Update caller.
>> 	(mn10300_frame_unwind_cache): Use get_frame_arch to get at the current
>> 	architecture.
>> 	(set_reg_offsets, mn10300_analyze_prologue): Fix indentation.
> 
> This is OK, but please fix this small whitespace issue:
> 
>> +  if (AM33_MODE (gdbarch)== 2)
> 
> Space between ')' and '=='.
> 
>> +  if (AM33_MODE (gdbarch)== 2)
> 
> Likewise.
> 

Hi Uli,

thanks for review. I must have overseen that :-) I now committed this fixed patch attached.

Regards,
Markus


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-mn10300 --]
[-- Type: text/plain, Size: 4106 bytes --]

diff -urpN src/gdb/mn10300-tdep.c dev/gdb/mn10300-tdep.c
--- src/gdb/mn10300-tdep.c	2008-01-11 15:42:53.000000000 +0100
+++ dev/gdb/mn10300-tdep.c	2008-01-15 06:02:31.000000000 +0100
@@ -307,6 +307,7 @@ set_reg_offsets (struct frame_info *fi, 
 		  int stack_extra_size,
 		  int frame_in_fp)
 {
+  struct gdbarch *gdbarch;
   struct trad_frame_cache *cache;
   int offset = 0;
   CORE_ADDR base;
@@ -317,6 +318,7 @@ set_reg_offsets (struct frame_info *fi, 
   cache = mn10300_frame_unwind_cache (fi, this_cache);
   if (cache == NULL)
     return;
+  gdbarch = get_frame_arch (fi);
 
   if (frame_in_fp)
     {
@@ -324,12 +326,13 @@ set_reg_offsets (struct frame_info *fi, 
     }
   else
     {
-      base = frame_unwind_register_unsigned (fi, E_SP_REGNUM) + stack_extra_size;
+      base = frame_unwind_register_unsigned (fi, E_SP_REGNUM)
+	       + stack_extra_size;
     }
 
   trad_frame_set_this_base (cache, base);
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (gdbarch) == 2)
     {
       /* If bit N is set in fpregmask, fsN is saved on the stack.
 	 The floating point registers are saved in ascending order.
@@ -342,7 +345,8 @@ set_reg_offsets (struct frame_info *fi, 
 	    {
 	      if (fpregmask & (1 << i))
 		{
-		  trad_frame_set_reg_addr (cache, E_FS0_REGNUM + i, base + offset);
+		  trad_frame_set_reg_addr (cache, E_FS0_REGNUM + i,
+					   base + offset);
 		  offset += 4;
 		}
 	    }
@@ -385,7 +389,7 @@ set_reg_offsets (struct frame_info *fi, 
       trad_frame_set_reg_addr (cache, E_D2_REGNUM, base + offset);
       offset += 4;
     }
-  if (AM33_MODE)
+  if (AM33_MODE (gdbarch))
     {
       if (movm_args & movm_exother_bit)
         {
@@ -515,7 +519,7 @@ set_reg_offsets (struct frame_info *fi, 
    frame chain to not bother trying to unwind past this frame.  */
 
 static CORE_ADDR
-mn10300_analyze_prologue (struct frame_info *fi, 
+mn10300_analyze_prologue (struct gdbarch *gdbarch, struct frame_info *fi, 
 			  void **this_cache, 
 			  CORE_ADDR pc)
 {
@@ -604,7 +608,7 @@ mn10300_analyze_prologue (struct frame_i
 	goto finish_prologue;
     }
 
-  if (AM33_MODE == 2)
+  if (AM33_MODE (gdbarch) == 2)
     {
       /* Determine if any floating point registers are to be saved.
 	 Look for one of the following three prologue formats:
@@ -818,7 +822,8 @@ mn10300_analyze_prologue (struct frame_i
  finish_prologue:
   /* Note if/where callee saved registers were saved.  */
   if (fi)
-    set_reg_offsets (fi, this_cache, movm_args, fpregmask, stack_extra_size, frame_in_fp);
+    set_reg_offsets (fi, this_cache, movm_args, fpregmask, stack_extra_size,
+		     frame_in_fp);
   return addr;
 }
 
@@ -828,7 +833,7 @@ mn10300_analyze_prologue (struct frame_i
 static CORE_ADDR
 mn10300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  return mn10300_analyze_prologue (NULL, NULL, pc);
+  return mn10300_analyze_prologue (gdbarch, NULL, NULL, pc);
 }
 
 /* Simple frame_unwind_cache.  
@@ -837,6 +842,7 @@ struct trad_frame_cache *
 mn10300_frame_unwind_cache (struct frame_info *next_frame,
 			    void **this_prologue_cache)
 {
+  struct gdbarch *gdbarch;
   struct trad_frame_cache *cache;
   CORE_ADDR pc, start, end;
   void *cache_p;
@@ -844,9 +850,10 @@ mn10300_frame_unwind_cache (struct frame
   if (*this_prologue_cache)
     return (*this_prologue_cache);
 
+  gdbarch = get_frame_arch (next_frame);
   cache_p = trad_frame_cache_zalloc (next_frame);
-  pc = gdbarch_unwind_pc (get_frame_arch (next_frame), next_frame);
-  mn10300_analyze_prologue (next_frame, &cache_p, pc);
+  pc = gdbarch_unwind_pc (gdbarch, next_frame);
+  mn10300_analyze_prologue (gdbarch, next_frame, &cache_p, pc);
   cache = cache_p;
 
   if (find_pc_partial_function (pc, NULL, &start, &end))
diff -urpN src/gdb/mn10300-tdep.h dev/gdb/mn10300-tdep.h
--- src/gdb/mn10300-tdep.h	2008-01-01 23:53:12.000000000 +0100
+++ dev/gdb/mn10300-tdep.h	2008-01-15 05:53:58.000000000 +0100
@@ -77,4 +77,4 @@ struct gdbarch_tdep
   int am33_mode;
 };
 
-#define AM33_MODE (gdbarch_tdep (current_gdbarch)->am33_mode)
+#define AM33_MODE(gdbarch) (gdbarch_tdep (gdbarch)->am33_mode)

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

end of thread, other threads:[~2008-01-16  4:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-11 16:54 [patch] Remove all current_gdbarch's in mn10300 Markus Deuling
2008-01-14 14:10 ` Ulrich Weigand
2008-01-15  5:07   ` Markus Deuling
2008-01-15 20:38     ` Ulrich Weigand
2008-01-16  4:58       ` Markus Deuling

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