Tracking obj-c messages with CW9

Tracking obj-c messages with CW9

Post by Eric VERGN » Fri, 08 Oct 2004 02:42:02


Hi,

I'm having problems with a msg sent by the system (namely when an item is
selected in a contextual menu run from a custom NSView in a dialog).

For whatever reason, my target/action is not being called when the item is
selected.

Anyone knows if there is a way to break on all obj-c messages so I can try
and find out what's happening ?

Eric
 
 
 

Tracking obj-c messages with CW9

Post by Sean McBri » Tue, 12 Oct 2004 05:57:52

In article <BD89FB0A.28ED9% XXXX@XXXXX.COM >,



Maybe break on objc_msg_send()?

 
 
 

Tracking obj-c messages with CW9

Post by Eric Alber » Tue, 12 Oct 2004 15:48:18

In article < XXXX@XXXXX.COM >,




That's objc_msgSend. :) And there's objc_msgSend_stret, too (messages
returning structs), plus objc_msgSendSuper, objc_msgSendSuper_stret,
objc_msgSendv, and objc_msgSendv_stret.

-Eric

--
Eric Albert XXXX@XXXXX.COM
http://www.yqcomputer.com/
 
 
 

Tracking obj-c messages with CW9

Post by Eric VERGN » Tue, 12 Oct 2004 16:38:56

dans l'article ejalbert-956D93.23481810102004@localhost, Eric Albert XXXX@XXXXX.COM a rit le 11/10/04 8:48


Not very useful, because I would then have to debug through assembly code.

What I'm looking for is the equivalent of Spy++ on Win32 which lets me view
all messages sent to any window.

Eric
 
 
 

Tracking obj-c messages with CW9

Post by Eric Alber » Wed, 13 Oct 2004 02:20:37

In article <BD900530.29345% XXXX@XXXXX.COM >,



> > Not very useful, because I would then have to debug through assembly code.> > > > What I'm looking for is the equivalent of Spy++ on Win32 which lets me view> > all messages sent to any window.

Obj-C messages aren't messages in the Win32 sense. Events are closer
there. There's no way to do what you're looking for. I've never had a
need for that in debugging on Mac OS X, though. There's almost
certainly an easier way to do whatever you're trying to do.

-Eric

--
Eric Albert XXXX@XXXXX.COM
http://www.yqcomputer.com/
 
 
 

Tracking obj-c messages with CW9

Post by Eric VERGN » Wed, 13 Oct 2004 07:12:32

dans l'article ejalbert-F6C21F.10203711102004@localhost, Eric Albert XXXX@XXXXX.COM a rit le 11/10/04 19:20
> > Obj-C messages aren't messages in the Win32 sense. Events are closer> > there.

I know that.
> > There's no way to do what you're looking for. I've never had a> > need for that in debugging on Mac OS X, though. There's almost> > certainly an easier way to do whatever you're trying to do.> >

Well I wouldn't have to do that if it weren't for that bug in MacOS. What
I'm trying to find out is who receives the message sent by a popup menu
called from a modal dialog, because then I could think of a workaround.

Right now the message is simply lost.

The problem is the following:

In the menuForEvent method of NSView subclass, I populate a menu. For each
item, I set the target to the view itself, and the action to a method called
menuAction:.

When run in non-modal, this works perfectly.

When run from a modal loop, the popup is displayed fine, but when I click on
an item, the method is not called.

I filed a bug at apple, but did not get any return yet. I have no
workaround, so right now, I just had to propose another input method.

If you can find a way to detect where the message is sent, I'm a customer.

Eric
 
 
 

Tracking obj-c messages with CW9

Post by Glenn Andr » Wed, 13 Oct 2004 08:01:10

In article <BD90D1F0.293FC% XXXX@XXXXX.COM >,


