views:

93

answers:

1

I need to add a few methods to an already identified class in a closed source application. Using f-script anwywhere and gdb I know what I need to interact with to acheive my goals.

However I am struggling to find a solution to allow me to inject some code (preferably objective-c) into the running application.

For the time being I would be quite happy to just inject the code via gdb and manually start the code as I just recently upgraded to Snow leopard and are aware of issues with SIMBL.

Are there any basic guides on getting started with this? I fail to find anything really useful from googling around.

I think I need to create an application bundle (never done this before so this in itself is a challenge) and use GDB to load into the application. Once this is done I beleive I can then call my bundles code from GDB.

Basically I think I need some hints on creating the bundle and the subsequent loading via GDB. Any simple examples of loading a class/object into an application (maybe simply a hello world should suit) would be very much appreciated.

I may also be misguided with the focus on bundles?

Thanks,

A: 

Use the environment variable DYLD_INSERT_LIBRARIES to load (plain old dynamic) libraries before loading the main executable. See man dyld.

Mike Ash has a nice article about easy code injection using gdb.

Nikolai Ruhe
Thanks, will check it out. I had forgotten about dyld
J T