From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Omair Javaid <omair.javaid@linaro.org>,
Yao Qi <qiyaoltc@gmail.com>,
arnez@linux.vnet.ibm.com
Subject: [RFC PATCH v5 8/9] Link frame_info to thread_info
Date: Mon, 12 Mar 2018 15:31:00 -0000 [thread overview]
Message-ID: <20180312153115.47321-9-prudo@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180312153115.47321-1-prudo@linux.vnet.ibm.com>
Linux kernel stacks on S390 are spread over several memory locations.
These locations differ for every kernel task/thread. Thus we need to know
to which task/thread a frame belongs to check whether a stack pointer is
valid and when to stop unwinding. To do so add a pointer to the
corresponding thread_info to frame_info.
This connection already exists implicitly, via inferior_ptid, due to the
fact that switch_to_thread reinitializes the frame cache.
gdb/ChangeLog:
* frame.h (frame_get_thread): New extern declaration.
* frame.c (frame_info) <thread>: New field.
(frame_get_thread): New function.
(create_sentinel_frame, create_new_frame, get_prev_frame_raw): Set
new field.
---
gdb/frame.c | 12 ++++++++++++
gdb/frame.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/gdb/frame.c b/gdb/frame.c
index 0b04a4ebac..fe81c37755 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -101,6 +101,9 @@ struct frame_info
/* The frame's address space. */
const address_space *aspace;
+ /* The thread this frame belongs to. */
+ struct thread_info *thread;
+
/* The frame's low-level unwinder and corresponding cache. The
low-level unwinder is responsible for unwinding register values
for the previous frame. The low-level unwind methods are
@@ -157,6 +160,12 @@ struct frame_info
const char *stop_string;
};
+struct thread_info *
+frame_get_thread (struct frame_info *frame)
+{
+ return frame->thread;
+}
+
/* A frame stash used to speed up frame lookups. Create a hash table
to stash frames previously accessed from the frame cache for
quicker subsequent retrieval. The hash table is emptied whenever
@@ -1520,6 +1529,7 @@ create_sentinel_frame (struct program_space *pspace, struct regcache *regcache)
frame->level = -1;
frame->pspace = pspace;
frame->aspace = regcache->aspace ();
+ frame->thread = inferior_thread ();
/* Explicitly initialize the sentinel frame's cache. Provide it
with the underlying regcache. In the future additional
information, such as the frame's thread will be added. */
@@ -1744,6 +1754,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
/* We currently assume that frame chain's can't cross spaces. */
fi->pspace = fi->next->pspace;
fi->aspace = fi->next->aspace;
+ fi->thread = fi->next->thread;
/* Select/initialize both the unwind function and the frame's type
based on the PC. */
@@ -2155,6 +2166,7 @@ get_prev_frame_raw (struct frame_info *this_frame)
spaces. */
prev_frame->pspace = this_frame->pspace;
prev_frame->aspace = this_frame->aspace;
+ prev_frame->thread = this_frame->thread;
/* Don't yet compute ->unwind (and hence ->type). It is computed
on-demand in get_frame_type, frame_register_unwind, and
diff --git a/gdb/frame.h b/gdb/frame.h
index d5800b78c2..e908cc5172 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -103,6 +103,8 @@ enum frame_id_stack_status
struct frame_info;
+extern struct thread_info *frame_get_thread (struct frame_info *frame);
+
/* The frame object's ID. This provides a per-frame unique identifier
that can be used to relocate a `struct frame_info' after a target
resume or a frame cache destruct. It of course assumes that the
--
2.13.5
next prev parent reply other threads:[~2018-03-12 15:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 15:31 [RFC v5 0/9] Add support for Linux kernel debugging Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 3/9] Add scoped_restore_regcache_ptid Philipp Rudo
2018-03-17 18:08 ` Simon Marchi
2018-03-12 15:31 ` [RFC PATCH v5 4/9] Add basic Linux kernel support Philipp Rudo
2018-03-13 14:09 ` Kamil Rytarowski
2018-03-14 9:48 ` Philipp Rudo
2018-03-14 23:38 ` Kamil Rytarowski
2018-03-19 0:11 ` Simon Marchi
2018-03-12 15:31 ` [RFC PATCH v5 6/9] Add commands for linux-kernel target Philipp Rudo
2018-03-12 15:31 ` Philipp Rudo [this message]
2018-03-12 15:31 ` [RFC PATCH v5 1/9] Convert substitute_path_component to C++ Philipp Rudo
2018-03-16 2:15 ` Simon Marchi
2018-03-17 20:11 ` Simon Marchi
2018-03-12 15:31 ` [RFC PATCH v5 5/9] Add kernel module support for linux-kernel target Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 7/9] Add privileged registers for s390x Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 9/9] Add S390 support for linux-kernel target Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 2/9] Add libiberty/concat styled concat_path function Philipp Rudo
2018-03-16 2:47 ` Simon Marchi
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=20180312153115.47321-9-prudo@linux.vnet.ibm.com \
--to=prudo@linux.vnet.ibm.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=omair.javaid@linaro.org \
--cc=qiyaoltc@gmail.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