From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix another stale frame_info *
Date: Thu, 23 Feb 2012 08:38:00 -0000 [thread overview]
Message-ID: <20120223083743.GA5696@host2.jankratochvil.net> (raw)
Hi,
ISTM one cannot safely initialize FRAME_CALLER_PC unconditionally.
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
I will check it in.
Thanks,
Jan
gdb/
2012-02-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (until_break_command): New variables frame_caller_id,
frame_caller_pc and frame_caller_arch. Use them after
set_momentary_breakpoint.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9853,12 +9853,19 @@ until_break_command (char *arg, int from_tty, int anywhere)
struct symtabs_and_lines sals;
struct symtab_and_line sal;
struct frame_info *frame = get_selected_frame (NULL);
+ struct frame_id frame_caller_id = frame_unwind_caller_id (frame);
+ /* Initialize it just to avoid a GCC false warning. */
+ CORE_ADDR frame_caller_pc = 0;
+ struct gdbarch *frame_caller_arch = frame_unwind_caller_arch (frame);
struct breakpoint *breakpoint;
struct breakpoint *breakpoint2 = NULL;
struct cleanup *old_chain;
int thread;
struct thread_info *tp;
+ if (frame_id_p (frame_caller_id))
+ frame_caller_pc = frame_unwind_caller_pc (frame);
+
clear_proceed_status ();
/* Set a breakpoint where the user wants it and at return from
@@ -9903,17 +9912,15 @@ until_break_command (char *arg, int from_tty, int anywhere)
/* Keep within the current frame, or in frames called by the current
one. */
- if (frame_id_p (frame_unwind_caller_id (frame)))
+ if (frame_id_p (frame_caller_id))
{
- sal = find_pc_line (frame_unwind_caller_pc (frame), 0);
- sal.pc = frame_unwind_caller_pc (frame);
- breakpoint2 = set_momentary_breakpoint (frame_unwind_caller_arch (frame),
- sal,
- frame_unwind_caller_id (frame),
- bp_until);
+ sal = find_pc_line (frame_caller_pc, 0);
+ sal.pc = frame_caller_pc;
+ breakpoint2 = set_momentary_breakpoint (frame_caller_arch, sal,
+ frame_caller_id, bp_until);
make_cleanup_delete_breakpoint (breakpoint2);
- set_longjmp_breakpoint (tp, frame_unwind_caller_id (frame));
+ set_longjmp_breakpoint (tp, frame_caller_id);
make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
}
next reply other threads:[~2012-02-23 8:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-23 8:38 Jan Kratochvil [this message]
2012-02-24 15:37 ` Pedro Alves
2012-02-24 15:41 ` Jan Kratochvil
2012-02-24 15:54 ` Pedro Alves
2012-02-24 16:05 ` Jan Kratochvil
2012-02-24 16:32 ` 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=20120223083743.GA5696@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.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