GDB Obtenha o valor da função de retorno

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
CertainBadProgrammer