How to fix Glib warnings or errors with GDB by Olivier on 18/02/2017 18:37

After adding support for Bluez5 in the latest version of gattlib, the Glib warning message GLib-WARNING **: Invalid file descriptor was printed every time we were closing a gattlib connection.
Even if the error warning was looking harmless, a warning message should never occurs after a normal operation.

Here are the following steps to fix a Glib warning or error:

  1. Ensure debug support is present in the gattlib based applications:

    cd <gattlib_root>
    mkdir build && cd build
    cmake -DCMAKE_BUILD_TYPE=Debug ..
    make
    
  2. Tell Glib library to treat warnings as error:

    export G_DEBUG=fatal_warnings
    
  3. Debug one of the gattlib examples using gdb:

    gdb ./examples/read_write/read_write
    
  4. Start the program and pass its arguments:

    (gdb) run  DA:94:40:95:E0:87 read 0x2a38
    Starting program: /home/olivier/gattlib/build/examples/read_write/read_write DA:94:40:95:E0:87 read 0x2a38
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
    [New Thread 0xb7bdab40 (LWP 3594)]
    Read UUID completed: 03 
    
    (process:3590): GLib-WARNING **: Invalid file descriptor.
    
    
    Thread 1 "read_w" received signal SIGTRAP, Trace/breakpoint trap.
    0xb7cbc749 in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
    
  5. Inspect the callstack:

    (gdb) where
    #0  0xb7cbc749 in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #1  0xb7cbc805 in g_log () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #2  0xb7ca7c28 in g_io_channel_error_from_errno () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #3  0xb7cfcbee in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #4  0xb7ca84ea in g_io_channel_shutdown () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #5  0xb7ca86cd in g_io_channel_unref () from /lib/i386-linux-gnu/libglib-2.0.so.0
    #6  0xb7fb988c in io_destroy (io=0xb7200fe8) at /home/olivier/gattlib/bluez5/src/shared/io-glib.c:132
    #7  0xb7fa90cb in bt_att_free (att=0xb7202a00) at /home/olivier/gattlib/bluez5/src/shared/att.c:955
    #8  0xb7fa94be in bt_att_unref (att=0xb7202a00) at /home/olivier/gattlib/bluez5/src/shared/att.c:1065
    #9  0xb7f7f224 in g_attrib_unref (attrib=0xb7200fc0) at /home/olivier/gattlib/bluez5/attrib/gattrib.c:195
    #10 0xb7f7932c in gattlib_disconnect (connection=0x804cef8) at /home/olivier/gattlib/src/gattlib_connect.c:359
    #11 0x08048c72 in main (argc=4, argv=0xbfffee74) at /home/olivier/gattlib/examples/read_write/read_write.c:93
    (gdb)
    
  6. Fix the issue!

Anonymous on 21/05/2024 09:44
15 Reasons To Not Be Ignoring Pornstar Porn Stars (Nerdgaming.Science)
Anonymous on 27/05/2024 17:23
Guide To Kayleigh Porn Star: The Intermediate Guide To Kayleigh Porn Star kayleigh Porn star
Anonymous on 30/05/2024 10:29
You'll Never Guess This Most Famous Pornstars's Tricks most famous pornstars
Anonymous on 03/06/2024 11:23
What's The Current Job Market For Most Famous Pornstars Professionals Like?
pornstar
Anonymous on 04/06/2024 11:34
10 Things That Your Family Taught You About
Playboy Pornstars playboy Pornstars
Anonymous on 06/06/2024 23:58
Guide To Tiktokpornstar: The Intermediate Guide Towards Tiktokpornstar tiktokpornstar; buketik39.ru,
Anonymous on 10/06/2024 18:35
????? ????????? ????????, ?? ??????? ????? ?????? ?????
????? ????? ??? ???????? Kraken, ???????
??????? ????? ????? ?? ?????? 2krn.at
-> https://new-oleg-pogudin.elegos.su/index.php?action=profile;u=1320. ??? ???????????? ? ????? ??????? ???????? ?
?? ? ???, ??????? ????????? ???????? ?
?????????? ???? ?????? ?????????????.

????? ?? ??????? ??? ???????????,
?????????? ?? ????? ???????? ? ??????????.
???????? ??????????? ????????????, ????? ?????????? ? ???????????, ?? ?????? ??? ???? ??????????????
???????, ????? ????????? ???????? Tor ???
Kraken, ??? ??? ??????????. ?????????? ?????? ??????? ??
?????? ??????????? ???? kraken2trfqodidvlh4Aa337cpzfrhdlfldhve5nf7njhumwr7instad.Onion -> http://www.innobrotech.com/?document_srl=123046 ? ?????? ????????????? ???????? ????? ??????.
??????? ?????? ??????? ?? ????????????? ??????? ??????.
Anonymous on 14/06/2024 19:13
?????? ????? ???????? ?????, ??? ????? ?????? ???, ??? ???????
????? ??? ???????? ???? ??????, ??? ?? ?????? ????????? ?
???????? ????????? ??????? ? ???????.

?????? ??????? ?? ????????? ????????
????????. ?? ???????? ??
???? ??????? ????. ?? ????? ?? ??????? ????? ??? ???? ?????? ????.
?????? ??????? ?????? - ??? ??????????
????????, ? ?? ????????????? ??? ?????????? ?????? ?? ??????????? ??????? ?????? ?? ????????????? ???????.
????? ?????? ??????? ?? ???, ?????? ??????? ??????
-> https://camillacastro.us/forums/profile.php?id=180424, ????? ??
???? ? ????????? ?????? ??? ???? ????.

???????? ????????? ????????, ???????? 24/7, ? ????? ????, ?? ??????? ??????????
TOR ??? VPN. ?????????? ??????? ?? Kraken ??????????? ???? ? ?????? ?????? ? ????????.
??? ????? ??????????? ??????? ???????????, ? ????????? ????????? ??????.
? ??? ????????????? ?????
???????? ?? ?????? ?????? ?????????? ? ????????????? ???????.
Anonymous on 20/06/2024 21:48
???????? ?? 1? ?????? ???
??????????? ???????
Anonymous on 06/07/2024 18:40
Pornstar UK Kayleigh Wanless Tools To Make Your Daily Lifethe One Pornstar UK Kayleigh Wanless Trick That
Every Person Must Know Pornstar Uk Kayleigh wanless

Login to comment Comment as anonymous