Coder Social home page Coder Social logo

Support iOS 7 / lldb about ios-deploy HOT 32 CLOSED

shazron avatar shazron commented on May 23, 2024
Support iOS 7 / lldb

from ios-deploy.

Comments (32)

shazron avatar shazron commented on May 23, 2024

https://github.com/trigger-corp/fruitstrap/commit/d2378b8d4d3634bcfd29df9999dcc7d5ace77673

patch: https://gist.github.com/shazron/6517269

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Note that the patch does not apply cleanly, it will have to be manually patched.

from ios-deploy.

SteveAR avatar SteveAR commented on May 23, 2024

Using your patch I managed to get lldb to execute, but I'm stuck here:

[100%] Connecting to remote debug server
-------------------------
run
(lldb) run
Traceback (most recent call last):
  File "/private/tmp/fruitstrap.py", line 7, in __lldb_init_module
    lldb.target.modules[0].SetPlatformFileSpec(lldb.SBFileSpec(device_app))
IndexError: list index out of range
error: the platform is not currently connected

Any pointers to what I might miss?

from ios-deploy.

hcrowell avatar hcrowell commented on May 23, 2024

I'm seeing this error too. Anyone know how to resolve it?

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Not sure guys, will have to debug the python code :/ (lldb.target.modules is probably null here).

Also, a further patch: https://github.com/trigger-corp/fruitstrap/commit/04121e5351669f3c977857795143c04123f1a02f

from ios-deploy.

eternallam avatar eternallam commented on May 23, 2024

I'm getting the following error:

(lldb) run
Executing commands in '/tmp/fruitstrap-lldb-prep-cmds'.
(lldb) script fruitstrap_device_app="/private/var/mobile/Applications/5E125D7F-C63C-4FF3-839F-58AF60ADA9CF/MyApp.app"
(lldb) script fruitstrap_connect_url="connect://127.0.0.1:12345"
(lldb) platform select remote-ios
Platform: remote-ios
Connected: no
SDK Path: error: unable to locate SDK
(lldb) target create "/path/MyApp.app"
Current executable set to '/path/MyApp.app' (armv7).
(lldb) #settings set target.process.extra-startup-command "QSetLogging:bitmask=LOG_ALL;"
(lldb) command script import "/tmp/fruitstrap.py"
error: Aborting reading of commands after command #5: ' command script import "/tmp/fruitstrap.py"' failed with error: module importing failed: Python error raised while importing module: ('expected an indented block', ('/private/tmp/fruitstrap.py', 5, 10, "device_app=internal_dict['fruitstrap_device_app']\n")) - traceback: File "temp.py", line 1, in
error: the platform is not currently connected

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Can those on this thread check their lldb version? I have a strong suspicion that the lldb support wasn't tested on the lldb that came with Xcode 5. Not sure if the lldb interfaces would have changed in the interim...

lldb --version

On Xcode 5 GM, the lldb version I get is lldb-300.2.47
On Xcode 4.6.3 (I tested on a VM) I get the version as LLDB-179.5

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

I downloaded and ran trigger-corp's fruitstrap, and ran into the same "IndexError: list index out of range" error, so it looks more likely to be an lldb usage issue.

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

@eternallam check out my branch referenced above, then we can be on the same page.

from ios-deploy.

hcrowell avatar hcrowell commented on May 23, 2024

@shazron Thanks for looking into this.
I also saw this error in my lldb version, which is lldb-300.5.46

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Confirmed: it only works on Xcode 4's lldb: https://github.com/trigger-corp/fruitstrap/commit/d2378b8d4d3634bcfd29df9999dcc7d5ace77673#commitcomment-4136852

from ios-deploy.

eternallam avatar eternallam commented on May 23, 2024

@shazron Thanks, now I'm seeing the same error you guys are getting.

lldb --version
lldb-300.5.46

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

More clues, I ran the .py scripts line by line:

