Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [SH] Prologue skipping if there is none
Date: Fri, 24 Feb 2012 11:09:00 -0000	[thread overview]
Message-ID: <87wr7c7aop.fsf@schwinge.name> (raw)
In-Reply-To: <20120220162029.2082b6a1@mesquite.lan>

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

Hi Kevin!

On Mon, 20 Feb 2012 16:20:29 -0700, Kevin Buettner <kevinb@redhat.com> wrote:
> On Mon, 20 Feb 2012 17:15:54 +0100
> Thomas Schwinge <thomas@codesourcery.com> wrote:
> 
> > So, we do seem to agree that something like the patch I posted initially
> > (and as it is incorporated in a similar fashion in your patch, too) does
> > already move us forward; is it reasonable that we commit that one now,
> > and then continue to look on how to further improve the situation based
> > on your patch?  This will let us point out more easily which are the
> > additional cases your patch improves/regresses on.  (I'd offer to port
> > your patch over to the new baseline, if you want me to.)
> 
> Yeah, as a first step, I think it makes sense for you to commit
> the patch that you came up with.

Thanks; here is the patch I committed in the end:

2012-02-24  Thomas Schwinge  <thomas@codesourcery.com>

	* sh-tdep.c (sh_skip_prologue): Use skip_prologue_using_sal.
	(after_prologue): Remove.

Index: gdb/sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.237
diff -u -p -r1.237 sh-tdep.c
--- gdb/sh-tdep.c	17 Feb 2012 08:39:57 -0000	1.237
+++ gdb/sh-tdep.c	24 Feb 2012 10:59:08 -0000
@@ -712,55 +712,29 @@ sh_analyze_prologue (struct gdbarch *gdb
 }
 
 /* Skip any prologue before the guts of a function.  */
-
-/* Skip the prologue using the debug information.  If this fails we'll
-   fall back on the 'guess' method below.  */
 static CORE_ADDR
-after_prologue (CORE_ADDR pc)
+sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  struct symtab_and_line sal;
-  CORE_ADDR func_addr, func_end;
-
-  /* If we can not find the symbol in the partial symbol table, then
-     there is no hope we can determine the function's start address
-     with this code.  */
-  if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
-    return 0;
-
-  /* Get the line associated with FUNC_ADDR.  */
-  sal = find_pc_line (func_addr, 0);
-
-  /* There are only two cases to consider.  First, the end of the source line
-     is within the function bounds.  In that case we return the end of the
-     source line.  Second is the end of the source line extends beyond the
-     bounds of the current function.  We need to use the slow code to
-     examine instructions in that case.  */
-  if (sal.end < func_end)
-    return sal.end;
-  else
-    return 0;
-}
-
-static CORE_ADDR
-sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
-{
-  CORE_ADDR pc;
+  CORE_ADDR post_prologue_pc, func_addr;
   struct sh_frame_cache cache;
 
   /* See if we can determine the end of the prologue via the symbol table.
      If so, then return either PC, or the PC after the prologue, whichever
      is greater.  */
-  pc = after_prologue (start_pc);
+  if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
+    {
+      post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
+      if (post_prologue_pc != 0)
+        return max (pc, post_prologue_pc);
+    }
 
-  /* If after_prologue returned a useful address, then use it.  Else
-     fall back on the instruction skipping code.  */
-  if (pc)
-    return max (pc, start_pc);
+  /* Can't determine prologue from the symbol table, need to examine
+     instructions.  */
 
   cache.sp_offset = -4;
-  pc = sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, 0);
-  if (!cache.uses_fp)
-    return start_pc;
+  post_prologue_pc = sh_analyze_prologue (gdbarch, pc, (CORE_ADDR) -1, &cache, 0);
+  if (cache.uses_fp)
+    pc = post_prologue_pc;
 
   return pc;
 }


Working on your patch is the next step.


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

  reply	other threads:[~2012-02-24 11:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 14:00 Thomas Schwinge
2012-02-15 14:54 ` Pedro Alves
2012-02-16 15:27   ` [PATCH] [SH] GDB crash in sh_is_renesas_calling_convention, TYPE_CALLING_CONVENTION (was: Prologue skipping if there is none) Thomas Schwinge
2012-02-16 19:38     ` [PATCH] [SH] GDB crash in sh_is_renesas_calling_convention, TYPE_CALLING_CONVENTION Tom Tromey
2012-02-15 16:09 ` [PATCH] [SH] Prologue skipping if there is none Kevin Buettner
2012-02-16  0:13   ` Kevin Buettner
2012-02-16 16:59     ` Thomas Schwinge
2012-02-17  2:30       ` Kevin Buettner
2012-02-20 16:19         ` Thomas Schwinge
2012-02-21  5:25           ` Kevin Buettner
2012-02-24 11:09             ` Thomas Schwinge [this message]
2012-02-24 22:21               ` Kevin Buettner
2012-02-29 13:51                 ` Thomas Schwinge
2012-03-01  0:13                   ` Kevin Buettner
2012-03-01  9:03                     ` Thomas Schwinge
2012-03-01  9:00                   ` Thomas Schwinge
2012-03-02  0:19                     ` Kevin Buettner
2012-03-02 11:18                       ` Thomas Schwinge
2012-03-02 12:01                         ` Pedro Alves
2012-03-02 14:15                           ` Thomas Schwinge
2012-03-06 19:08                             ` Pedro Alves
2012-03-03  1:18                         ` Kevin Buettner
2012-03-05 15:16                           ` Thomas Schwinge
2012-03-05 19:40                             ` Kevin Buettner
2012-02-21 15:23         ` Thomas Schwinge
2012-02-22 14:54         ` Simulator testing for sh and sh64 (was: [PATCH] [SH] Prologue skipping if there is none) Thomas Schwinge
2012-02-22 16:56           ` Kevin Buettner
2012-02-22 19:33             ` Simulator testing for sh and sh64 Thomas Schwinge
2012-02-23  0:35               ` Kaz Kojima
2012-02-24 21:38                 ` Thomas Schwinge
2012-02-23 19:55               ` Thomas Schwinge
2012-02-23 22:53                 ` Kevin Buettner
2012-02-24 11:12                   ` Thomas Schwinge
2012-02-23 23:57                 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wr7c7aop.fsf@schwinge.name \
    --to=thomas@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox