Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show proper error message from libimobiledevice #141

Open
Noisyfox opened this issue Aug 10, 2021 · 3 comments
Open

Show proper error message from libimobiledevice #141

Noisyfox opened this issue Aug 10, 2021 · 3 comments

Comments

@Noisyfox
Copy link
Member

Currently when something goes wrong in libimobiledevice, it simply print out a generic error message like

Failed to get debug server (debug_server_error_t returned -256)

It will be better to show the error detail from libimobiledevice.

@Noisyfox Noisyfox added this to the 1.9.0 milestone Aug 10, 2021
@Noisyfox Noisyfox self-assigned this Aug 10, 2021
@Noisyfox Noisyfox added this to To do in MOE Aug 10, 2021
@Berstanio
Copy link

Berstanio commented Aug 10, 2021

I had a small look into it and I think there are theoretical just a few things to tweak.

  1. Add the --enable-debug flag as option to the autogen.sh script.

https://github.com/multi-os-engine/moe-prebuilts/blob/moe-master/external/libimobiledevice/libimobiledevice/moe-prebuild-macos.sh#L26-L36

  1. Set a few variables like here (I think only "idevice_set_debug_level" is needed):

https://github.com/libimobiledevice/libimobiledevice/blob/master/tools/idevicedebugserverproxy.c#L205-L209

But then everything will be written in stderr and therefor will be always logged into the console I think. But this would be extremly spamming and annoying. The only fix/workaround I see here is to edit the following lines to print to a specific file.
https://github.com/multi-os-engine/libimobiledevice/blob/f1f05dcc9db7e3132e2b6da4a09e4d87394f1dcc/common/debug.c#L68-L73
Then, on error, read the file and print the content of the file? But this seems a bit complicated and not clean. Am I missing something?

https://github.com/libimobiledevice/libimobiledevice/blob/master/common/debug.c#L78-L96

//EDIT: Why isn't it previewing the lines of code? Does this only work in the same repo?

@Noisyfox
Copy link
Member Author

Noisyfox commented Aug 11, 2021

I don't think these debugging output provides any useful information though... Most of the debug outputs are simply just "xxx bytes sent/received", but doesn't really tell you the actual error and how to resolve it.

@Berstanio
Copy link

I would partially agree. Yes, most of the debug output isn't really useful, but sometimes I think it provides relevant information.
e.g.: https://github.com/libimobiledevice/libimobiledevice/blob/master/src/idevice.c (nearly every error gets mapped to just "IDEVICE_E_UNKNOWN_ERROR")
or
https://github.com/libimobiledevice/libimobiledevice/blob/master/src/lockdown.c#L756-L768

Also the more useless debug logs can help to search for others having the same error (see e.g. idevice above). But I would agree that it is really just a low priority feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do
MOE
To do
Development

No branches or pull requests

2 participants