c++ - Segfault doesn't occur in debugger neither valgrind -
i'm trying debug c++ qt5 program i'm unable, of times crashes on quit (when launched shell).
when it's launched valgrind or gdb/lldb doesn't crash.
i tried generating coredump , loading results helpless, 1 frame in bt
.
the actual code hosted on github.
valgrind output:
$ valgrind --tool=memcheck ./build/qsubber ==27761== memcheck, memory error detector ==27761== copyright (c) 2002-2013, , gnu gpl'd, julian seward et al. ==27761== using valgrind-3.10.1 , libvex; rerun -h copyright info ==27761== command: ./build/qsubber ==27761== ==27761== conditional jump or move depends on uninitialised value(s) ==27761== @ 0x15d790fa: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2400.28) ==27761== 0x9733523: ??? (in /usr/lib/libgobject-2.0.so.0.4400.1) ==27761== 0x974cf96: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.4400.1) ==27761== 0x974de39: g_signal_emit_by_name (in /usr/lib/libgobject-2.0.so.0.4400.1) ==27761== 0x973ac2a: g_object_set_valist (in /usr/lib/libgobject-2.0.so.0.4400.1) ==27761== 0x973b4bb: g_object_set (in /usr/lib/libgobject-2.0.so.0.4400.1) ==27761== 0x636ecc5: ??? (in /usr/lib/libqt5widgets.so.5.5.0) ==27761== 0x62f264c: qstylefactory::create(qstring const&) (in /usr/lib/libqt5widgets.so.5.5.0) ==27761== 0x628b704: qapplication::style() (in /usr/lib/libqt5widgets.so.5.5.0) ==27761== 0x628bacc: qapplicationprivate::initialize() (in /usr/lib/libqt5widgets.so.5.5.0) ==27761== 0x628bb1e: qapplicationprivate::construct() (in /usr/lib/libqt5widgets.so.5.5.0) ==27761== 0x413dfc: main (main.cc:34) ==27761== token: bp5tqvuocvv993496ppnds1j91 status: 200 ok ==27761== ==27761== heap summary: ==27761== in use @ exit: 6,490,962 bytes in 30,293 blocks ==27761== total heap usage: 167,918 allocs, 137,625 frees, 19,981,839 bytes allocated ==27761== ==27761== leak summary: ==27761== lost: 5,152 bytes in 32 blocks ==27761== indirectly lost: 21,255 bytes in 779 blocks ==27761== possibly lost: 3,977,133 bytes in 7,134 blocks ==27761== still reachable: 2,305,790 bytes in 21,486 blocks ==27761== suppressed: 0 bytes in 0 blocks ==27761== rerun --leak-check=full see details of leaked memory ==27761== ==27761== counts of detected , suppressed errors, rerun with: -v ==27761== use --track-origins=yes see uninitialised values come ==27761== error summary: 1 errors 1 contexts (suppressed: 0 0)
update i'm not asking debug code me, need debug in scenario, i've searched lot , found question/answers nothing helped me until created question.
i can offer general guidelines experience might help. also, luck, answer may of others class of problems, , not specific code.
if crash (when not under debugger) repeatable, that's good. start stubbing out major functional parts of code, 1 function @ time. don't care if test code "works" or not, if crashes on exit or not.
if lucky, keep crashing after few iterations of this, suddenly, not crash on exit more. examine ever block of code stubbed out out closely.
a segfault either pointer wrote off end of buffer, or place function puts x bytes on stack, pops y bytes off stack later on (happened me once when changing prototypes 32 64 bit types).
you unlucky if first bit of code stub out makes problem go away, when put back, , try stubbing else out, still goes away. dealing elsewhere in program messing memory, , stubbing out arbitrary code not directly associated problem moves things around make bug appear or disappear.
one last thing check, compiler optimization flags. it's unlikely, have hit honest goodness compiler bugs in career. try compiling no optimizations @ , see if still crashes on exit. try compiling max optimizations too. see if behavior changes.
if none of helps, going have go line line looking memory allocations , free spots , mismatch.
final thought, memory allocated object local scope inside function, , returned calling program via reference invalid, , maybe trying cleaned on program exit.
good luck.
Comments
Post a Comment