From: Pierre Langlois <pierre.langlois@arm.com>
To: gdb-patches@sourceware.org
Cc: Pierre Langlois <pierre.langlois@arm.com>
Subject: [PATCH 1/8] [AArch64] Refactor aarch64_make_prologue_cache
Date: Tue, 07 Jul 2015 12:53:00 -0000 [thread overview]
Message-ID: <1436273518-5959-2-git-send-email-pierre.langlois@arm.com> (raw)
In-Reply-To: <1436273518-5959-1-git-send-email-pierre.langlois@arm.com>
We would previously have to make sure the frame cache was not already
created before calling aarch64_make_prologue_cache. This patch makes
this function check it so that the caller does not need to do so.
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_prologue_cache): New argument
this_cache. Return early if this_cache is already set. Set
this_cache.
(aarch64_prologue_this_id): Update call to
aarch64_prologue_cache.
(aarch64_prologue_prev_register): Likewise.
(aarch64_normal_frame_base): Likewise.
---
gdb/aarch64-tdep.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 9650a7a..c4b7fe8 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -934,14 +934,18 @@ aarch64_scan_prologue (struct frame_info *this_frame,
about the prologue of *THIS_FRAME. */
static struct aarch64_prologue_cache *
-aarch64_make_prologue_cache (struct frame_info *this_frame)
+aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
{
struct aarch64_prologue_cache *cache;
CORE_ADDR unwound_fp;
int reg;
+ if (*this_cache)
+ return *this_cache;
+
cache = FRAME_OBSTACK_ZALLOC (struct aarch64_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
+ *this_cache = cache;
aarch64_scan_prologue (this_frame, cache);
@@ -970,14 +974,11 @@ static void
aarch64_prologue_this_id (struct frame_info *this_frame,
void **this_cache, struct frame_id *this_id)
{
- struct aarch64_prologue_cache *cache;
+ struct aarch64_prologue_cache *cache
+ = aarch64_make_prologue_cache (this_frame, this_cache);
struct frame_id id;
CORE_ADDR pc, func;
- if (*this_cache == NULL)
- *this_cache = aarch64_make_prologue_cache (this_frame);
- cache = *this_cache;
-
/* This is meant to halt the backtrace at "_start". */
pc = get_frame_pc (this_frame);
if (pc <= gdbarch_tdep (get_frame_arch (this_frame))->lowest_pc)
@@ -999,11 +1000,8 @@ aarch64_prologue_prev_register (struct frame_info *this_frame,
void **this_cache, int prev_regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct aarch64_prologue_cache *cache;
-
- if (*this_cache == NULL)
- *this_cache = aarch64_make_prologue_cache (this_frame);
- cache = *this_cache;
+ struct aarch64_prologue_cache *cache
+ = aarch64_make_prologue_cache (this_frame, this_cache);
/* If we are asked to unwind the PC, then we need to return the LR
instead. The prologue may save PC, but it will point into this
@@ -1120,11 +1118,8 @@ struct frame_unwind aarch64_stub_unwind =
static CORE_ADDR
aarch64_normal_frame_base (struct frame_info *this_frame, void **this_cache)
{
- struct aarch64_prologue_cache *cache;
-
- if (*this_cache == NULL)
- *this_cache = aarch64_make_prologue_cache (this_frame);
- cache = *this_cache;
+ struct aarch64_prologue_cache *cache
+ = aarch64_make_prologue_cache (this_frame, this_cache);
return cache->prev_sp - cache->framesize;
}
--
2.1.0
next prev parent reply other threads:[~2015-07-07 12:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 12:52 [PATCH 0/8] [AArch64] Add support for tracepoints Pierre Langlois
2015-07-07 12:52 ` [PATCH 3/8] [AArch64] Only access inferior registers when creating a frame cache Pierre Langlois
2015-07-08 16:15 ` Yao Qi
2015-07-09 15:40 ` Pierre Langlois
2015-07-07 12:52 ` [PATCH 7/8] [testsuite][AArch64] Port gdb.trace Pierre Langlois
2015-07-08 16:39 ` Yao Qi
2015-07-09 12:25 ` [PATCH v2 " Pierre Langlois
2015-07-09 15:46 ` Pierre Langlois
2015-07-07 12:53 ` Pierre Langlois [this message]
2015-07-08 16:09 ` [PATCH 1/8] [AArch64] Refactor aarch64_make_prologue_cache Yao Qi
2015-07-09 10:36 ` [PATCH] " Pierre Langlois
2015-07-09 15:38 ` Pierre Langlois
2015-07-07 12:53 ` [PATCH 4/8] [AArch64] Teach prologue unwinder to terminate gracefully Pierre Langlois
2015-07-08 16:24 ` Yao Qi
2015-07-09 10:49 ` [PATCH v2 " Pierre Langlois
2015-07-09 10:53 ` Pierre Langlois
2015-07-09 10:56 ` [PATCH v3 " Pierre Langlois
2015-07-09 15:41 ` Pierre Langlois
2015-07-09 12:47 ` [PATCH v2 " Yao Qi
2015-07-09 12:51 ` Pierre Langlois
2015-07-07 12:53 ` [PATCH 5/8] [AArch64] Teach stub " Pierre Langlois
2015-07-08 16:34 ` Yao Qi
2015-07-09 11:12 ` [PATCH v2 " Pierre Langlois
2015-07-09 15:45 ` Pierre Langlois
2015-07-07 12:53 ` [PATCH 2/8] [AArch64] Refactor aarch64_make_stub_cache Pierre Langlois
2015-07-08 16:10 ` Yao Qi
2015-07-09 10:41 ` [PATCH v2 " Pierre Langlois
2015-07-09 15:39 ` Pierre Langlois
2015-07-07 12:54 ` [PATCH 6/8] [AArch64] Implement gdbarch_gen_return_address gdbarch method Pierre Langlois
2015-07-08 16:35 ` Yao Qi
2015-07-09 15:45 ` Pierre Langlois
2015-07-07 12:58 ` [PATCH 8/8] [GDBServer][AArch64] Enable support for tracepoints Pierre Langlois
2015-07-08 16:40 ` Yao Qi
2015-07-09 15:46 ` Pierre Langlois
2015-07-08 10:57 ` [PATCH 0/8] [AArch64] Add " Pedro Alves
2015-07-08 16:42 ` Yao Qi
2015-07-09 13:16 ` [PATCH] Add NEWS entry for tracepoints support on aarch64-linux Pierre Langlois
2015-07-09 14:44 ` Eli Zaretskii
2015-07-09 15:46 ` Pierre Langlois
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=1436273518-5959-2-git-send-email-pierre.langlois@arm.com \
--to=pierre.langlois@arm.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).