From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Michael Snyder <msnyder@vmware.com>,
Daniel Jacobowitz <drow@false.org>,
teawater <teawater@gmail.com>
Subject: Re: [RFA] Reverse Debugging, 4/5
Date: Mon, 06 Oct 2008 21:27:00 -0000 [thread overview]
Message-ID: <200810062227.18333.pedro@codesourcery.com> (raw)
In-Reply-To: <48E3CD40.3070206@vmware.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3815 bytes --]
On Wednesday 01 October 2008 20:19:28, Michael Snyder wrote:
> Â
> +static void finish_backwards (struct symbol *, struct thread_info *);
> +
Minor nit. If you put the new function here, you don't
need the forward declaration.
> Â Â function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
> @@ -1427,10 +1422,29 @@ finish_command (char *arg, int from_tty)
> Â Â Â source. Â */
> Â Â if (from_tty)
> Â Â Â {
> - Â Â Â printf_filtered (_("Run till exit from "));
> + Â Â Â if (target_get_execution_direction () == EXEC_REVERSE)
> +Â Â Â Â Â Â Â printf_filtered ("Run back to call of ");
> + Â Â Â else
> +Â Â Â Â Â Â Â printf_filtered ("Run till exit from ");
> +
> Â Â Â Â print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
> Â Â Â }
i18n.
> +
> +static void
> +finish_backwards (struct symbol *function, struct thread_info *tp)
> +{
> + Â struct symtab_and_line sal;
> + Â struct breakpoint *breakpoint;
> + Â struct cleanup *old_chain;
> + Â CORE_ADDR func_addr;
> + Â int back_up;
> +
> + Â if (find_pc_partial_function (get_frame_pc (get_current_frame ()),
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, &func_addr, NULL) == 0)
> + Â Â internal_error (__FILE__, __LINE__,
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Finish: couldn't find function.");
Can't this happen in some circunstances, like the user hitting
finish after stepi through
no-debug-info-at-all-not-even-minimal-symbols code?
> +
> + Â sal = find_pc_line (func_addr, 0);
> +
> + Â /* TODO: Let's not worry about async until later. Â */
If you don't want to think about it now, could you error out
in the async+reverse case ?
> +
> + Â /* We don't need a return value. Â */
> + Â tp->proceed_to_finish = 0;
> + Â /* Special case: if we're sitting at the function entry point,
> + Â Â then all we need to do is take a reverse singlestep. Â We
> + Â Â don't need to set a breakpoint, and indeed it would do us
> + Â Â no good to do so.
> +
> + Â Â Note that this can only happen at frame #0, since there's
> + Â Â no way that a function up the stack can have a return address
> + Â Â that's equal to its entry point. Â */
> +
> + Â if (sal.pc != read_pc ())
> + Â Â {
> + Â Â Â /* Set breakpoint and continue. Â */
> + Â Â Â breakpoint =
> +Â Â Â Â Â Â Â set_momentary_breakpoint (sal,
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â get_frame_id (get_selected_frame (NULL)),
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â bp_breakpoint);
> + Â Â Â /* Tell the breakpoint to keep quiet. Â We won't be done
> + Â Â Â Â until we've done another reverse single-step. Â */
> + Â Â Â breakpoint_silence (breakpoint);
> + Â Â Â old_chain = make_cleanup_delete_breakpoint (breakpoint);
> + Â Â Â proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
> + Â Â Â /* We will be stopped when proceed returns. Â */
> + Â Â Â back_up = bpstat_find_breakpoint (tp->stop_bpstat, breakpoint) != NULL;
> + Â Â Â do_cleanups (old_chain);
> + Â Â }
> + Â else
> + Â Â back_up = 1;
> + Â if (back_up)
> + Â Â {
> + Â Â Â /* If in fact we hit the step-resume breakpoint (and not
> +Â Â Â Â Â Â Â some other breakpoint), then we're almost there --
> +Â Â Â Â Â Â Â we just need to back up by one more single-step. Â */
> + Â Â Â /* (Kludgy way of letting wait_for_inferior know...) */
> + Â Â Â tp->step_range_start = tp->step_range_end = 1;
> + Â Â Â proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
Would calling step_1 or step_once instead work here? It would
probably avoid the kludge.
I'm no reverse guru, but your comments made sense to me.
> + Â Â }
> + Â return;
> +}
> +
> Â \f
> Â static void
> Â environment_info (char *var, int from_tty)
--
Pedro Alves
\x16º&Öéj×!zÊÞ¶êççÝ9îX¬µªÜ\a[¥«\
ë
next prev parent reply other threads:[~2008-10-06 21:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-01 19:21 Michael Snyder
2008-10-06 21:27 ` Pedro Alves [this message]
2008-10-06 21:50 ` Michael Snyder
2008-10-06 21:57 ` Joel Brobecker
2008-10-06 22:18 ` Michael Snyder
2008-10-07 3:18 ` Joel Brobecker
2008-10-06 22:42 ` Tom Tromey
2008-10-06 22:55 ` Michael Snyder
2008-10-06 22:59 ` Tom Tromey
2008-10-07 3:15 ` Joel Brobecker
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=200810062227.18333.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=teawater@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