[mythtv] Gdb Woes

Mark Spieth mark at digivation.com.au
Sun Jul 1 04:02:25 UTC 2018

On 7/1/2018 12:53 PM, David Engel wrote:
> On Sun, Jul 01, 2018 at 10:55:17AM +1000, Mark Spieth wrote:
>> On 7/1/2018 2:20 AM, David Engel wrote:
>>> Mark,
>>> I'm still having issues trying to get gdb to run.  Attached are two
>>> log files.  Can you make any sense of them?
>>> gdb.log is from running "bash -x ./gdb.sh | tee gdb.log".  The "Can't
>>> open socket: Permission denied." look suspicious.
>>> logcat.log is from running "adb logcat |& tee logcat.log".  The
>>> "Debugger is no longer active" looks suspicious here.
>>> David
>> did a quick search for "oreo gdbserver" and found this good info
>> https://github.com/android-ndk/ndk/issues/447
>> They found your copy trick (a bit different)
>> adb push .../gdbserver /data/local/tmp
>> adb shell
>> $ cat /data/local/tmp/gdbserver | run-as |org.mythtv.mythfrontend| sh -c
>> 'cat > /data/data/|org.mythtv.mythfrontend|/gdbserver'
>> or do it your way is also fine with dd or the sh -c cat trick. no middle
>> man. will also work on any version of android (I think).
>> chmod like normal of course is still required.
> Using cat with quoted redirection was going to be my next attempt.
>> Key log lines
>> 06-30 11:10:35.093 27145 27145 W gdbserver: type=1400 audit(0.0:4016): avc: denied { read } for name="stat" dev="proc" ino=4026540912 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc_stat:s0 tclass=file permissive=0
>> + /home/david/android/android-ndk/my-android-toolchain64/bin/gdb -n -x
>> so/gdb.setup
>> Can't open socket: Permission denied.
>> Easy way to fix #2 is change USE_IP=0 in gdb.sh and it should work
>> (hopefully).
> The actual error is different (Connection reset by peer instead of
> Permission denied), but still no go.  gdb2.log file attached.
looks like mfe was not even started.
cant see any mention of gdbserver in logcat output.

Try to reorder the adb forward and the gdbserver start, may be important 
to have the "adb forward" done first.
if that fails,
Try changing to target remote to explicitly use localhost
Try netstat -tan | grep 5089 to see if adb forward is actually listening 
on the host.
Also check netstat on the shield too after gdbserver is running to make 
sure its listening on the domain socket.
put them in the script to make it easy.

Other than that I have no more good ideas.

>> #1 probably requires gdbserver from the latest ndk (and maybe gdb as well)
>> see discussion on this.
>> You don't need to build with the latest ndk (stick with 13b) but there may
>> be libc issues perhaps that affect us too.
> I installed NDK 17.whatever using Android Studio and used the
> gdbserver that was installed in
> /home/david/android/android-sdk-linux/ndk-bundle/prebuilt/android-arm64/gdbserver/gdbserver,
> but it didn't make a difference.  logcat2.log file attached.
>> Other tricks to try
>> adb shell -t
>> * not sure what this would help with.
> Which invocation of adb shell?
Dont know. Just something they tried.
>> It would be interesting to know what release of oreo nvidia used. prerelease
>> 3 is not good apparently.
> The reported version is 8.0.0 and the security patch level is from May
> 5 2018, so it looks to be current, at least for 8.0.
Bugger. definitely release with many patches.

This problem cant be debugged by rooting the device either as that would 
change everything. selinux is our main enemy here and it looks like oreo 
has tightened everything.


More information about the mythtv-dev mailing list