Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] mips-tdep.c: local defines, static functions
@ 2002-08-20 17:55 Michael Snyder
  2002-08-20 18:29 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2002-08-20 17:55 UTC (permalink / raw)
  To: gdb-patches; +Cc: cagney


I'll check this in as soon as I make sure gdb still builds.

2002-08-20  Michael Snyder  <msnyder@redhat.com>

	* mips-tdep.c (MSYMBOL_IS_SPECIAL, MSYMBOL_SIZE): These are only
	used locally, so move them from the target machine header to here.
	(mips_set_processor_type, mips_register_name, mips32_next_pc, 
	mips16_next_pc, cached_proc_desc, mips_set_processor_type): 
	Make static.
	* config/mips/tm-mips.h (MSYMBOL_IS_SPECIAL, MSYMBOL_SIZE): Delete.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.115
diff -p -r1.115 mips-tdep.c
*** mips-tdep.c	20 Aug 2002 23:07:42 -0000	1.115
--- mips-tdep.c	21 Aug 2002 00:50:40 -0000
*************** mips_saved_regsize (void)
*** 173,178 ****
--- 173,208 ----
      return 4;
  }
  
+ /* Macros for setting and testing a bit in a minimal symbol that
+    marks it as 16-bit function.  The MSB of the minimal symbol's
+    "info" field is used for this purpose. This field is already
+    being used to store the symbol size, so the assumption is
+    that the symbol size cannot exceed 2^31.
+ 
+    ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
+    i.e. refers to a 16-bit function, and sets a "special" bit in a
+    minimal symbol to mark it as a 16-bit function
+ 
+    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
+    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
+    the "info" field with the "special" bit masked out */
+ 
+ #define MSYMBOL_IS_SPECIAL(msym) \
+   (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
+ #define MSYMBOL_SIZE(msym) \
+   ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
+ 
+ static void
+ mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
+ {
+   if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_MIPS16) 
+     { 
+       MSYMBOL_INFO (msym) = (char *) 
+ 	(((long) MSYMBOL_INFO (msym)) | 0x80000000); 
+       SYMBOL_VALUE_ADDRESS (msym) |= 1; 
+     } 
+ }
+ 
  /* XFER a value from the big/little/left end of the register.
     Depending on the size of the value it might occupy the entire
     register or just part of it.  Make an allowance for this, aligning
*************** static CORE_ADDR heuristic_proc_start (C
*** 297,303 ****
  
  static CORE_ADDR read_next_frame_reg (struct frame_info *, int);
  
! int mips_set_processor_type (char *);
  
  static void mips_show_processor_type_command (char *, int);
  
--- 327,333 ----
  
  static CORE_ADDR read_next_frame_reg (struct frame_info *, int);
  
! static int mips_set_processor_type (char *);
  
  static void mips_show_processor_type_command (char *, int);
  
*************** static struct cmd_list_element *showmips
*** 333,339 ****
  char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
  char **mips_processor_reg_names = mips_generic_reg_names;
  
! const char *
  mips_register_name (int i)
  {
    return mips_processor_reg_names[i];
--- 363,369 ----
  char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
  char **mips_processor_reg_names = mips_generic_reg_names;
  
! static const char *
  mips_register_name (int i)
  {
    return mips_processor_reg_names[i];
*************** pc_is_mips16 (bfd_vma memaddr)
*** 720,757 ****
      return 0;
  }
  
- /* ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
-    i.e. refers to a 16-bit function, and sets a "special" bit in a
-    minimal symbol to mark it as a 16-bit function.  */
- 
- static void
- mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
- {
-   if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_MIPS16) 
-     { 
-       MSYMBOL_INFO (msym) = (char *) 
- 	(((long) MSYMBOL_INFO (msym)) | 0x80000000); 
-       SYMBOL_VALUE_ADDRESS (msym) |= 1; 
-     } 
- }
- 
- /* MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol.  */
- 
- int
- mips_msymbol_is_special (struct minimal_symbol *msym) 
- {
-   return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0); 
- }
- 
- /* MSYMBOL_SIZE returns the size of the minimal symbol, i.e.  the
-    "info" field with the "special" bit masked out.  */
- 
- long
- mips_msymbol_size (struct minimal_symbol *msym)
- {
-   return ((long) MSYMBOL_INFO (msym) & 0x7fffffff);
- }
- 
  /* MIPS believes that the PC has a sign extended value.  Perhaphs the
     all registers should be sign extended for simplicity? */
  
