debugging - How to inspect the return value of a function in GDB? -


is possible inspect return value of function in gdb assuming return value not assigned variable?

i imagine there better ways it, finish command executes until current stack frame popped off , prints return value -- given program

int fun() {     return 42; }  int main( int argc, char *v[] ) {     fun();     return 0; } 

you can debug such --

(gdb) r starting program: /usr/home/hark/a.out   breakpoint 1, fun () @ test.c:2 2               return 42; (gdb) finish run till exit #0  fun () @ test.c:2 main () @ test.c:7 7               return 0; value returned $1 = 42 (gdb)  

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -