print exprEvaluate the expression expr and display the resulting value. The expression may include calls to functions in the program being debugged.
call exprEvaluate the expression expr without displaying void
returned values.
You can use this variant of the print command if you want to
execute a function from your program that does not return anything
(a.k.a. a void function), but without cluttering the output
with void returned values that GDB will otherwise
print. If the result is not void, it is printed and saved in the
value history.
It is possible for the function you call via the print or
call command to generate a signal (e.g., if there’s a bug in
the function, or if you passed it incorrect arguments). What happens
in that case is controlled by the set unwindonsignal command.
Similarly, with a C++ program it is possible for the function you
call via the print or call command to generate an
exception that is not handled due to the constraints of the dummy
frame. In this case, any exception that is raised in the frame, but has
an out-of-frame exception handler will not be found. GDB builds a
dummy-frame for the inferior function call, and the unwinder cannot
seek for exception handlers outside of this dummy-frame. What happens
in that case is controlled by the
set unwind-on-terminating-exception command.
set unwindonsignalSet unwinding of the stack if a signal is received while in a function that GDB called in the program being debugged. If set to on, GDB unwinds the stack it created for the call and restores the context to what it was before the call. If set to off (the default), GDB stops in the frame where the signal was received.
show unwindonsignalShow the current setting of stack unwinding in the functions called by GDB.
set unwind-on-terminating-exceptionSet unwinding of the stack if a C++ exception is raised, but left unhandled while in a function that GDB called in the program being debugged. If set to on (the default), GDB unwinds the stack it created for the call and restores the context to what it was before the call. If set to off, GDB the exception is delivered to the default C++ exception handler and the inferior terminated.
show unwind-on-terminating-exceptionShow the current setting of stack unwinding in the functions called by GDB.
Sometimes, a function you wish to call is actually a weak alias for another function. In such case, GDB might not pick up the type information, including the types of the function arguments, which causes GDB to call the inferior function incorrectly. As a result, the called function will function erroneously and may even crash. A solution to that is to use the name of the aliased function instead.