From: Markus Metzger <markus.t.metzger@intel.com>
To: palves@redhat.com
Cc: gdb-patches@sourceware.org
Subject: [PATCH v3 2/3] stack: check frame_unwind_caller_id
Date: Thu, 11 Feb 2016 16:15:00 -0000 [thread overview]
Message-ID: <1455207283-12660-2-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1455207283-12660-1-git-send-email-markus.t.metzger@intel.com>
Callers of frame_unwind_caller_* functions are supposed to check
frame_unwind_caller_id.
Add such a check to frame_info and treat an invalid caller ID as if the caller
PC were not available.
2016-02-11 Markus Metzger <markus.t.metzger@intel.com>
gdb/
* stack.c (frame_info): Check frame_unwind_caller_id.
---
gdb/stack.c | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/gdb/stack.c b/gdb/stack.c
index 89879f3..6e3acc7 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1509,27 +1509,32 @@ frame_info (char *addr_exp, int from_tty)
wrap_here (" ");
printf_filtered ("saved %s = ", pc_regname);
- TRY
- {
- caller_pc = frame_unwind_caller_pc (fi);
- caller_pc_p = 1;
- }
- CATCH (ex, RETURN_MASK_ERROR)
+ if (!frame_id_p (frame_unwind_caller_id (fi)))
+ val_print_unavailable (gdb_stdout);
+ else
{
- switch (ex.error)
+ TRY
{
- case NOT_AVAILABLE_ERROR:
- val_print_unavailable (gdb_stdout);
- break;
- case OPTIMIZED_OUT_ERROR:
- val_print_not_saved (gdb_stdout);
- break;
- default:
- fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
- break;
+ caller_pc = frame_unwind_caller_pc (fi);
+ caller_pc_p = 1;
}
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ switch (ex.error)
+ {
+ case NOT_AVAILABLE_ERROR:
+ val_print_unavailable (gdb_stdout);
+ break;
+ case OPTIMIZED_OUT_ERROR:
+ val_print_not_saved (gdb_stdout);
+ break;
+ default:
+ fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
+ break;
+ }
+ }
+ END_CATCH
}
- END_CATCH
if (caller_pc_p)
fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
--
1.8.3.1
next prev parent reply other threads:[~2016-02-11 16:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 16:14 [PATCH v3 1/3] frame: add skip_tailcall_frames Markus Metzger
2016-02-11 16:15 ` [PATCH v3 3/3] btrace, frame: fix crash in get_frame_type Markus Metzger
2016-02-11 16:26 ` Pedro Alves
2016-02-11 16:15 ` Markus Metzger [this message]
2016-02-11 16:21 ` [PATCH v3 2/3] stack: check frame_unwind_caller_id Pedro Alves
2016-07-21 16:35 ` Yao Qi
2016-07-22 7:53 ` Metzger, Markus T
2016-02-11 16:21 ` [PATCH v3 1/3] frame: add skip_tailcall_frames Pedro Alves
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=1455207283-12660-2-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@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