Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com, ezannoni@redhat.com,
	jimb@redhat.com, fedor@doc.com
Subject: Re: RFA symtab: Fix for PR c++/1267 ("next" and shared libraries)
Date: Mon, 21 Jul 2003 16:18:00 -0000	[thread overview]
Message-ID: <3F1C1254.2070007@redhat.com> (raw)
In-Reply-To: <20030719181817.GA11670@nevyn.them.org>


> By the way, I'm convinced that all is not well in step_over_function.  This
> comment,
> 
>   /* NOTE: cagney/2003-04-06:
> 
>      The intent of DEPRECATED_SAVED_PC_AFTER_CALL was to:
> 
>      - provide a very light weight equivalent to frame_unwind_pc()
>      (nee FRAME_SAVED_PC) that avoids the prologue analyzer
> 
>      - avoid handling the case where the PC hasn't been saved in the
>      prologue analyzer
> 
>      Unfortunatly, not five lines further down, is a call to
>      get_frame_id() and that is guarenteed to trigger the prologue
>      analyzer.
> 
> is either incorrect or has gotten out of sync with the code:

Nope (it pays to look at the archives).

>   if (DEPRECATED_SAVED_PC_AFTER_CALL_P ())
>     sr_sal.pc = ADDR_BITS_REMOVE (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
>   else
>     sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (get_current_frame ()));
>   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);
> 
> 
> Note that get_frame_id unwinds from the NEXT frame, and
> frame_pc_unwind/DEPRECATED_SAVED_PC_AFTER_CALL unwind from THIS frame.
> This throws me a loop every time I have to work in this function.  Also, I
> have the nagging feeling we're saving the wrong frame.  I have an old MIPS
> patch where I needed to use get_prev_frame in step_over_function.  As soon
> as I have time to revisit that patch I'll be back to clean this up some
> more.

The complete code body is:

   if (DEPRECATED_SAVED_PC_AFTER_CALL_P ())
     sr_sal.pc = ADDR_BITS_REMOVE (DEPRECATED_SAVED_PC_AFTER_CALL 
(get_current_frame ()));
   else
     sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (get_current_frame ()));
   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;

while the original code looks like:

   struct symtab_and_line sr_sal;

   init_sal (&sr_sal);		/* initialize to zeros */
   sr_sal.pc = ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame 
()));
   sr_sal.section = find_pc_overlay (sr_sal.pc);

   check_for_old_step_resume_breakpoint ();
   step_resume_breakpoint =
     set_momentary_breakpoint (sr_sal, get_current_frame (), 
bp_step_resume);

   if (step_frame_address && !IN_SOLIB_DYNSYM_RESOLVE_CODE (sr_sal.pc))
     step_resume_breakpoint->frame = step_frame_address;

   if (breakpoints_inserted)
     insert_breakpoints ();

It would appear that the get_frame_id() call has been wrong for a long 
long time but, at a guess, was worked around by picking up step_frame_id 
/ step_frame_address.

Andrew



  parent reply	other threads:[~2003-07-21 16:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-19 18:18 Daniel Jacobowitz
2003-07-20  3:30 ` Adam Fedor
2003-07-21  7:11 ` Jim Blandy
2003-07-21 12:53   ` Daniel Jacobowitz
2003-07-24 19:59     ` Jim Blandy
2003-07-24 20:58       ` Daniel Jacobowitz
2003-07-24 21:34         ` Adam Fedor
2003-07-25  0:12           ` Jim Blandy
2003-07-25  6:07         ` Eli Zaretskii
2003-07-25 12:58           ` Daniel Jacobowitz
2003-07-28  2:38       ` Daniel Jacobowitz
2003-07-21 16:18 ` Andrew Cagney [this message]
2003-07-21 16:27   ` Daniel Jacobowitz
2003-07-21 18:22     ` Andrew Cagney
2003-07-21 21:23       ` Daniel Jacobowitz
2003-07-25 16:15 Michael Elizabeth Chastain
2003-07-25 16:20 ` Daniel Jacobowitz
2003-07-25 16:24 Michael Elizabeth Chastain

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=3F1C1254.2070007@redhat.com \
    --to=ac131313@redhat.com \
    --cc=drow@mvista.com \
    --cc=ezannoni@redhat.com \
    --cc=fedor@doc.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@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