public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add create_new_frame(frame_id) overload Date: Fri, 20 Jan 2023 19:52:52 +0000 (GMT) [thread overview] Message-ID: <20230120195252.72AB03858D20@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d015d3206e11c6926c4afce723d8366afc965b97 commit d015d3206e11c6926c4afce723d8366afc965b97 Author: Simon Marchi <simon.marchi@polymtl.ca> Date: Tue Dec 13 22:34:37 2022 -0500 gdb: add create_new_frame(frame_id) overload The subsequent patches will need to call create_new_frame with an existing frame_id representing a user created frame. They could call the existing create_new_frame, passing both addresses, but it seems nicer to have a version of the function that takes a frame_id directly. Change-Id: If31025314fec0c3e644703e4391a5ef8079e1a32 Reviewed-By: Bruno Larsen <blarsen@redhat.com> Diff: --- gdb/frame.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index 2e6a477ef16..0909109c1f4 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1929,22 +1929,23 @@ select_frame (frame_info_ptr fi) /* Create an arbitrary (i.e. address specified by user) or innermost frame. Always returns a non-NULL value. */ -frame_info_ptr -create_new_frame (CORE_ADDR addr, CORE_ADDR pc) +static frame_info_ptr +create_new_frame (frame_id id) { - frame_info *fi; + gdb_assert (id.user_created_p); + gdb_assert (id.stack_status == frame_id_stack_status::FID_STACK_VALID); + gdb_assert (id.code_addr_p); - frame_debug_printf ("addr=%s, pc=%s", hex_string (addr), hex_string (pc)); + frame_debug_printf ("stack_addr=%s, core_addr=%s", + hex_string (id.stack_addr), hex_string (id.code_addr)); /* Avoid creating duplicate frames, search for an existing frame with that id in the stash. */ - frame_id id = frame_id_build (addr, pc); - id.user_created_p = 1; frame_info_ptr frame = frame_stash_find (id); if (frame != nullptr) return frame; - fi = FRAME_OBSTACK_ZALLOC (struct frame_info); + frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info); fi->next = create_sentinel_frame (current_program_space, get_current_regcache ()); @@ -1953,7 +1954,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) Do this before looking for this frame's unwinder. A sniffer is very likely to read this, and the corresponding unwinder is entitled to rely that the PC doesn't magically change. */ - fi->next->prev_pc.value = pc; + fi->next->prev_pc.value = id.code_addr; fi->next->prev_pc.status = CC_VALUE; /* We currently assume that frame chain's can't cross spaces. */ @@ -1975,6 +1976,15 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) return frame_info_ptr (fi); } +frame_info_ptr +create_new_frame (CORE_ADDR stack, CORE_ADDR pc) +{ + frame_id id = frame_id_build (stack, pc); + id.user_created_p = 1; + + return create_new_frame (id); +} + /* Return the frame that THIS_FRAME calls (NULL if THIS_FRAME is the innermost frame). Be careful to not fall off the bottom of the frame chain and onto the sentinel frame. */
reply other threads:[~2023-01-20 19:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230120195252.72AB03858D20@sourceware.org \ --to=simark@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).