manpagez: man pages & more
info gdb
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

14.5 Calling Program Functions

print expr

Evaluate the expression expr and display the resulting value. expr may include calls to functions in the program being debugged.

call expr

Evaluate 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 No value for GDBN 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.

set unwindonsignal

Set unwinding of the stack if a signal is received while in a function that No value for GDBN called in the program being debugged. If set to on, No value for GDBN 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), No value for GDBN stops in the frame where the signal was received.

show unwindonsignal

Show the current setting of stack unwinding in the functions called by No value for GDBN.

Sometimes, a function you wish to call is actually a weak alias for another function. In such case, No value for GDBN might not pick up the type information, including the types of the function arguments, which causes No value for GDBN 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.