[mythtv] Android 32-bit failure

Mark Spieth mark at digivation.com.au
Tue Feb 11 21:09:45 UTC 2020


On 2/12/2020 4:54 AM, Peter Bennett wrote:
>
>
> On 2/10/20 4:14 PM, Mark Spieth wrote:
>> On 2/11/2020 7:54 AM, Peter Bennett wrote:
>>> Hi Mark
>>>
>>> the gdb.sh script is having some problems. It complains that "target 
>>> remote :5039" in gdb.setup is invalid. However I can get it going by 
>>> manually typing in "target remote localhost:5039". It also objects 
>>> if I have "target remote localhost:5039" in gdb.setup.
>>>
>>> After typing that in manually it is still not working correctly. It 
>>> does not have its line numbers, it seems to be reading the libs from 
>>> android instead of using the local ones we have provided in so32.
>>>
>>> Anyway after typing that in manually I got to the place of the 
>>> SIGBUS error. It is in trying to connect to the database. Perhaps we 
>>> need to go back to mysql instead of mariadb:
>>>
>>> Thread 11 "qtMainLoopThrea" received signal SIGBUS, Bus error.
>>> [Switching to Thread 4746.4972]
>>> 0x8e103f0e in ma_send_connect_attr () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> (gdb) bt
>>> #0  0x8e103f0e () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> #1  0x8e113d24 in ?? () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> #2  0x8e113f1e in ?? () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> #3  0x8e11392a in run_plugin_auth () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> #4  0x8e104cc8 in mthd_my_real_connect () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmariadb.so
>>> #5  0x870f5b96 in ?? ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libplugins_sqldrivers_qsqlmysql_armeabi-v7a.so
>>> #6  0x8fdc20c0 in QSqlDatabase::open() ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libQt5Sql_armeabi-v7a.so
>>> #7  0x8c53e79c in MSqlDatabase::OpenDatabase(bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmythbase-32.so
>>> #8  0x8c541b48 in MDBManager::popConnection(bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmythbase-32.so
>>> #9  0x8c546ae8 in MSqlQuery::testDBConnection() ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmythbase-32.so
>>> #10 0x8bc847fc in MythContextPrivate::TestDBconnection(bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmyth-32.so
>>> #11 0x8bc7f6f0 in MythContextPrivate::FindDatabase(bool, bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmyth-32.so
>>> #12 0x8bc7ed68 in MythContextPrivate::Init(bool, bool, bool, bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmyth-32.so
>>> #13 0x8bc8b200 in MythContext::Init(bool, bool, bool, bool) ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmyth-32.so
>>> --Type <RET> for more, q to quit, c to continue without paging--
>>> #14 0x8aa29010 in main () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libmythfrontend_armeabi-v7a.so
>>> #15 0x8fd47e70 in ?? ()
>>>    from 
>>> target:/data/app/org.mythtv.mythfrontend-2/lib/arm/libplugins_platforms_qtforandroid_armeabi-v7a.so
>>> #16 0xa980c316 in oatexec () from 
>>> target:/data/app/org.mythtv.mythfrontend-2/oat/arm/base.odex
>>> Backtrace stopped: previous frame identical to this frame (corrupt 
>>> stack?)
>>
>> Wow. Didnt expect that. First I would roll back to using maria 
>> connector 2.1.0 and see. Should only be a comment out in the version 
>> since everything else is there. Try only remake mariadb and then 
>> clean apk or else everything just to be safe.
>>
>> Line numbers may still be available in libs/maria.../ somewhere. Or 
>> just do a disass on the top level and we should be able to figure out 
>> which line in ma_send_connect_attr is the culprit. I did an objdump 
>> but am not sure of the load address of the lib. Probably one of the 
>> memcpys is my guess.
>>
>> Cant test this right now.
>>
>> Mark
>>
>>
> After some fixes to gdb.sh I get a better back trace. gdb refuses to 
> accept the "target temote" in the gdb.setup file, so I added an echo 
> "RUN THIS COMMAND" and you have to copy/paste the command. I will push 
> the changes to gdb.sh and to makelibs.sh. I have not yet tried your 
> suggestion of using a different version of mariadb. You can see here 
> it is failing in "len= *(size_t *)p"
>
> Thread 11 "qtMainLoopThrea" received signal SIGBUS, Bus error.
> [Switching to Thread 10748.10776]
> ma_send_connect_attr (mysql=0xa542a000,
>     buffer=0xa558ee64 "Pin>cat</SecurityPin>\n 
> <USN>uuid:bcfa7f52-c934-480a-94c0-cceb4fc7d320::urn:schemas-mythtv-org:device:MasterMediaServer:1</USN>\n 
> </DefaultBackend>\n    </MythFrontend>\n <UDN>\n      <Media"...)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/libmariadb.c:1486
> 1486            len= *(size_t *)p;
> (gdb) bt
> #0  ma_send_connect_attr (mysql=0xa542a000,
>     buffer=0xa558ee64 "Pin>cat</SecurityPin>\n 
> <USN>uuid:bcfa7f52-c934-480a-94c0-cceb4fc7d320::urn:schemas-mythtv-org:device:MasterMediaServer:1</USN>\n 
> </DefaultBackend>\n    </MythFrontend>\n <UDN>\n      <Media"...)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/libmariadb.c:1486
> #1  0x909e1d24 in send_client_reply_packet (mpvio=0x927ace98,
>     data=0x927ace57 
> "\237L\030\227\232\230l\360\264\331\371\233X\374\316\325e\201c\242\222\v\333D\377", 
> data_len=<optimized out>)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/my_auth.c:421
> #2  client_mpvio_write_packet (mpv=0x927ace98,
>     pkt=0x927ace57 
> "\237L\030\227\232\230l\360\264\331\371\233X\374\316\325e\201c\242\222\v\333D\377", 
> pkt_len=<optimized out>)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/my_auth.c:520
> #3  0x909e1f1e in native_password_auth_client (vio=0x927ace98, 
> mysql=<optimized out>)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/my_auth.c:138
> #4  0x909e192a in run_plugin_auth (mysql=0xa542a000, data=0x8a2ad03f 
> "=79X206aeWbheAVj2ZO[", data_len=21,
>     data_plugin=0x8a2ad054 "mysql_native_password", db=0xa5430af0 
> "mythdbtmst")
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/my_auth.c:652
> #5  0x909d2cc8 in mthd_my_real_connect (mysql=<optimized out>, 
> host=0xa5430b90 "192.168.0.188", user=0xa5430b50 "mythtmst",
>     passwd=0xa5430e30 "mythtv", db=0xa5430af0 "mythdbtmst", port=3306, 
> unix_socket=<optimized out>, client_flag=65664)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/libmariadb.c:2048
> #6  0x8a341b96 in QMYSQLDriver::open(QString const&, QString const&, 
> QString const&, QString const&, int, QString const&) ()
>    from 
> /home/peter/proj/github.com/MythTV/packaging/android/so32/libplugins_sqldrivers_qsqlmysql_armeabi-v7a.so
> #7  0x926900c0 in QSqlDatabase::open() () from 
> /home/peter/proj/github.com/MythTV/packaging/android/so32/libQt5Sql_armeabi-v7a.so
> #8  0x8ef0b79c in MSqlDatabase::OpenDatabase (this=0xa5479440, 
> skipdb=false) at mythdbcon.cpp:167
> #9  0x8ef0eb48 in MDBManager::popConnection (this=0xa547b4b0, 
> reuse=true) at mythdbcon.cpp:340
> #10 0x8ef13ae8 in MSqlQuery::testDBConnection () at mythdbcon.cpp:854
> #11 0x8e7507fc in MythContextPrivate::TestDBconnection 
> (this=0xa547b960, prompt=true) at mythcontext.cpp:935
> #12 0x8e74b6f0 in MythContextPrivate::FindDatabase (this=0xa547b960, 
> prompt=false, noAutodetect=false) at mythcontext.cpp:441
> #13 0x8e74ad68 in MythContextPrivate::Init (this=0xa547b960, gui=true, 
> promptForBackend=false, noPrompt=false, ignoreDB=false)
>     at mythcontext.cpp:357
> #14 0x8e757200 in MythContext::Init (this=0xa5431130, gui=true, 
> promptForBackend=false, disableAutoDiscovery=false, ignoreDB=false)
>     at mythcontext.cpp:1635
> #15 0x8d4f5010 in main (argc=3, argv=0x927ae838) at main.cpp:1925
> #16 0x92615e70 in startQtApplication(_JNIEnv*, _jclass*) ()
>    from 
> /home/peter/proj/github.com/MythTV/packaging/android/so32/libplugins_platforms_qtforandroid_armeabi-v7a.so
> #
>
> (gdb) bt full
> #0  ma_send_connect_attr (mysql=0xa542a000,
>     buffer=0xa558ee64 "Pin>cat</SecurityPin>\n 
> <USN>uuid:bcfa7f52-c934-480a-94c0-cceb4fc7d320::urn:schemas-mythtv-org:device:MasterMediaServer:1</USN>\n 
> </DefaultBackend>\n    </MythFrontend>\n <UDN>\n      <Media"...)
>     at 
> /home/peter/proj/github.com/MythTV/packaging/android/libs/mariadb-connector-c-2.3.7-src/libmariadb/libmariadb.c:1486
>         p = 0x8a2b326f "\a"
>         len = 3
>         i = 0

I see the problem. p is not aligned to 4 bytes and this causes the bus 
error. so somewhere this has been allocated wrong. probably a packed 
struct in the qt mysql plugin.

I tested 2.1.0 and this also had the same problem. so dont bother 
testing this.

I also had trouble with gdb so am keen for your patches. My problem was 
debugging on arm64 with 32 bit package which means gdbserver needs to be 
the 64 bit flavour.

Mark



More information about the mythtv-dev mailing list