$ lldb
(lldb) script fruitstrap_device_app="/private/var/mobile/Applications/8CDB95DC-4153-4897-90A4-B9CADCC0891C/InputTest.app"
(lldb) script fruitstrap_connect_url="connect://127.0.0.1:12345"
(lldb) platform select remote-ios
  Platform: remote-ios
 Connected: no
  SDK Path: error: unable to locate SDK

from ios-deploy.

hcrowell avatar hcrowell commented on May 23, 2024

I attempted to resolve the SDK Path error by replacing line 31 in fruitstrap.c:
from:
platform select remote-ios
to: (on one line)
platform select remote-ios --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*\n\

I verified in the lldb.log and found the 'unable to locate SDK' error seemed to be resolved by this attempt:

// lldb.log snippet

SBCommandReturnObject(0x7fdccb827880)::GetOutput () => "Executing commands in '/tmp/fruitstrap-lldb-prep-cmds'.
(lldb) script fruitstrap_device_app="/private/var/mobile/Applications/KIF.app"
(lldb) script fruitstrap_connect_url="connect://127.0.0.1:12345"
(lldb) platform select remote-ios --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*
Platform: remote-ios
Connected: no
SDK Path: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*"
(lldb) target create "/tmp/build/KIF.app"
Current executable set to '/tmp/build/KIF.app' (armv7).
(lldb) #settings set target.process.extra-startup-command "QSetLogging:bitmask=LOG_ALL;"
(lldb) command script import "/tmp/fruitstrap.py"
"

Maybe this will help?

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

@hcrowell no dice :/

from ios-deploy.

hcrowell avatar hcrowell commented on May 23, 2024

