With logging enabled as described here, I am using command to log and continue at a breakpoint as described here.
Full gdb interraction:
$ sudo gdb -p 30560
(gdb) set logging file myDbg.log
(gdb) set logging on
Copying output to myDbg.log.
(gdb) set trace-commands on
(gdb) set pagination off
(gdb) br __libc_malloc
(gdb) conti
// Once the bp is hit:
(gdb) info stack << Output for this shows up in myDbg.log
(gdb) command
+command
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>info stack
>conti
>end
(gdb) conti
// Now on the console I get:
Continuing.
[Switching to Thread 0x7fff98949700 (LWP 30627)]
Thread 49 "triggerproc" hit Breakpoint 1, 0x00007fffecc05f70 in malloc () from /lib64/libc.so.6
+info stack
#0 0x00007fffecc05f70 in malloc () from /lib64/libc.so.6
#1 0x00007fffed79d18d in operator new(unsigned long) () from /lib64/libstdc++.so.6
...
+conti
[Switching to Thread 0x942e700 (LWP 32191)]
// While the log file only has
Continuing.
[Switching to Thread 0x7fff98949700 (LWP 30627)]
Thread 49 "triggerproc" hit Breakpoint 1, 0x00007fffecc05f70 in malloc () from /lib64/libc.so.6
+info stack
** expected to see stack trace here **
+conti
[Switching to Thread 0x942e700 (LWP 32191)]
I don't get the info stack output in the log. If I do info stack outside of command, i.e. regular gdb prompt, its output is written to the log file.
How do I get info ... outputs from within command into the log file? Application is a multithreaded C++ running on a CentOS VM, if that matters.