This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [AArch64] Refactor aarch64_make_stub_cache


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8b61f75db53877215c7cb15b901a094bf1fb916e

commit 8b61f75db53877215c7cb15b901a094bf1fb916e
Author: Pierre Langlois <pierre.langlois@arm.com>
Date:   Thu Jul 9 16:35:10 2015 +0100

    [AArch64] Refactor aarch64_make_stub_cache
    
    We would previously have to make sure the frame cache was not already
    created before calling aarch64_make_stub_cache.  This patch makes this
    function check it so the caller does not need to do so.
    
    gdb/ChangeLog:
    
    	* aarch64-tdep.c (aarch64_make_stub_cache): Update comment.  New
    	argument this_cache.  Remove unused local variables reg and
    	unwound_fp.  Return early if this_cache is already set.  Set
    	this_cache.
    	(aarch64_stub_this_id): Update call to aarch64_make_stub_cache.

Diff:
---
 gdb/ChangeLog      |  8 ++++++++
 gdb/aarch64-tdep.c | 21 +++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 672b297..73ee4d1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2015-07-09  Pierre Langlois  <pierre.langlois@arm.com>
 
+	* aarch64-tdep.c (aarch64_make_stub_cache): Update comment.  New
+	argument this_cache.  Remove unused local variables reg and
+	unwound_fp.  Return early if this_cache is already set.  Set
+	this_cache.
+	(aarch64_stub_this_id): Update call to aarch64_make_stub_cache.
+
+2015-07-09  Pierre Langlois  <pierre.langlois@arm.com>
+
 	* aarch64-tdep.c (aarch64_make_prologue_cache): Update comment.
 	New argument this_cache.  Return early if this_cache is already
 	set.  Set this_cache.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 6f3a643..b21182b 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1050,18 +1050,22 @@ struct frame_unwind aarch64_prologue_unwind =
   default_frame_sniffer
 };
 
-/* Allocate an aarch64_prologue_cache and fill it with information
-   about the prologue of *THIS_FRAME.  */
+/* Allocate and fill in *THIS_CACHE with information about the prologue of
+   *THIS_FRAME.  Do not do this is if *THIS_CACHE was already allocated.
+   Return a pointer to the current aarch64_prologue_cache in
+   *THIS_CACHE.  */
 
 static struct aarch64_prologue_cache *
-aarch64_make_stub_cache (struct frame_info *this_frame)
+aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
 {
-  int reg;
   struct aarch64_prologue_cache *cache;
-  CORE_ADDR unwound_fp;
+
+  if (*this_cache != NULL)
+    return *this_cache;
 
   cache = FRAME_OBSTACK_ZALLOC (struct aarch64_prologue_cache);
   cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
+  *this_cache = cache;
 
   cache->prev_sp
     = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
@@ -1075,11 +1079,8 @@ static void
 aarch64_stub_this_id (struct frame_info *this_frame,
 		      void **this_cache, struct frame_id *this_id)
 {
-  struct aarch64_prologue_cache *cache;
-
-  if (*this_cache == NULL)
-    *this_cache = aarch64_make_stub_cache (this_frame);
-  cache = *this_cache;
+  struct aarch64_prologue_cache *cache
+    = aarch64_make_stub_cache (this_frame, this_cache);
 
   *this_id = frame_id_build (cache->prev_sp, get_frame_pc (this_frame));
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]