--- 750,755 ----
*************** mips32_relative_offset (unsigned long in
*** 915,921 ****
  
  /* Determine whate to set a single step breakpoint while considering
     branch prediction */
! CORE_ADDR
  mips32_next_pc (CORE_ADDR pc)
  {
    unsigned long inst;
--- 913,919 ----
  
  /* Determine whate to set a single step breakpoint while considering
     branch prediction */
! static CORE_ADDR
  mips32_next_pc (CORE_ADDR pc)
  {
    unsigned long inst;
*************** extended_mips16_next_pc (CORE_ADDR pc,
*** 1354,1360 ****
    return pc;
  }
  
! CORE_ADDR
  mips16_next_pc (CORE_ADDR pc)
  {
    unsigned int insn = fetch_mips_16 (pc);
--- 1352,1358 ----
    return pc;
  }
  
! static CORE_ADDR
  mips16_next_pc (CORE_ADDR pc)
  {
    unsigned int insn = fetch_mips_16 (pc);
*************** mips_init_frame_pc_first (int fromleaf, 
*** 1676,1682 ****
  
    pc = ((fromleaf) ? SAVED_PC_AFTER_CALL (prev->next) :
  	prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
!   tmp = mips_skip_stub (pc);
    prev->pc = tmp ? tmp : pc;
  }
  
--- 1674,1680 ----
  
    pc = ((fromleaf) ? SAVED_PC_AFTER_CALL (prev->next) :
  	prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
!   tmp = SKIP_TRAMPOLINE_CODE (pc);
    prev->pc = tmp ? tmp : pc;
  }
  
*************** get_frame_pointer (struct frame_info *fr
*** 2391,2397 ****
  			   PROC_FRAME_ADJUST (proc_desc));
  }
  
! mips_extra_func_info_t cached_proc_desc;
  
  static CORE_ADDR
  mips_frame_chain (struct frame_info *frame)
--- 2389,2395 ----
  			   PROC_FRAME_ADJUST (proc_desc));
  }
  
! static mips_extra_func_info_t cached_proc_desc;
  
  static CORE_ADDR
  mips_frame_chain (struct frame_info *frame)
*************** mips_frame_chain (struct frame_info *fra
*** 2405,2411 ****
  
    /* Check if the PC is inside a call stub.  If it is, fetch the
       PC of the caller of that stub.  */
!   if ((tmp = mips_skip_stub (saved_pc)) != 0)
      saved_pc = tmp;
  
    /* Look up the procedure descriptor for this PC.  */
--- 2403,2409 ----
  
    /* Check if the PC is inside a call stub.  If it is, fetch the
       PC of the caller of that stub.  */
!   if ((tmp = SKIP_TRAMPOLINE_CODE (saved_pc)) != 0)
      saved_pc = tmp;
  
    /* Look up the procedure descriptor for this PC.  */
*************** mips_show_processor_type_command (char *
*** 5035,5041 ****
  
  /* Modify the actual processor type. */
  
! int
  mips_set_processor_type (char *str)
  {
    int i;
--- 5033,5039 ----
  
  /* Modify the actual processor type. */
  
! static int
  mips_set_processor_type (char *str)
  {
    int i;
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.41
diff -p -r1.41 tm-mips.h
*** config/mips/tm-mips.h	20 Aug 2002 23:07:43 -0000	1.41
--- config/mips/tm-mips.h	21 Aug 2002 00:50:40 -0000
*************** extern struct frame_info *setup_arbitrar
*** 209,215 ****
  
  #define TM_PRINT_INSN_MACH 0
  
- 
  /* These are defined in mdebugread.c and are used in mips-tdep.c  */
  extern CORE_ADDR sigtramp_address, sigtramp_end;
  extern void fixup_sigtramp (void);
--- 209,214 ----
*************** typedef unsigned long t_inst;	/* Integer
*** 239,271 ****
  
  #endif /* TM_MIPS_H */
  
- /* Macros for setting and testing a bit in a minimal symbol that
-    marks it as 16-bit function.  The MSB of the minimal symbol's
-    "info" field is used for this purpose. This field is already
-    being used to store the symbol size, so the assumption is
-    that the symbol size cannot exceed 2^31.
- 
-    ELF_MAKE_MSYMBOL_SPECIAL
-    tests whether an ELF symbol is "special", i.e. refers
-    to a 16-bit function, and sets a "special" bit in a 
-    minimal symbol to mark it as a 16-bit function
-    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
-    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
-    the "info" field with the "special" bit masked out
-  */
- 
- #define MSYMBOL_IS_SPECIAL(msym) \
-   mips_msymbol_is_special (msym)
- #define MSYMBOL_SIZE(msym) \
-   mips_msymbol_size (msym)
- struct minimal_symbol;
- extern int mips_msymbol_is_special (struct minimal_symbol *msym);
- extern long mips_msymbol_size (struct minimal_symbol *msym);
- 
- 
  /* Command to set the processor type. */
  extern void mips_set_processor_type_command (char *, int);
- 
  
  /* Single step based on where the current instruction will take us.  */
  extern void mips_software_single_step (enum target_signal, int);
--- 238,245 ----


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

* Re: [PATCH] mips-tdep.c: local defines, static functions
  2002-08-20 17:55 [PATCH] mips-tdep.c: local defines, static functions Michael Snyder
@ 2002-08-20 18:29 ` Andrew Cagney
  2002-08-21 15:28   ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-08-20 18:29 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, cagney


> + #define MSYMBOL_IS_SPECIAL(msym) \
> +   (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
> + #define MSYMBOL_SIZE(msym) \
> +   ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
> + 

``Macro's are bad m'kay.''

Could you please retain these functions:

- /* MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol.  */
-
- int
- mips_msymbol_is_special (struct minimal_symbol *msym)
- {
-   return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0);
- }
-
- /* MSYMBOL_SIZE returns the size of the minimal symbol, i.e.  the
-    "info" field with the "special" bit masked out.  */
-
- long
- mips_msymbol_size (struct minimal_symbol *msym)
- {
-   return ((long) MSYMBOL_INFO (msym) & 0x7fffffff);
- }
-

and instead replace references to MSYMBOL_IS_SPECIAL() with simple 
function calls.

Andrew



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

* Re: [PATCH] mips-tdep.c: local defines, static functions
  2002-08-20 18:29 ` Andrew Cagney
@ 2002-08-21 15:28   ` Michael Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2002-08-21 15:28 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches, cagney

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

Andrew Cagney wrote:
> 
> > + #define MSYMBOL_IS_SPECIAL(msym) \
> > +   (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
> > + #define MSYMBOL_SIZE(msym) \
> > +   ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
> > +
> 
> ``Macro's are bad m'kay.''
> 
> Could you please retain these functions:

Done and committed, as follows:

[-- Attachment #2: function.diff --]
[-- Type: text/plain, Size: 3560 bytes --]

2002-08-21  Michael Snyder  <msnyder@redhat.com>

	* mips-tdep.c (MSYMBOL_IS_SPECIAL): Replace macro with function.
	(MSYMBOL_SIZE): Replace macro with function.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.116
diff -p -r1.116 mips-tdep.c
*** mips-tdep.c	21 Aug 2002 01:08:22 -0000	1.116
--- mips-tdep.c	21 Aug 2002 22:16:30 -0000
*************** mips_saved_regsize (void)
*** 173,179 ****
      return 4;
  }
  
! /* Macros for setting and testing a bit in a minimal symbol that
     marks it as 16-bit function.  The MSB of the minimal symbol's
     "info" field is used for this purpose. This field is already
     being used to store the symbol size, so the assumption is
--- 173,179 ----
      return 4;
  }
  
! /* Functions for setting and testing a bit in a minimal symbol that
     marks it as 16-bit function.  The MSB of the minimal symbol's
     "info" field is used for this purpose. This field is already
     being used to store the symbol size, so the assumption is
*************** mips_saved_regsize (void)
*** 187,197 ****
     MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
     the "info" field with the "special" bit masked out */
  
- #define MSYMBOL_IS_SPECIAL(msym) \
-   (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
- #define MSYMBOL_SIZE(msym) \
-   ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
- 
  static void
  mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
  {
--- 187,192 ----
*************** mips_elf_make_msymbol_special (asymbol *
*** 203,208 ****
--- 198,215 ----
      } 
  }
  
+ static int
+ msymbol_is_special (struct minimal_symbol *msym)
+ {
+   return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0);
+ }
+ 
+ static long
+ msymbol_size (struct minimal_symbol *msym)
+ {
+   return ((long) MSYMBOL_INFO (msym) & 0x7fffffff);
+ }
+ 
  /* XFER a value from the big/little/left end of the register.
     Depending on the size of the value it might occupy the entire
     register or just part of it.  Make an allowance for this, aligning
*************** pc_is_mips16 (bfd_vma memaddr)
*** 745,751 ****
       MIPS16 or normal MIPS.  */
    sym = lookup_minimal_symbol_by_pc (memaddr);
    if (sym)
!     return MSYMBOL_IS_SPECIAL (sym);
    else
      return 0;
  }
--- 752,758 ----
       MIPS16 or normal MIPS.  */
    sym = lookup_minimal_symbol_by_pc (memaddr);
    if (sym)
!     return msymbol_is_special (sym);
    else
      return 0;
  }
*************** mips_dump_tdep (struct gdbarch *current_
*** 6137,6145 ****
  		      "mips_dump_tdep: ECOFF_REG_TO_REGNUM # %s\n",
  		      XSTRING (ECOFF_REG_TO_REGNUM (REGNUM)));
    fprintf_unfiltered (file,
- 		      "mips_dump_tdep: ELF_MAKE_MSYMBOL_SPECIAL # %s\n",
- 		      XSTRING (ELF_MAKE_MSYMBOL_SPECIAL (SYM, MSYM)));
-   fprintf_unfiltered (file,
  		      "mips_dump_tdep: FCRCS_REGNUM = %d\n",
  		      FCRCS_REGNUM);
    fprintf_unfiltered (file,
--- 6144,6149 ----
*************** mips_dump_tdep (struct gdbarch *current_
*** 6235,6245 ****
    fprintf_unfiltered (file,
  		      "mips_dump_tdep: MIPS_SAVED_REGSIZE = %d\n",
  		      MIPS_SAVED_REGSIZE);
-   fprintf_unfiltered (file,
- 		      "mips_dump_tdep: MSYMBOL_IS_SPECIAL = function?\n");
-   fprintf_unfiltered (file,
- 		      "mips_dump_tdep: MSYMBOL_SIZE # %s\n",
- 		      XSTRING (MSYMBOL_SIZE (MSYM)));
    fprintf_unfiltered (file,
  		      "mips_dump_tdep: OP_LDFPR = used?\n");
    fprintf_unfiltered (file,
--- 6239,6244 ----

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

end of thread, other threads:[~2002-08-21 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 17:55 [PATCH] mips-tdep.c: local defines, static functions Michael Snyder
2002-08-20 18:29 ` Andrew Cagney
2002-08-21 15:28   ` Michael Snyder

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