android-gdbutils
android-gdbutils copied to clipboard
ImportError - Symbol not found: __PyCodecInfo_GetIncrementalDecoder
I got an import error while trying to use jimdb to debug Fennec on Macbook Pro (macOS version: 10.13.6),
0:02.90 /Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/bin/gdb -q --args Traceback (most recent call last): File "
", line 1, in File "/Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/utils/python/feninit.py", line 7, in import os, sys, subprocess, threading, time, shlex, tempfile, pipes, shutil, re File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in import io as _io File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in import _io ImportError: dlopen(/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder Referenced from: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so Expected in: flat namespace in /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so /Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/bin/../utils/gdbinit:8: Error in sourced command file: Error while executing Python code. : No such file or directory. Traceback (most recent call last): File " ", line 3, in File "third_party/python/gdbpp/gdbpp/init.py", line 8, in import gdb.printing ImportError: No module named printing .gdbinit:190: Error in sourced command file: gdbpp:5: Error in sourced command file: Error while executing Python code. (gdb)
The "No module named printing" error can be fixed [1]. Not sure about the "Symbol not found" error.
[1] https://wiki.mozilla.org/Mobile/Fennec/Android/GDB#.22No_module_named_printing.22_when_debugging_Fennec_with_JimDB
The "No module named printing" error can be fixed [1]. Not sure about the "Symbol not found" error. [1] https://wiki.mozilla.org/Mobile/Fennec/Android/GDB#.22No_module_named_printing.22_when_debugging_Fennec_with_JimDB
This can fix "No module named printing" error, but "Symbol not found" error still happen :(
ImportError: dlopen(/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder Referenced from: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Okay, I found that it is because I have python@2 installed on my mac. After removing it, I didn't see this error.
But I got another error,
ennec GDB utilities (see utils/gdbinit and utils/gdbinit.local on how to configure settings)
- Debug Fennec (default)
- Debug Fennec with env vars and args
- Debug using jdb
- Debug content Mochitest
- Debug compiled-code unit test
- Debug Fennec with pid
- Debug another package Enter option from above: 1
New ADB device is "FA8261E00803" Using device FA8261E00803 Using object directory: /Users/edgarchen/Workspace/mercurial/mozilla-central_android/objdir-droid app process name: app_process32 Set sysroot to "/Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/lib/FA8261E00803". Updated solib-search-path. Ignoring BHM signal. Using package org.mozilla.fennec_edgarchen. Package org.mozilla.fennec_edgarchen does not seem to exist. Reinstall apk? [yes/no]: no
Launching org.mozilla.fennec_edgarchen... Done Attaching to pid 24252... as non-root... in pkg dir... as root... in pkg dir... using intent... /Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/bin/../utils/gdbinit:141: Error in sourced command > file: adb returned exit code 255 for arguments ['shell', 'am', 'start', '-W', '-n', 'org.mozilla.fennec_edgarchen/org.mozilla.gecko.BrowserApp', '-a', 'org.mozilla.gecko.DEBUG', '--es', 'gdbserver', '--once --attach :0 24252'] : No such file or directory. .gdbinit:190: Error in sourced command file: cal/bin/python:1: Error in sourced command file: Undefined command: "". Try "help". (gdb)
And I got "java.lang.IllegalArgumentException: Unknown option: --attach" if I enter the adb command manually, adb shell am start -W -n org.mozilla.fennec_edgarchen/org.mozilla.gecko.BrowserApp -a org.mozilla.gecko.DEBUG --es gdbserver --once --attach :0 24252
edgarchen:mozilla-central_android/ $ adb shell am start -W -n org.mozilla.fennec_edgarchen/org.mozilla.gecko.BrowserApp -a org.mozilla.gecko.DEBUG --es gdbserver --once --attach :0 24252 [11:15:18]
Exception occurred while executing: java.lang.IllegalArgumentException: Unknown option: --attach at android.content.Intent.parseCommandArgs(Intent.java:6535) at com.android.server.am.ActivityManagerShellCommand.makeIntent(ActivityManagerShellCommand.java:276) at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:324) at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:141) at android.os.ShellCommand.exec(ShellCommand.java:96) at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:15499) at android.os.Binder.shellCommand(Binder.java:573) at android.os.Binder.onTransact(Binder.java:473) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4280) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3076) at android.os.Binder.execTransact(Binder.java:682)
I guess it is because of the Android version? I am using Android 8.0 now.
After removing --once
, I did not see the unknown option error, but I got a permission error instead,
.... Launching org.mozilla.fennec_edgarchen... Done Attaching to pid 7605... as non-root... in pkg dir... as root... in pkg dir... using intent... "gdbserver" output: Cannot attach to lwp 7605: Operation not permitted (1) Exiting "run-as" output: run-as: exec failed for /data/local/tmp/gdbserver: Permission denied "run-as pkg" output: Can't open socket: Permission denied. Exiting "su -c" output: /system/bin/sh: su: not found "su -c pkg" output: /system/bin/sh: su: not found "am start" output: --------- beginning of main --------- beginning of system /Users/edgarchen/.mozbuild/android-device/jimdb-arm-pie/bin/../utils/gdbinit:141: Error in sourced command file: failed to run gdbserver : No such file or directory. .gdbinit:190: Error in sourced command file: cal/bin/python:1: Error in sourced command file: Undefined command: "". Try "help". (gdb)
It looks like the same issue as https://github.com/android-ndk/ndk/issues/447. :(