Skip to content
  • Lucas De Marchi's avatar
    lib/igt_core: fix check for running under gdb · c963fb78
    Lucas De Marchi authored
    
    
    Properly check for errors and rename the function since we are checking if we are
    running under gdb, not making it run under gdb. Previously we were
    passing uninitialized data to basename() due to not properly adding the
    nul termination.
    
    ==22293== Conditional jump or move depends on uninitialised value(s)
    ==22293==    at 0x4C306D0: rindex (vg_replace_strmem.c:199)
    ==22293==    by 0x4EC55DD: basename (in /usr/lib64/libc-2.27.so)
    ==22293==    by 0x400744: running_under_gdb (in /tmp/a)
    
    There's another problem with this function that it doesn't detect when
    we are running gdb from a toolchain using a toolchain triplet, but
    that's left for another patch.
    
    v2: remove the fix for repeating the argument on readlink() since that
        landed in another patch
    
    Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
    Reviewed-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
    c963fb78