Thread: [Pyobjc-dev] instrumentObjcMessageSends
Brought to you by:
ronaldoussoren
|
From: Jon C. <jon...@gm...> - 2008-01-06 20:21:15
|
Many apologies if this is the wrong place to ask this question, but I couldn't find anywhere else. I'd like to call the instrumentObjcMessageSends(YES) function which is part of the objc runtime so that I can log all objc-messages, but I can't figure out how to access it from python. This function has the same effect as NSObjCMessageLoggingEnabled=TRUE (see http://developer.apple.com/technotes/tn2004/tn2124.html) I can create and call objc classes, but instrumentObjcMessageSends is a free function. I'd appreciate any pointers as to how to call this function, or runtime free functions in general, for that matter. Thanks, Jon BTW, the all the links from the sourceforge examples page http://pyobjc.sourceforge.net/examples/index.php are broken. |
|
From: Ronald O. <ron...@ma...> - 2008-01-07 07:10:51
Attachments:
smime.p7s
|
On 6 Jan, 2008, at 21:21, Jon Christopher wrote: > Many apologies if this is the wrong place to ask this question, but I > couldn't find anywhere else. > > I'd like to call the instrumentObjcMessageSends(YES) function which > is part of the objc runtime so that I can log all objc-messages, but I > can't figure out how to access it from python. > This function has the same effect as NSObjCMessageLoggingEnabled=TRUE > (see http://developer.apple.com/technotes/tn2004/tn2124.html) > > I can create and call objc classes, but instrumentObjcMessageSends is > a free function. I'd appreciate any pointers as to how to call this > function, or runtime free functions in general, for that matter. You cannot easily call runtime functions. Because instrumentObjcMessageSends isn't a public API I won't add it to PyObjC. It should be possible to call it using objc.loadBundleFunctions, but I don't have time to look into that right now. Ronald > > > Thanks, > Jon > > BTW, the all the links from the sourceforge examples page > http://pyobjc.sourceforge.net/examples/index.php are broken. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
|
From: Michael M. <mic...@gm...> - 2008-01-07 23:09:15
|
On Jan 6, 2008 11:10 PM, Ronald Oussoren <ron...@ma...> wrote: > > On 6 Jan, 2008, at 21:21, Jon Christopher wrote: > > > Many apologies if this is the wrong place to ask this question, but I > > couldn't find anywhere else. > > > > I'd like to call the instrumentObjcMessageSends(YES) function which > > is part of the objc runtime so that I can log all objc-messages, but I > > can't figure out how to access it from python. > > This function has the same effect as NSObjCMessageLoggingEnabled=TRUE > > (see http://developer.apple.com/technotes/tn2004/tn2124.html) > > > > I can create and call objc classes, but instrumentObjcMessageSends is > > a free function. I'd appreciate any pointers as to how to call this > > function, or runtime free functions in general, for that matter. > > You cannot easily call runtime functions. Because > instrumentObjcMessageSends isn't a public API I won't add it to PyObjC. > > It should be possible to call it using objc.loadBundleFunctions, but I > don't have time to look into that right now. > Wouldn't it be possible to just wrap that function with a C extension module? Or if you really want every message send, just add it to your main.m? -mike (PS, sorry Ronald for the accidental double-reply.) -- Michael McCracken UCSD CSE PhD Candidate research: http://www.cse.ucsd.edu/~mmccrack/ misc: http://michael-mccracken.net/wp/ |
|
From: Ronald O. <ron...@ma...> - 2008-01-08 06:45:45
Attachments:
smime.p7s
|
On 8 Jan, 2008, at 0:09, Michael McCracken wrote: > On Jan 6, 2008 11:10 PM, Ronald Oussoren <ron...@ma...> > wrote: >> >> On 6 Jan, 2008, at 21:21, Jon Christopher wrote: >> >>> Many apologies if this is the wrong place to ask this question, >>> but I >>> couldn't find anywhere else. >>> >>> I'd like to call the instrumentObjcMessageSends(YES) function which >>> is part of the objc runtime so that I can log all objc-messages, >>> but I >>> can't figure out how to access it from python. >>> This function has the same effect as >>> NSObjCMessageLoggingEnabled=TRUE >>> (see http://developer.apple.com/technotes/tn2004/tn2124.html) >>> >>> I can create and call objc classes, but instrumentObjcMessageSends >>> is >>> a free function. I'd appreciate any pointers as to how to call this >>> function, or runtime free functions in general, for that matter. >> >> You cannot easily call runtime functions. Because >> instrumentObjcMessageSends isn't a public API I won't add it to >> PyObjC. >> >> It should be possible to call it using objc.loadBundleFunctions, >> but I >> don't have time to look into that right now. >> > > Wouldn't it be possible to just wrap that function with a C > extension module? > > Or if you really want every message send, just add it to your main.m? That's also possible. This should do the trick for calling it in pure python: import objc import Foundation objc.loadBundleFunctions(Foundation.__bundle__, globals(), [ ('instrumentObjcMessageSends', objc._C_VOID + objc._C_NSBOOL), ]) Then use 'instrumentObjcMessageSends(1)' to enable logging. This assumes the prototype for the function is 'void instrumentObjcMessageSends(BOOL)'. I've tried this without getting a possitive result though. According to <http://lists.apple.com/archives/darwin-dev/2005/Jul/msg00027.html> you have to call another function as well, which has a callback function to perform the actual logging. I guess it would be easier to just implement this is a small C extension after all. Ronald |