public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: MIPS16 symbol annotation interpretation fix
@ 2011-11-23 15:11 Maciej W. Rozycki
  2011-12-05 13:50 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2011-11-23 15:11 UTC (permalink / raw)
  To: gdb-patches

Hi,

 It makes no sense for the ISA mode bit to override MIPS16 information 
stored in the associated symbol.  For example it causes a MIPS16 BREAK 
instruction to be used for standard MIPS code if a software breakpoint is 
explicitly requested at an address that has the ISA bit set even if the 
location is within a function known to be standard MIPS code.

 The change below fixes that for mips_pc_is_mips16 and mips_next_pc which 
both should only fall back to examining the ISA mode bit if no symbol 
annotation is available.

 Regression tested successfully for mips-sde-elf (MIPS32 and MIPS16 
multilibs, big- and little-endian each) and mips-linux-gnu.  OK to apply?

2011-11-23  Maciej W. Rozycki  <macro@codesourcery.com>

	gdb/
	* mips-tdep.c (mips_pc_is_mips16): Reverse the order of checks
	performed to determine whether an address refers to standard
	MIPS or MIPS16 code.
	(mips16_next_pc): Use mips_pc_is_mips16 instead of
	is_mips16_addr.

  Maciej

gdb-mips-pc-is-mips16.diff
Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.c
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c	2011-11-23 02:34:31.000000000 +0000
+++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c	2011-11-23 02:42:05.435578274 +0000
@@ -1018,18 +1018,15 @@ mips_pc_is_mips16 (CORE_ADDR memaddr)
 {
   struct minimal_symbol *sym;
 
-  /* If bit 0 of the address is set, assume this is a MIPS16 address.  */
-  if (is_mips16_addr (memaddr))
-    return 1;
-
-  /* A flag indicating that this is a MIPS16 function is stored by elfread.c in
-     the high bit of the info field.  Use this to decide if the function is
-     MIPS16 or normal MIPS.  */
+  /* A flag indicating that this is a MIPS16 function is stored by
+     elfread.c in the high bit of the info field.  Use this to decide
+     if the function is MIPS16 or normal MIPS.  Otherwise if bit 0 of
+     the address is set, assume this is a MIPS16 address.  */
   sym = lookup_minimal_symbol_by_pc (memaddr);
   if (sym)
     return msymbol_is_special (sym);
   else
-    return 0;
+    return is_mips16_addr (memaddr);
 }
 
 /* MIPS believes that the PC has a sign extended value.  Perhaps the
@@ -1606,7 +1603,7 @@ mips16_next_pc (struct frame_info *frame
 static CORE_ADDR
 mips_next_pc (struct frame_info *frame, CORE_ADDR pc)
 {
-  if (is_mips16_addr (pc))
+  if (mips_pc_is_mips16 (pc))
     return mips16_next_pc (frame, pc);
   else
     return mips32_next_pc (frame, pc);

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

* Re: [PATCH] MIPS: MIPS16 symbol annotation interpretation fix
  2011-11-23 15:11 [PATCH] MIPS: MIPS16 symbol annotation interpretation fix Maciej W. Rozycki
@ 2011-12-05 13:50 ` Joel Brobecker
  2011-12-06 23:30   ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2011-12-05 13:50 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches

> 2011-11-23  Maciej W. Rozycki  <macro@codesourcery.com>
> 
> 	gdb/
> 	* mips-tdep.c (mips_pc_is_mips16): Reverse the order of checks
> 	performed to determine whether an address refers to standard
> 	MIPS or MIPS16 code.
> 	(mips16_next_pc): Use mips_pc_is_mips16 instead of
> 	is_mips16_addr.

That makes sense to me. Please go ahead and commit.

-- 
Joel

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

* Re: [PATCH] MIPS: MIPS16 symbol annotation interpretation fix
  2011-12-05 13:50 ` Joel Brobecker
@ 2011-12-06 23:30   ` Maciej W. Rozycki
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2011-12-06 23:30 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Mon, 5 Dec 2011, Joel Brobecker wrote:

> > 2011-11-23  Maciej W. Rozycki  <macro@codesourcery.com>
> > 
> > 	gdb/
> > 	* mips-tdep.c (mips_pc_is_mips16): Reverse the order of checks
> > 	performed to determine whether an address refers to standard
> > 	MIPS or MIPS16 code.
> > 	(mips16_next_pc): Use mips_pc_is_mips16 instead of
> > 	is_mips16_addr.
> 
> That makes sense to me. Please go ahead and commit.

 Applied now, thanks for the review.

  Maciej

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

end of thread, other threads:[~2011-12-06 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 15:11 [PATCH] MIPS: MIPS16 symbol annotation interpretation fix Maciej W. Rozycki
2011-12-05 13:50 ` Joel Brobecker
2011-12-06 23:30   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).