print
exprcall
exprvoid
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 unwindonsignal
show unwindonsignal
set unwind-on-terminating-exception
show unwind-on-terminating-exception
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.