Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Adam Fedor <fedor@doc.com>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [PATCH] Step over Objective-C dispatch function
Date: Thu, 20 Mar 2003 21:08:00 -0000	[thread overview]
Message-ID: <3E7A2DCA.6050205@redhat.com> (raw)
In-Reply-To: <3E39F35A.9050208@doc.com>

> +      /* Determine if we are currently in the Objective-C dispatch
> +         function.  If so, get the address of the method function that
> +         the dispatcher would call and use that as the function to
> +         step into instead. Also skip over the trampoline for the
> +         function (if any).  This is better for the user since they
> +         are only interested in stepping into the method function
> +         anyway.  */
> +      {
> +	CORE_ADDR method_stop_pc;
> +	
> +	if (real_stop_pc)
> +	  find_objc_msgcall (real_stop_pc, &method_stop_pc);
> +	else
> +	  find_objc_msgcall (stop_pc, &method_stop_pc);
> +	
> +	if (method_stop_pc)
> +	  ecs->stop_func_start = method_stop_pc;
> +	
> +	if (method_stop_pc)
> +	  {
> +	    real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc);
> +	    if (real_stop_pc != 0)
> +	      ecs->stop_func_start = real_stop_pc;
> +	  }
> +      }
> +

Adam,

Seems you were waiting on me here :-(

I've looked at what the underlying code is trying to do and, 
unfortunatly, the original objc-lang.c botched its portability(1), sigh! 
  The file is currently native only so infrun.c can't directly refer to 
objc-lang.c, and hence, will need to go via a dispatch table.  Going via 
a dispatch table wouldn't hurt anyway.

Can you please do things as sketched out below.

- append to "language.h":struct language_defn the method:

	/* If PC is possibly an unknown languages trampoline.
	   If that PC falls in a trampoline belonging to this language,
	   return the address of the first pc in the real function, or 0
	   if it isn't a language tramp for this language.  */
	CORE_ADDR (*skip_trampoline) (CORE_ADDR pc);

- add to "language.h" the global method:

	CORE_ADDR skip_language_trampoline (CORE_ADDR pc);

the implementation iterates through all registered languages looking for 
and calling any non-NULL struct language_defn.skip_trampoline() 
functions.  Returning the result from the first that returns non-zero, 
or 0 if all `fail'.

- add to objc-lang.c, a language specific objc_skip_trampoline() that 
implements the above

- just confirm that the objc_skip_trampoline() only does target side 
accesses (memory/register read/write) after it's confirmed that there is 
a valid objc symbol.  No valid objc symbol, no target access.

- for infrun.c, before the existing SKIP_TRAMPOLINE() call, make a call 
to skip_language_trampoline() and then, only if that `fails', try the 
SKIP_TRAMPOLINE() method.

The intent of all this is to make it possible to at leat enable objc on 
selective natives, and then over time make it more portable.

Andrew

(1) I noticed that the parameter extract methods assume host=target.



  reply	other threads:[~2003-03-20 21:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03  3:35 Adam Fedor
2003-01-31  2:52 ` Michael Snyder
2003-01-31  3:07   ` Andrew Cagney
2003-01-31  3:54     ` Adam Fedor
2003-03-20 21:08       ` Andrew Cagney [this message]
2003-03-25 15:56         ` Adam Fedor
2003-03-25 16:25           ` Andrew Cagney
2003-03-25 16:41             ` 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=3E7A2DCA.6050205@redhat.com \
    --to=ac131313@redhat.com \
    --cc=fedor@doc.com \
    --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