This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Step over Objective-C dispatch function


+      /* 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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]