Discussion:
[Bug cli/23135] New: Configuring logging inside a user-defined command does not take effect
alex@alex-smith.me.uk
2018-05-03 10:10:06 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23135

Bug ID: 23135
Summary: Configuring logging inside a user-defined command does
not take effect
Product: gdb
Version: 8.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: cli
Assignee: unassigned at sourceware dot org
Reporter: ***@alex-smith.me.uk
Target Milestone: ---

In GDB 8.1, "set logging" commands inside a user-defined command do not take
effect when the user-defined command is executed. For example:

(gdb) define setup-logging
Type commands for definition of "setup-logging".
End with a line saying just "end".
set logging redirect on
set logging on foo.txt
end
(gdb) setup-logging
(gdb) bt
#0 0x00007ffff69c2f4b in raise () from /lib64/libc.so.6
#1 0x00007ffff69ad591 in abort () from /lib64/libc.so.6
#2 0x0000000000401783 in FatalImpl (inFile=0x404d28
"Build/Release/Engine/Runtime/Engine/Source/Engine.cpp", inLine=47,
inFormat=<optimized out>) at
Build/Release/Engine/Runtime/Core/Source/Log.cpp:43
#3 0x0000000000403197 in Engine::Run (this=<optimized out>) at
Build/Release/Engine/Runtime/Engine/Source/Engine.cpp:47
#4 0x00000000004031ba in main (argc=<optimized out>, argv=<optimized out>) at
Build/Release/Engine/Runtime/Engine/Source/Main.cpp:23
(gdb)

The command output is still appearing on stdout and foo.txt is empty.
Performing the "set logging" commands manually behaves as expected (the output
is redirected).

This worked in GDB 8.0 (and many prior versions). This change in behaviour has
broken my custom .gdbinit hooks to implement colour backtraces (they redirect
the output to a file and then invoke a shell command to colourise it).
--
You are receiving this mail because:
You are on the CC list for the bug.
chip.devel at gmail dot com
2018-06-29 09:42:47 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23135

chip.devel at gmail dot com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |chip.devel at gmail dot com

--- Comment #1 from chip.devel at gmail dot com ---
Even in 8.0.1 (from 8.0.1-0ubuntu1 package) the logging process looks really
deassociated from the commands.

When executing the hookpost-backtrace hook of the coloring script, the file has
only 32 lines of the backtrace. I've even tried to "shell sleep" in the hook -
still only 32 lines.
--
You are receiving this mail because:
You are on the CC list for the bug.
Continue reading on narkive:
Loading...