setting a gdb exit breakpoint not working?

后端 未结 3 1039
北恋
北恋 2020-12-12 17:26

I\'ve set breakpoints on exit and _exit and my program (multithreaded app, running on linux 2.6.16.46-0.12 sles10), is somehow still exiting in a way I can\'t locate

3条回答
  •  Happy的楠姐
    2020-12-12 18:14

    It might be that you have some lazy references unresolved in some shared library loaded into process. I have exactly the same situation that "someone somewhere" exited process and that appeared to be unresolved reference.

    Check your process with "ldd -r" option.

    Looks like ld.so or whatever does lazy resolving of some symbols to uniform exit function (which should be abort IMHO).

    My situation:

    $ ldd ./program
    undefined symbol: XXXX  (/usr/lib/libYYY.so)
    
    $./program
    program: started! 
    ...
    
    

    Now exit appeared when I've invoked some scenario that used function that was undefined. It always exited with exitcode=127 and gdb reported 0177.

提交回复
热议问题