Search
 
SCRIPT & CODE EXAMPLE
 

CPP

gdb get return value of function

int fun() {
	return 42;
}

int main() {
	fun();
    return 0;
}

(gdb) break 2   // set breakpoint at line 2
(gdb) r

Breakpoint 1, fun () at test.c:2
2               return 42;

(gdb) finish   // $1 is the value the function returned.

Run till exit from #0  fun () at test.c:2
main () at test.c:7
7               return 0;
Value returned is $1 = 42   // we get the return value is 42
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ copy vector 
Cpp :: sfml disable message 
Cpp :: How to remove the % in zsh that show after running c++ file 
Cpp :: cpp pass function with input to thread 
Cpp :: Access Elements in C++ Array 
Cpp :: vector and algorithm 
Cpp :: get range sum 
Cpp :: . Shell sort in c++ 
Cpp :: what c++ library is arccos in 
Cpp :: how to make a defaule conrstrocr in c++ classes 
Cpp :: why wont a function stop C++ 
Cpp :: C++ Join thread 
Cpp :: c++ x y in arrau 1d 
Cpp :: sqrt function in c++ 
Cpp :: how to draw a rectangle with diagonals and axes of symmetry in c ++ in the console? 
Cpp :: loops in c++ with example 
Cpp :: how initilaize deffult value to c++ class 
Cpp :: c++ enter name and surname one string 
Cpp :: C++ Single Line Comments 
Cpp :: semi colon in argument list c++ 
Cpp :: C++ Creating a Class Template Object 
Cpp :: create a table using pointers in C++ 
Cpp :: vector stop at newline 
Cpp :: warning in range-based for loop in C++. How to resolve it in vscode? 
Cpp :: C++ Booleans 
Cpp :: MPI_Sendrecv 
Cpp :: pycuda install failed microsoft c++ 
Cpp :: cast unreal c++ 
Cpp :: C++ Ranged Based for Loop 
Cpp :: check if string in vector c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =