Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/resend/rfa] (1/4) Cleanup static function usage in hppa-tdep.c
@ 2004-04-14  6:24 Randolph Chung
  2004-04-15 16:04 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2004-04-14  6:24 UTC (permalink / raw)
  To: gdb-patches

Resending some patches from last week. I've cleaned them up based on the
feedback and reorganized for easier review (I hope). ok to checkin?

This (and the other 3 patches) were tested against hppa2.0-hp-hpux11.11
and hppa-linux (gcc-3.3 on both targets).

Sumamry:
1/4: simple cleanups of hppa-tdep.c; add use_struct_convention to
     gdbarch.
2/4: Move important bits out of tm-hppa.h into hppa-tdep.h; remove
     unneeded contents.
3/4: DEPRECATED_CLEAN_UP_REGISTER_VALUE is no longer needed, remove.
4/4: Make the frame unwinder work for all hppa elf targets, not just
     64-bit ones.

thanks
randolph

2004-04-13  Randolph Chung  <tausq@debian.org>

	* hppa-tdep.c (hppa_reg_struct_has_addr, hppa_skip_prologue,
	hppa_skip_trampoline_code, hppa_in_solib_call_trampoline,
	hppa_in_solib_return_trampoline, hppa_cannot_store_register,
	hppa_smash_text_address, hppa_target_read_pc, hppa_target_write_pc):
	Remove forward declaration and make static.
	(hppa_reg_struct_has_addr): Rename to hppa_use_struct_convention.
	(hppa_gdbarch_init): Set use_struct_convention.

Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.143
diff -u -p -r1.143 hppa-tdep.c
--- hppa-tdep.c	11 Apr 2004 04:20:51 -0000	1.143
+++ hppa-tdep.c	14 Apr 2004 05:01:21 -0000
@@ -121,17 +123,8 @@ static void internalize_unwinds (struct 
 static void record_text_segment_lowaddr (bfd *, asection *, void *);
 /* FIXME: brobecker 2002-11-07: We will likely be able to make the
    following functions static, once we hppa is partially multiarched.  */
-int hppa_reg_struct_has_addr (int gcc_p, struct type *type);
-CORE_ADDR hppa_skip_prologue (CORE_ADDR pc);
-CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR pc);
-int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name);
-int hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name);
 int hppa_pc_requires_run_before_use (CORE_ADDR pc);
 int hppa_instruction_nullified (void);
-int hppa_cannot_store_register (int regnum);
-CORE_ADDR hppa_smash_text_address (CORE_ADDR addr);
-CORE_ADDR hppa_target_read_pc (ptid_t ptid);
-void hppa_target_write_pc (CORE_ADDR v, ptid_t ptid);
 
 /* Handle 32/64-bit struct return conventions.  */
 
@@ -1024,7 +1001,7 @@ hppa64_frame_align (struct gdbarch *gdba
 /* Get the PC from %r31 if currently in a syscall.  Also mask out privilege
    bits.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_target_read_pc (ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
@@ -1041,7 +1018,7 @@ hppa_target_read_pc (ptid_t ptid)
 /* Write out the PC.  If currently in a syscall, then also write the new
    PC value into %r31.  */
 
-void
+static void
 hppa_target_write_pc (CORE_ADDR v, ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
@@ -1098,7 +1075,7 @@ hppa_alignof (struct type *type)
    Note we return one for *any* call trampoline (long-call, arg-reloc), not
    just shared library trampolines (import, export).  */
 
-int
+static int
 hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name)
 {
   struct minimal_symbol *minsym;
@@ -1259,7 +1236,7 @@ hppa_in_solib_call_trampoline (CORE_ADDR
    Note we return one for *any* call trampoline (long-call, arg-reloc), not
    just shared library trampolines (import, export).  */
 
-int
+static int
 hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name)
 {
   struct unwind_table_entry *u;
@@ -1332,7 +1309,7 @@ hppa_in_solib_return_trampoline (CORE_AD
    calling an argument relocation stub.  It even handles some stubs
    used in dynamic executables.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_skip_trampoline_code (CORE_ADDR pc)
 {
   long orig_pc = pc;
@@ -2014,7 +1991,7 @@ after_prologue (CORE_ADDR pc)
    Currently we must not skip more on the alpha, but we might the lenient
    stuff some day.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_skip_prologue (CORE_ADDR pc)
 {
   unsigned long inst;
@@ -2458,8 +2429,8 @@ hppa_skip_permanent_breakpoint (void)
   /* We can leave the tail's space the same, since there's no jump.  */
 }
 
-int
-hppa_reg_struct_has_addr (int gcc_p, struct type *type)
+static int
+hppa_use_struct_convention (int gcc_p, struct type *type)
 {
   /* On the PA, any pass-by-value structure > 8 bytes is actually passed
      via a pointer regardless of its type or the compiler used.  */
@@ -2533,7 +2504,7 @@ hppa64_register_type (struct gdbarch *gd
 /* Return True if REGNUM is not a register available to the user
    through ptrace().  */
 
-int
+static int
 hppa_cannot_store_register (int regnum)
 {
   return (regnum == 0
@@ -2543,7 +2514,7 @@ hppa_cannot_store_register (int regnum)
 
 }
 
-CORE_ADDR
+static CORE_ADDR
 hppa_smash_text_address (CORE_ADDR addr)
 {
   /* The low two bits of the PC on the PA contain the privilege level.
@@ -2678,6 +2658,8 @@ hppa_gdbarch_init (struct gdbarch_info i
   set_gdbarch_read_pc (gdbarch, hppa_target_read_pc);
   set_gdbarch_write_pc (gdbarch, hppa_target_write_pc);
 
+  set_gdbarch_use_struct_convention (gdbarch, hppa_use_struct_convention);
+
   /* Helper for function argument information.  */
   set_gdbarch_fetch_pointer_argument (gdbarch, hppa_fetch_pointer_argument);
 
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


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

* Re: [patch/resend/rfa] (1/4) Cleanup static function usage in hppa-tdep.c
  2004-04-14  6:24 [patch/resend/rfa] (1/4) Cleanup static function usage in hppa-tdep.c Randolph Chung
@ 2004-04-15 16:04 ` Andrew Cagney
  2004-04-17 16:23   ` Randolph Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2004-04-15 16:04 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches


> 2004-04-13  Randolph Chung  <tausq@debian.org>
> 
> 	* hppa-tdep.c (hppa_reg_struct_has_addr, hppa_skip_prologue,
> 	hppa_skip_trampoline_code, hppa_in_solib_call_trampoline,
> 	hppa_in_solib_return_trampoline, hppa_cannot_store_register,
> 	hppa_smash_text_address, hppa_target_read_pc, hppa_target_write_pc):
> 	Remove forward declaration and make static.
> 	(hppa_reg_struct_has_addr): Rename to hppa_use_struct_convention.
> 	(hppa_gdbarch_init): Set use_struct_convention.
> 
> Index: hppa-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
> retrieving revision 1.143
> diff -u -p -r1.143 hppa-tdep.c
> --- hppa-tdep.c	11 Apr 2004 04:20:51 -0000	1.143
> +++ hppa-tdep.c	14 Apr 2004 05:01:21 -0000
> @@ -121,17 +123,8 @@ static void internalize_unwinds (struct 
>  static void record_text_segment_lowaddr (bfd *, asection *, void *);
>  /* FIXME: brobecker 2002-11-07: We will likely be able to make the
>     following functions static, once we hppa is partially multiarched.  */
> -int hppa_reg_struct_has_addr (int gcc_p, struct type *type);
> -CORE_ADDR hppa_skip_prologue (CORE_ADDR pc);
> -CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR pc);
> -int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name);
> -int hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name);
>  int hppa_pc_requires_run_before_use (CORE_ADDR pc);
>  int hppa_instruction_nullified (void);
> -int hppa_cannot_store_register (int regnum);
> -CORE_ADDR hppa_smash_text_address (CORE_ADDR addr);
> -CORE_ADDR hppa_target_read_pc (ptid_t ptid);
> -void hppa_target_write_pc (CORE_ADDR v, ptid_t ptid);

Yes, definitly, avoid the duplication (these date back to pre ISO-C days).

Just not this:

> -int
> -hppa_reg_struct_has_addr (int gcc_p, struct type *type)
> +static int
> +hppa_use_struct_convention (int gcc_p, struct type *type)

> +  set_gdbarch_use_struct_convention (gdbarch, hppa_use_struct_convention);
> +

use_struct_convention shouldn't be needed -> "struct_return" provides a 
superset of its functionality.  I suspect that the function 
reg_struct_has_addr can instead simply be removed?

Minus use_struct_convention, it's ok to commit,

Andrew




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

* Re: [patch/resend/rfa] (1/4) Cleanup static function usage in hppa-tdep.c
  2004-04-15 16:04 ` Andrew Cagney
@ 2004-04-17 16:23   ` Randolph Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Randolph Chung @ 2004-04-17 16:23 UTC (permalink / raw)
  To: gdb-patches

> Yes, definitly, avoid the duplication (these date back to pre ISO-C days).
[...]
> Minus use_struct_convention, it's ok to commit,

commited with Andrew's comments. -randolph

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.5703
diff -u -p -r1.5703 ChangeLog
--- ChangeLog	17 Apr 2004 04:45:32 -0000	1.5703
+++ ChangeLog	17 Apr 2004 15:33:46 -0000
@@ -1,3 +1,12 @@
+2004-04-17  Randolph Chung  <tausq@debian.org>
+
+	* hppa-tdep.c (hppa_reg_struct_has_addr, hppa_skip_prologue)
+	(hppa_skip_trampoline_code, hppa_in_solib_call_trampoline)
+	(hppa_in_solib_return_trampoline, hppa_cannot_store_register)
+	(hppa_smash_text_address, hppa_target_read_pc, hppa_target_write_pc):
+	Remove forward declaration and make static.
+	(hppa_reg_struct_has_addr): Remove.
+
 2004-04-16  Joel Brobecker  <brobecker@gnat.com>
 
 	* observer.sh: Move comments in sed command to first column.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.143
diff -u -p -r1.143 hppa-tdep.c
--- hppa-tdep.c	11 Apr 2004 04:20:51 -0000	1.143
+++ hppa-tdep.c	17 Apr 2004 15:33:46 -0000
@@ -121,17 +121,8 @@ static void internalize_unwinds (struct 
 static void record_text_segment_lowaddr (bfd *, asection *, void *);
 /* FIXME: brobecker 2002-11-07: We will likely be able to make the
    following functions static, once we hppa is partially multiarched.  */
-int hppa_reg_struct_has_addr (int gcc_p, struct type *type);
-CORE_ADDR hppa_skip_prologue (CORE_ADDR pc);
-CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR pc);
-int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name);
-int hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name);
 int hppa_pc_requires_run_before_use (CORE_ADDR pc);
 int hppa_instruction_nullified (void);
-int hppa_cannot_store_register (int regnum);
-CORE_ADDR hppa_smash_text_address (CORE_ADDR addr);
-CORE_ADDR hppa_target_read_pc (ptid_t ptid);
-void hppa_target_write_pc (CORE_ADDR v, ptid_t ptid);
 
 /* Handle 32/64-bit struct return conventions.  */
 
@@ -1024,7 +1015,7 @@ hppa64_frame_align (struct gdbarch *gdba
 /* Get the PC from %r31 if currently in a syscall.  Also mask out privilege
    bits.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_target_read_pc (ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
@@ -1041,7 +1032,7 @@ hppa_target_read_pc (ptid_t ptid)
 /* Write out the PC.  If currently in a syscall, then also write the new
    PC value into %r31.  */
 
-void
+static void
 hppa_target_write_pc (CORE_ADDR v, ptid_t ptid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, ptid);
@@ -1098,7 +1089,7 @@ hppa_alignof (struct type *type)
    Note we return one for *any* call trampoline (long-call, arg-reloc), not
    just shared library trampolines (import, export).  */
 
-int
+static int
 hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name)
 {
   struct minimal_symbol *minsym;
@@ -1259,7 +1250,7 @@ hppa_in_solib_call_trampoline (CORE_ADDR
    Note we return one for *any* call trampoline (long-call, arg-reloc), not
    just shared library trampolines (import, export).  */
 
-int
+static int
 hppa_in_solib_return_trampoline (CORE_ADDR pc, char *name)
 {
   struct unwind_table_entry *u;
@@ -1332,7 +1323,7 @@ hppa_in_solib_return_trampoline (CORE_AD
    calling an argument relocation stub.  It even handles some stubs
    used in dynamic executables.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_skip_trampoline_code (CORE_ADDR pc)
 {
   long orig_pc = pc;
@@ -2014,7 +2005,7 @@ after_prologue (CORE_ADDR pc)
    Currently we must not skip more on the alpha, but we might the lenient
    stuff some day.  */
 
-CORE_ADDR
+static CORE_ADDR
 hppa_skip_prologue (CORE_ADDR pc)
 {
   unsigned long inst;
@@ -2459,14 +2450,6 @@ hppa_skip_permanent_breakpoint (void)
 }
 
 int
-hppa_reg_struct_has_addr (int gcc_p, struct type *type)
-{
-  /* On the PA, any pass-by-value structure > 8 bytes is actually passed
-     via a pointer regardless of its type or the compiler used.  */
-  return (TYPE_LENGTH (type) > 8);
-}
-
-int
 hppa_pc_requires_run_before_use (CORE_ADDR pc)
 {
   /* Sometimes we may pluck out a minimal symbol that has a negative address.
@@ -2533,7 +2516,7 @@ hppa64_register_type (struct gdbarch *gd
 /* Return True if REGNUM is not a register available to the user
    through ptrace().  */
 
-int
+static int
 hppa_cannot_store_register (int regnum)
 {
   return (regnum == 0
@@ -2543,7 +2526,7 @@ hppa_cannot_store_register (int regnum)
 
 }
 
-CORE_ADDR
+static CORE_ADDR
 hppa_smash_text_address (CORE_ADDR addr)
 {
   /* The low two bits of the PC on the PA contain the privilege level.
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


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

end of thread, other threads:[~2004-04-17 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14  6:24 [patch/resend/rfa] (1/4) Cleanup static function usage in hppa-tdep.c Randolph Chung
2004-04-15 16:04 ` Andrew Cagney
2004-04-17 16:23   ` Randolph Chung

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