When debugging a program in GDB, I get an unexpected "program that worked fine." So I wonder if there is a way to find out where (from which line) the program came from.
The program is multithreaded, if that matters.
Usually with the command below when the application completed execution:
(gdb) thread apply all bt
Of course, if you want to know the exact string, you must compile the application using debugging symbols, i.e. -g
-g
You can try the GDB break exit set a breakpoint when calling exit (2). If this does not help you, perhaps break _exit . You may need to run your program with "sta" before getting the last breakpoint. In any case, you should use the where command to get the stack trace where you were when the program decided to exit.
break exit
break _exit
where
Set a breakpoint on _exit and then view the stack.
Source: https://habr.com/ru/post/890705/More articles:Get dbpedia object categories using SPARQL - dbpediaScopes vs class methods in Rails 3 - ruby-on-railsWhat is the fastest way to write serial data to disk in Mac OS X? - cThe algorithm for obtaining the probability of achieving the goal - mathThe identifier of the object with automatic addition to the base data? - iphoneJSF2 composite components: # {cc.childCount} and are mutually exclusive? - jsfIn Java, can I convert a BufferedImage to an IMG Data URI URI? - javaIncorrect identification - sqlconvert image to base64 using java - javaEquivalent to NServiceBus in the Java World - javaAll Articles