> dans l'article ejalbert-F6C21F.10203711102004@localhost, Eric Albert >> XXXX@XXXXX.COM a rit le 11/10/04 19:20> > > > > Obj-C messages aren't messages in the Win32 sense. Events are closer> > > there. > > > > I know that.> > > > > There's no way to do what you're looking for. I've never had a> > > need for that in debugging on Mac OS X, though. There's almost> > > certainly an easier way to do whatever you're trying to do.> > > > > > > Well I wouldn't have to do that if it weren't for that bug in MacOS. What> > I'm trying to find out is who receives the message sent by a popup menu> > called from a modal dialog, because then I could think of a workaround.> > > > Right now the message is simply lost.> > > > The problem is the following:> > > > In the menuForEvent method of NSView subclass, I populate a menu. For each> > item, I set the target to the view itself, and the action to a method called> > menuAction:.> > > > When run in non-modal, this works perfectly.> > > > When run from a modal loop, the popup is displayed fine, but when I click on> > an item, the method is not called.> > > > I filed a bug at apple, but did not get any return yet. I have no> > workaround, so right now, I just had to propose another input method.> > > > If you can find a way to detect where the message is sent, I'm a customer.> >

Try gandbu< < http://www.yqcomputer.com/ ;g>

You'll be able to trace specific messages (though it doesn't currently
show the parameters, just the receiver, and only for a specific class -
it was designed to dynamically simulate adding an "NSLog" to your
routine), as well as being able to better inspect the UI structure while
running.
 
 
 

Tracking obj-c messages with CW9

Post by Eric VERGN » Wed, 13 Oct 2004 09:35:11

dans l'article XXXX@XXXXX.COM , Glenn Andreas XXXX@XXXXX.COM a rit le 12/10/04 1:01
> > Try gandbu< < http://www.yqcomputer.com/ ;g>

Looks nice, but doesn't seem to work with CW. I managed to link, but when I
run my app, I get the following message:

2004-10-12 02:32:59.652 MyApp[2524] No path for com.gandreas.gandbugShell
2004-10-12 02:33:09.750 MyApp[2524] Nor for gandbugShell
2004-10-12 02:33:09.750 MyApp[2524] Can't enable gandbug - not found

What am I missing ?

Eric
 
 
 

Tracking obj-c messages with CW9

Post by Jim Correi » Wed, 13 Oct 2004 11:40:19

In article <BD90D1F0.293FC% XXXX@XXXXX.COM >,



This came up on the Cocoa mailing lists a couple of weeks ago.

< http://www.yqcomputer.com/ ;

Jim
 
 
 

Tracking obj-c messages with CW9

Post by Eric Alber » Wed, 13 Oct 2004 12:17:51

In article <BD90D1F0.293FC% XXXX@XXXXX.COM >,


> > > There's no way to do what you're looking for. I've never had a> > > need for that in debugging on Mac OS X, though. There's almost> > > certainly an easier way to do whatever you're trying to do.
> > Well I wouldn't have to do that if it weren't for that bug in MacOS. What> > I'm trying to find out is who receives the message sent by a popup menu> > called from a modal dialog, because then I could think of a workaround.> > > > Right now the message is simply lost.

Sounds like Jim might've answered your question, but if not, simply
break on your method in question and step instruction by instruction
through objc_msgSend until you figure out which object receives the
message.

-Eric

--
Eric Albert XXXX@XXXXX.COM
http://www.yqcomputer.com/
 
 
 

Tracking obj-c messages with CW9

Post by Eric VERGN » Wed, 13 Oct 2004 19:56:32

dans l'article nuHad.350334$mD.283757@attbi_s02, Jim Correia XXXX@XXXXX.COM a rit le 12/10/04 4:40


THANK YOU !!!!

And special thanks to Sasha for his digging of what appears to be, at the
least, a huge documentation bug.

Eric
 
 
 

Tracking obj-c messages with CW9

Post by Glenn Andr » Wed, 13 Oct 2004 23:23:29

In article <BD90F35F.29415% XXXX@XXXXX.COM >,


> dans l'article XXXX@XXXXX.COM , Glenn Andreas >> XXXX@XXXXX.COM a rit le 12/10/04 1:01> > > > > Try gandbu< < http://www.yqcomputer.com/ ;g>> > > > Looks nice, but doesn't seem to work with CW. I managed to link, but when I> > run my app, I get the following message:> > > > 2004-10-12 02:32:59.652 MyApp[2524] No path for com.gandreas.gandbugShell> > 2004-10-12 02:33:09.750 MyApp[2524] Nor for gandbugShell> > 2004-10-12 02:33:09.750 MyApp[2524] Can't enable gandbug - not found> > > > What am I missing ?> > > > Eric> >

Try manually launching the shell program first - as of some security
release, launch services won't find things that the user hasn't
explicitly launched first. (The stub you linked in just finds that, and
then loads the bundle from there)