-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
runtime: panic() is not printed in LogCat on android #9398
Comments
Do you use the Dockerfile in the repo? 2014-12-19 9:50 GMT-05:00 Hunter Leath notifications@github.com:
__ |
Certainly. I've rebuilt a couple of times with Additionally, I attempted to work around this issue by adding
To the top of my function, to no avail. Strangely, still nothing prints out at all. |
Quickest way to test that there isn't something wrong with your go installation is to run: docker run mobile /bin/bash -c 'ls /go/src/runtime/print1*' If you are synced after the printing CL, you should see /go/src/runtime/print1.go Other than that, you can also try adding log.Print("test message") above your panic. The Go log package has an entirely different set of hooks for printing output. Also, I presume there is more to your Go program than the snippet you pasted. Could you show us the rest of your main function? |
So, two interesting developments. The original problem that had me going down this direction was fixed by simply My main function is something like this with the panic. Since I commented out the other code, I assume this is the important part.
Updating the mobile repository certainly fixed the issue with defer-recover, and it now prints panics to stdout. The bare panic, however, doesn't print to logcat. I have confirmed that Additionally, |
My attempt to replicate this failed. Could you provide a complete small program that demonstrates the problem? |
It's very likely that I'm just setup incorrectly somehow. If you are unable to reproduce it using a Lollipop device, then I wouldn't worry about it. The code I was trying it with did, in fact, just have a |
I don't know what's Run(.) function, but based on the log from your first report (triggering go/Seq logs), I guess the following modification to example/libhello/hi/hi.go is something similar to what you have, right? If so, I will test it with a Lollipop device later today. diff --git a/example/libhello/hi/hi.go b/example/libhello/hi/hi.go func Hello(name string) {
FYI adb logcat from 4.4.4 nexus 7: https://gist.github.com/hyangah/0b1225eb3b164096ef87 It includes the panic log. |
That would effectively sum up what I was attempting. Do let me know what happens with the Lollipop device, and feel free to close if everything works correctly. |
I could reproduce the problem with Nexus 7 running android version 5.0.1. |
Based on the recent ndk's logging (https://android.googlesource.com/platform/system/core/+/master/liblog/logd_write.c), I guess logs need to be sent through /dev/socket/logdw (unix domain socket). The runtime at tip directly writes logs or print messages to /dev/log/main (https://go.googlesource.com/go/+/master/src/runtime/print1_write_android.go) Otherwise, we need to make runtime use /dev/socket/logdw. I don't know android enough to know if it's backwards compatible. |
What version of go are you running?
devel
, definitely after bee8ae1.What OS and ARCH?
Compiling for Android/Arm.
What did you do?
Create a go program that looks like this:
What did you expect to happen?
The program exits with "Hello, world." printed to the log (viewable in
logcat
).What happened?
Logcat reports nothing, as below:
Then restarts the application multiple times.
The text was updated successfully, but these errors were encountered: