This is the mail archive of the gdb-prs@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]

objc/1058: [PATCH] Step over Objective-C dispatch function


>Number:         1058
>Category:       objc
>Synopsis:       [PATCH] Step over Objective-C dispatch function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          patch
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 13 03:58:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     fedor@doc.com
>Release:        2003-02-13-cvs
>Organization:
>Environment:

>Description:

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="msg00829.txt"
Content-Disposition: inline; filename="msg00829.txt"

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

------------------------------------------------------------------------
Index Nav: [Date Index <index.html#00829>] [Subject Index
<subjects.html#00829>] [Author Index <authors.html#00829>] [Thread Index
<threads.html#00829>]
Message Nav: [Date Prev <msg00828.html>] [Date Next <msg00830.html>]
[Thread Prev <msg00828.html>] [Thread Next <msg00054.html>]
Other format: [Raw text
</cgi-bin/get-raw-msg?listname=gdb-patches&date=2003-01&msgid=3E39F35A.9050208@doc.com>]



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

    * /From/: Adam Fedor <fedor at doc dot com>
    * /To/: Andrew Cagney <ac131313 at redhat dot com>
    * /Cc/: Michael Snyder <msnyder at redhat dot com>, GDB Patches
      <gdb-patches at sources dot redhat dot com>
    * /Date/: Thu, 30 Jan 2003 20:54:02 -0700
    * /Subject/: Re: [PATCH] Step over Objective-C dispatch function
    * /References/: <3E1504FF.2070506@doc.com <msg00050.html>>
      <3E39E4F3.E7865684@redhat.com <msg00825.html>>
      <3E39E86E.9060700@redhat.com <msg00826.html>>

------------------------------------------------------------------------


Andrew Cagney wrote:


    > + /* Step over Objective-C dispatch function. */

    Following on from michael's comment, this needs a detailed
    description of what is happening here.

I split this into separate patches (second patch to follow), although
perhaps that might be to trivial. Here's an update of the first patch:


2003-01-30  Adam Fedor  <fedor@gnu.org>

	* infrun.c (handle_inferior_event): Step through
	Objective-C dispatch function to method function (if found).
	* Makefile.in (infrun.o): Add $(objc_lang_h)

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.302
diff -u -p -r1.302 Makefile.in
--- Makefile.in 2 Jan 2003 20:29:15 -0000       1.302
+++ Makefile.in 3 Jan 2003 03:24:54 -0000
@@ -1795,7 +1796,8 @@ infptrace.o: infptrace.c $(defs_h) $(fra
 infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
        $(inferior_h) $(breakpoint_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) \
        $(cli_script_h) $(target_h) $(gdbthread_h) $(annotate_h) \
-       $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h)
+       $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) \
+       $(objc_lang_h)
 inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
        $(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h)
 infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.95
diff -u -p -r1.95 infrun.c
--- infrun.c	19 Jan 2003 17:39:16 -0000	1.95
+++ infrun.c	31 Jan 2003 03:40:37 -0000
@@ -42,6 +42,7 @@
 #include "inf-loop.h"
 #include "regcache.h"
 #include "value.h"
+#include "objc-lang.h"
 
 /* Prototypes for local functions */
 
@@ -2430,6 +2431,32 @@ process_event_stop_test:
 	    }
 	}
 
+      /* 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;
+	  }
+      }
+
       /* If we have line number information for the function we
          are thinking of stepping into, step into it.
 

------------------------------------------------------------------------

    * *References*:
          o *[PATCH] Step over Objective-C dispatch function
            <msg00050.html>*
          + /From:/ Adam Fedor
          o *Re: [PATCH] Step over Objective-C dispatch function
            <msg00825.html>*
          + /From:/ Michael Snyder
          o *Re: [PATCH] Step over Objective-C dispatch function
            <msg00826.html>*
          + /From:/ Andrew Cagney

Index Nav: [Date Index <index.html#00829>] [Subject Index
<subjects.html#00829>] [Author Index <authors.html#00829>] [Thread Index
<threads.html#00829>]
Message Nav: [Date Prev <msg00828.html>] [Date Next <msg00830.html>]
[Thread Prev <msg00828.html>] [Thread Next <msg00054.html>]


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