@shazron aww :( i'm not sure how to resolve this

from ios-deploy.

thefbiman avatar thefbiman commented on May 23, 2024

Hi there,

Managed to get over the list index out of range using this modified order in prep cmds:

platform select remote-ios --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*\n
target create "{disk_app}"\n
script fruitstrap_device_app="{device_app}"\n
script fruitstrap_connect_url="connect://127.0.0.1:12345"\n\

But, am now blocked at launch time, as i get "a process is already being debugged" when calling lldb.target.Launch(lldb.SBLaunchInfo(None),error). Nothing is launched...

any help would be appreciated.

from ios-deploy.

SteveAR avatar SteveAR commented on May 23, 2024

we ended up using the new XCTest framework for now. It can also be used to build and install an app on a device.

from ios-deploy.

thefbiman avatar thefbiman commented on May 23, 2024

I will still use fruitstrap as i need some features that comes with it. So, here it goes.

Managed to work over the "a process is already being debugged" issue, was caused by remaining lldb & python processes.

Also, added command line parameters that were actually missing from the patch above.

You need to add the following:

#define LLDB_FRUITSTRAP_MODULE CFSTR(
...
def fsrun_command(debugger, command, result, internal_dict):\n
error=lldb.SBError()\n
lldb.target.Launch(lldb.SBLaunchInfo(['{args}']),error)\n
print str(error)\n
")
...
void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
...
if (args) {
CFStringRef cf_args = CFStringCreateWithCString(NULL, args, kCFStringEncodingASCII);
CFStringFindAndReplace(cmds, CFSTR("{args}"), cf_args, range, 0);
#if USE_LLDB
//format the arguments 'arg1 arg2 ....' to an argument list ['arg1', 'arg2', ...]
pmodule = CFStringCreateMutableCopy(NULL, 0, LLDB_FRUITSTRAP_MODULE);
CFMutableStringRef argsListLLDB = CFStringCreateMutableCopy(NULL, 0, cf_args);
CFRange rangeLLDB = { 0, CFStringGetLength(argsListLLDB) };
CFStringFindAndReplace(argsListLLDB, CFSTR(" "), CFSTR(" "), rangeLLDB, 0);//remove multiple spaces
rangeLLDB.length = CFStringGetLength(argsListLLDB);
CFStringFindAndReplace(argsListLLDB, CFSTR(" "), CFSTR("', '"), rangeLLDB, 0);
rangeLLDB.length = CFStringGetLength(pmodule);

    CFStringFindAndReplace(pmodule, CFSTR("{args}"), argsListLLDB, rangeLLDB, 0);   

#endif//USE_LLDB

Hope this helps others.

Also, i still have one issue: lldb takes a long time to launch. From the time i get " Process 0 connected" and "(lldb) run" to the time the applications actually starts working, it takes around 1-2 mins. Notice that in this time i get the application displayed on the device, but not updating.
This seams to be cause by didFinishLaunching which is received only after those about 1-2 mins. Any idea about this?

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

thanks@thefbiman! will get this integrated. Will work through the issues incrementally I suppose...

from ios-deploy.

markusjura avatar markusjura commented on May 23, 2024

Thanks to @thefbiman. This trick worked yesterday for me as well. However, today the app is not starting on the device anymore.

lldb is executing:
(lldb) run
Process 0 connected

Yesterday, when it was working, it was executing it in the following order:
Process 0 connected
(lldb) run

Any idea how to solve this?

Yesterday, when it was still working, I also faced the problem that loading takes 1 min. before the app has been launched on the device. Any idea how to solve that?

from ios-deploy.

markusjura avatar markusjura commented on May 23, 2024

The issue 'working yesterday, but not today' was related that I still had python and lldb processes running. Problem was solved by killing these.

Still interested how to decrease the loading time.

from ios-deploy.

eternallam avatar eternallam commented on May 23, 2024

Would also like to figure out how to better end the lldb process after the app finishes running. I know this is related to the sleep timer however I would like the process to automatically quit back to the command line after the process has finished.

from ios-deploy.

thefbiman avatar thefbiman commented on May 23, 2024

Hello there,
For now, to eliminate the huge loading time, i use the gdb version with a little trick, injected gdb server inside xcode5 app:

  • Look for content\developer\platforms\iphoneos.platform\developer\usr\libexec, on xcode5 you only have 1 folder there, as.
  • You need to copy gdb folder from xcode4.X app and place it near the as folder in xcode5.
  • chmod 777 on the included binary from that folder so it can execute.
    This is a tempo fix for use till we figure out why that big launch delay with lldb.

from ios-deploy.

micmarcil avatar micmarcil commented on May 23, 2024

When I launch the following :
./fruitstrap debug --bundle "my_app"

It stucks on "Use 'run' to start the app.".
I have to type the 'run' manually, which is not cool for automated process :(

Any way to inject the 'run' automatically ?

Thanks

from ios-deploy.

eternallam avatar eternallam commented on May 23, 2024

@micmarcil The run command is automatically injected. Take a look at line 20 of the source.

Has anyone else been able to make further headway on this issue? Currently looking for a way to automatically end lldb after the process has finish running. In addition removing the delay would be a great help.

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

I just tried out this fruitstrap fork, and it works with lldb: https://github.com/markusjura/fruitstrap
(note when I tested on a new project, it took about a minute for an app to fully load through the debugger)

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Version 1.0.4 published with lldb support.

from ios-deploy.

halfnelson avatar halfnelson commented on May 23, 2024

on xcode 4.7 running ios-deploy 1.0.4 latest i am getting:

(lldb) run
error: invalid target, create a debug target using the 'target create' command
(lldb)

from ios-deploy.

tcab avatar tcab commented on May 23, 2024

I also get this error
(lldb) run
error: invalid target, create a debug target using the 'target create' command
(lldb)
at the end of my command

phonegap run ios

which used to work fine, till I upgraded xcode to 5.1 and phonegap to 3.4.0-0.19.8

P.S. And phonegap now spits out pages of information when I run that command - it used to be silent.

from ios-deploy.

shazron avatar shazron commented on May 23, 2024

Try the newly released 1.0.5

from ios-deploy.

markusv avatar markusv commented on May 23, 2024

Hi,

I have this problem to. Would love a solution for this.

Cheers
Markus

from ios-deploy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.