public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Frame handling
@ 2003-04-08 18:35 Jafa
  2003-04-14  3:43 ` Andrew Cagney
  0 siblings, 1 reply; 16+ messages in thread
From: Jafa @ 2003-04-08 18:35 UTC (permalink / raw)
  To: gdb

Hi all,

I am working on the ip2k port of GDB. It has been stable for some time now
but I ran out of time to get it reviewed before I went on holiday and now I
am trying to bring it up to date with the trunk again.

I merged with the trunk on March 17 - big mistake... frame handling was
cauing big problems.... looked like a partical update to a new approach.

I have just checked out the trunk today and it looks like a number of the
ports are using the new frame handling approach.

Is the trunk considered ok ATM or is the frame handling still in unstable
daily development?

What port would you recommend for reference for frame handling? The MIPS
port is using deprecated frame functions.

BTW - The stack-backtraces have a second problem as well... GDB is ment to
stop at 'main' but the symbol lookup fails. In the applications that I am
testing the symbol 'main' is a weak alias and this seams to be a general
problem in the symbol lookup.

I would appreciate your advice.

Thanks

Nick


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Frame handling
@ 2003-07-01  1:20 Jafa
  2003-07-01  3:42 ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Jafa @ 2003-07-01  1:20 UTC (permalink / raw)
  To: gdb

Hi all,

I am bringing the ip2k port back in sync with the trunk and I need to check
my (limited) understanding of the new scheme...

This email is mostly a ramble about my understanding of the new frame
handling that I would like a sanity check on.

frame_base_set_default (gdbarch, &avr_frame_base) registers a set of
function handlers:
this_base - given a frame, figure out the base address of the caller frame
(caller's FP)... usually this means doing some analysis to figure everything
out about the frame and populating the port-specific cache for this new
frame.
this_locals - given a frame, figure out the address of the local variables
of the callers frame (usually caller's FP as debug info already allows for
the offset).
this_args - given a frame, figure out the address of the args passed to the
callers frame (usually caller's FP as debug info already allows for the
offset).

Port specific implementation... The first time one of these functions is
called the port-specific cache will be a NULL pointer... the code should
allocate memory to hold the useful frame variables and figure out the frame
information. Subsequent calls will receive the cache back and can return the
values from the cache.

frame_base_set_default also sets the unwind options...
type - always NORMAL_FRAME?
this_id - Given a frame, return a unique identifier for the caller's frame
based on the caller's frame base address and the calling functions entry
point.
prev_register - Given a frame, return the value of a specified register as
it was on entry to this function (registers that are known to be saved on
the stack)

Question - what registers is gdb expecting prev_register to give reasonable
results for? Just PC? Or SP and FP as well?

Question - reading through this again I think the goal of call these
functions is to work with the current frame and the function get passed the
child frame so they can do a backtrace if it hasn't already been done... why
not call a function to do a 1 level backtrace and then eliminate the
next_frame parameter? It would recduce confusion and most ports will have an
internal unwind function anyway.

frame_unwind_append_predicate (gdbarch, d10v_frame_p) - this seams to
register the same unwind options as above?

I think this makes sense but I would appreciate a sanity check :-)

Thanks

Nick

Nick Kelsey
Senior Software Engineer
Ubicom


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: Frame handling
@ 2003-07-01  5:00 Jafa
  2003-07-01 12:45 ` Daniel Jacobowitz
  2003-07-01 13:02 ` Andrew Cagney
  0 siblings, 2 replies; 16+ messages in thread
From: Jafa @ 2003-07-01  5:00 UTC (permalink / raw)
  To: gdb


Hi Daniel,

Thanks for the sanity check - I like the way this APi is heading btw.

>> Question - reading through this again I think the goal of call these
>> functions is to work with the current frame and the function get passed
the
>> child frame so they can do a backtrace if it hasn't already been done...
why
>> not call a function to do a 1 level backtrace and then eliminate the
>> next_frame parameter? It would recduce confusion and most ports will have
an
>> internal unwind function anyway.

>Because it doesn't make much difference, I think.  The key is that the
>info generated when doing the backtrace is target specific, and opaque.

I agree, and I don't think it will make much difference eitehr way, however
I was just thinking that it would be a whole lot easier to explain these
functions...

unwind - Given this frame, go analyize its caller and populate a
port-specific info block/cache, return unique id.

this_base - Given your port-specific frame block/cache data back, what is
the frame's base address?

this_locals - Given your port-specific frame block/cache data back, where do
the frame's locals start?

this_args - Given your port-specific frame block/cache data back, where do
the frame's args start?

this_id - Superceeded by unwind fucntion?

It took a day to 'click' about the logic bhind the cache because I was
looking at it the wrong way... If an API is easier to explain then it is
easier for people to get it right.

Out of interest, what is the theory behind the frame id being made up of
address + func?

I should have the ip2k port frame handling working tomorrow so I will post
the tdep if you would like to take a look. It would probably be good to
check it into the FSF trunk.

Thanks

Nick

----- Original Message ----- 
From: "Daniel Jacobowitz" <drow@mvista.com>
To: <jafa@silicondust.com>
Sent: Monday, June 30, 2003 8:43 PM
Subject: Re: Frame handling


*This message was transferred with a trial version of CommuniGate(tm) Pro*
On Mon, Jun 30, 2003 at 06:18:33PM -0700, Jafa wrote:
> Hi all,
>
> I am bringing the ip2k port back in sync with the trunk and I need to
check
> my (limited) understanding of the new scheme...
>
> This email is mostly a ramble about my understanding of the new frame
> handling that I would like a sanity check on.
>
> frame_base_set_default (gdbarch, &avr_frame_base) registers a set of
> function handlers:
> this_base - given a frame, figure out the base address of the caller frame
> (caller's FP)... usually this means doing some analysis to figure
everything
> out about the frame and populating the port-specific cache for this new
> frame.
> this_locals - given a frame, figure out the address of the local variables
> of the callers frame (usually caller's FP as debug info already allows for
> the offset).
> this_args - given a frame, figure out the address of the args passed to
the
> callers frame (usually caller's FP as debug info already allows for the
> offset).
>
> Port specific implementation... The first time one of these functions is
> called the port-specific cache will be a NULL pointer... the code should
> allocate memory to hold the useful frame variables and figure out the
frame
> information. Subsequent calls will receive the cache back and can return
the
> values from the cache.

You're good so far.

> frame_base_set_default also sets the unwind options...

No, it doesn't.  That unwind member is used for comparison purposes
only.  See the "Sneaky" comment in get_frame_base_address, and all of
"frame-unwind.h".  Esp. frame_unwind_append_predicate.

> type - always NORMAL_FRAME?

For a target's unwinders, probably.

> this_id - Given a frame, return a unique identifier for the caller's frame
> based on the caller's frame base address and the calling functions entry
> point.
> prev_register - Given a frame, return the value of a specified register as
> it was on entry to this function (registers that are known to be saved on
> the stack)
>
> Question - what registers is gdb expecting prev_register to give
reasonable
> results for? Just PC? Or SP and FP as well?

As many as possible.  This _completely_ replaces all other unwinding,
for instance frame_chain and the extra_info/saved_registers data.
Might want to take a look at the ARM conversion I just posted; I don't
promise it's right...

> Question - reading through this again I think the goal of call these
> functions is to work with the current frame and the function get passed
the
> child frame so they can do a backtrace if it hasn't already been done...
why
> not call a function to do a 1 level backtrace and then eliminate the
> next_frame parameter? It would recduce confusion and most ports will have
an
> internal unwind function anyway.

Because it doesn't make much difference, I think.  The key is that the
info generated when doing the backtrace is target specific, and opaque.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-07-03  9:05 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 18:35 Frame handling Jafa
2003-04-14  3:43 ` Andrew Cagney
2003-07-01  1:20 Jafa
2003-07-01  3:42 ` Daniel Jacobowitz
2003-07-01  4:18   ` Andrew Cagney
     [not found]   ` <redirect-6800274@silicondust.com>
2003-07-01  5:13     ` Jafa
2003-07-01 12:58       ` Andrew Cagney
2003-07-01 14:09         ` Daniel Jacobowitz
2003-07-01 14:57           ` Andrew Cagney
     [not found]           ` <redirect-6810110@silicondust.com>
2003-07-01 17:00             ` Jafa
     [not found]       ` <redirect-6810084@silicondust.com>
2003-07-01 16:14         ` Jafa
2003-07-01 17:59           ` Andrew Cagney
2003-07-01  5:00 Jafa
2003-07-01 12:45 ` Daniel Jacobowitz
2003-07-01 13:02 ` Andrew Cagney
2003-07-03  9:05   ` Paul N. Hilfinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).