Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc,6.1?] Use right frame ID in step_over_function
Date: Sun, 29 Feb 2004 04:33:00 -0000	[thread overview]
Message-ID: <40416BAF.1020308@gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

Hello,

This goes into the "how did it ever work" category.  The idea of 
step_over_function is that it:

- finds the caller's resume address
- finds the caller's frame ID

and then sets a breakpoint for that caller instance of the function. 
The current code:

- finds the caller's resume address
- finds the _callee_ frame ID

and then uses that to set the breakpoint.  Now that is plain weird!  It 
only works because either:

- the step_frame_id patches up the bug

- the values match as GDB is using the inner-most, rather than 
outer-most frame address as part of the frame ID

The bug apepars when trying to step over nested shared library non-debug 
info functions (making sense?).

I'll follow this up after 6.1 branch is in place.

Its pretty heavy a change to apply to that branch and this late. 
However, like Joel's related patch, I suspect it will be needed :-/

Andrew

PS: Why do I have this feeling of dejavu?

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2150 bytes --]

	* infrun.c (step_over_function): When non-legacy code, and no
	step_frame_id, use the unwinder to get the caller's frame ID.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.137
diff -u -r1.137 infrun.c
--- infrun.c	16 Feb 2004 20:49:51 -0000	1.137
+++ infrun.c	29 Feb 2004 04:10:59 -0000
@@ -2930,6 +2930,7 @@
 step_over_function (struct execution_control_state *ecs)
 {
   struct symtab_and_line sr_sal;
+  struct frame_id sr_id;
 
   init_sal (&sr_sal);		/* initialize to zeros */
 
@@ -2973,13 +2974,29 @@
   sr_sal.section = find_pc_overlay (sr_sal.pc);
 
   check_for_old_step_resume_breakpoint ();
-  step_resume_breakpoint =
-    set_momentary_breakpoint (sr_sal, get_frame_id (get_current_frame ()),
-			      bp_step_resume);
 
   if (frame_id_p (step_frame_id)
       && !IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc))
-    step_resume_breakpoint->frame_id = step_frame_id;
+    /* NOTE: cagney/2004-02-27: Use the global state's idea of the
+       stepping frame ID.  I suspect this is done as it is lighter
+       weight than a call to get_prev_frame.  */
+    sr_id = step_frame_id;
+  else if (legacy_frame_p (current_gdbarch))
+    /* NOTE: cagney/2004-02-27: This is the way it was 'cos this is
+       the way it always was.  It should be using the unwound (or
+       caller's) ID, and not this (or the callee's) ID.  It appeared
+       to work because: legacy architectures used the wrong end of the
+       frame for the ID.stack (inner-most rather than outer-most) so
+       that the callee's id.stack (un adjusted) matched the caller's
+       id.stack giving the "correct" id; more often than not
+       !IN_SOLIB_DYNSYM_RESOLVE_CODE and hence the code above (it was
+       originally later in the function) fixed the ID by using global
+       state.  */
+    sr_id = get_frame_id (get_current_frame ());
+  else
+    sr_id = get_frame_id (get_prev_frame (get_current_frame ()));
+
+  step_resume_breakpoint = set_momentary_breakpoint (sr_sal, sr_id, bp_step_resume);
 
   if (breakpoints_inserted)
     insert_breakpoints ();

             reply	other threads:[~2004-02-29  4:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-29  4:33 Andrew Cagney [this message]
2004-02-29 17:18 ` Daniel Jacobowitz
2004-03-19  0:09   ` Andrew Cagney
2004-03-01  1:24     ` Andrew Cagney
2004-03-05 23:02 ` Andrew Cagney
2004-03-05 23:39   ` Daniel Jacobowitz
2004-03-06  0:08     ` Andrew Cagney
2004-03-19  0:09       ` Andrew Cagney
2004-03-19  0:09     ` Daniel Jacobowitz
2004-03-19  0:09   ` Andrew Cagney

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=40416BAF.1020308@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb-patches@sources.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