using pipe with command
Christof Warlich
cwarlich@gmx.de
Mon Jul 15 20:35:00 GMT 2019
Hi,
I just got quite exited when I saw the newly introduced "pipe" command.
But a closer look reveals that it does somewhat only work
"occasionally". Fortunately, "occasionally" here means that the issue is
at least reproducible. Here are some examples that show the problem.
Note that the code (of GNU make) that I'm using is compiled with "-f
instrument-function" with appropriate function definitions. But I'd
assume that the issue occurs with any code being debugged.
In the following example, file "xxx" remains empty, although it should
contain the output of the "up" command:
...
Reading symbols from make...
(gdb) b __cyg_profile_func_enter
Breakpoint 1 at 0x41d6d5: file src/main.c, line 54.
(gdb) command 1
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>pipe up | cat - >xxx
>end
(gdb) run
Starting program: /home/christof/Local/Repos/make/make
Breakpoint 1, __cyg_profile_func_enter (func_address=0x41df5d
<main>, call_site=0x7ffff7801b97 <__libc_start_main+231>) at
src/main.c:54
54 }
#1 0x000000000041dfa1 in main (argc=1, argv=0x7fffffffe0c8,
envp=0x7fffffffe0d8) at src/main.c:1074
1074 {
(gdb) !cat xxx
(gdb)
Strange enough, almost the same setup works when replacing the "up"
command with the "bt" command: File xxx contains a backtrace as expected.
...
Reading symbols from make...
(gdb) b __cyg_profile_func_enter
Breakpoint 1 at 0x41d6d5: file src/main.c, line 54.
(gdb) command 1
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>pipe bt | cat - >xxx
>end
(gdb) run
Starting program: /home/christof/Local/Repos/make/make
Breakpoint 1, __cyg_profile_func_enter (func_address=0x41df5d
<main>, call_site=0x7ffff7801b97 <__libc_start_main+231>) at
src/main.c:54
54 }
(gdb) !cat xxx
#0 __cyg_profile_func_enter (func_address=0x41df5d <main>,
call_site=0x7ffff7801b97 <__libc_start_main+231>) at src/main.c:54
#1 0x000000000041dfa1 in main (argc=1, argv=0x7fffffffe0c8,
envp=0x7fffffffe0d8) at src/main.c:1074
(gdb)
To make things even more weird, piping the output of the "up" command
directly (i.e. outside of the "command" command) works as well as expected:
...
Reading symbols from make...
(gdb) b __cyg_profile_func_enter
Breakpoint 1 at 0x41d6d5: file src/main.c, line 54.
(gdb) run
Starting program: /home/christof/Local/Repos/make/make
Breakpoint 1, __cyg_profile_func_enter (func_address=0x41df5d
<main>, call_site=0x7ffff7801b97 <__libc_start_main+231>) at
src/main.c:54
54 }
(gdb) pipe up | cat - >xxx
(gdb) !cat xxx
#1 0x000000000041dfa1 in main (argc=1, argv=0x7fffffffe0c8,
envp=0x7fffffffe0d8) at src/main.c:1074
1074 {
(gdb)
I'm aware that the "pipe" command may still be "in development", but
maybe this early report may help to fix a lingering issue ... And I
certainly would be more than happy to test any patch :-).
Cheers,
Chris
More information about the Gdb
mailing list