aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-24 19:26:04 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-24 19:26:41 -0400
commit0df0cce7c63c064e086deda7384a7dd82fefe228 (patch)
tree563ba174111f240d34c8e8978fdb5e2e458ce888 /gdb/python
parentc90e7d6352b2e16ac007d08b2e03ae10081147b5 (diff)
downloadbinutils-0df0cce7c63c064e086deda7384a7dd82fefe228.zip
binutils-0df0cce7c63c064e086deda7384a7dd82fefe228.tar.gz
binutils-0df0cce7c63c064e086deda7384a7dd82fefe228.tar.bz2
gdbsupport: allow passing format string to scoped_debug_start_end
A little thing that bothers me with scoped_debug_start_end is that it's not possible to pass a format string to add context to the messages: the start and end messages are fixed. It was done like this at the time because there's the risk that debug output is not enabled on entry (when the constructor runs) but is enabled on exit (when the destructor runs). For example, a user debugging from a top-gdb may manually enable a debug_foo variable. If debug output is disabled while the constructor runs, we won't render the format string (to minimize overhead) so it won't be available in the destructor. I think it would be nice to be able to use a format string along with scoped_debug_start_end, and I think it's unfortunate that such a narrow use case prevents it. So with this patch, I propose that we allow passing a format string to scoped_debug_start_end, and if the rare situation described above happens, then we just show a "sorry, message not available" kind of message. The following patch makes use of this. gdbsupport/ChangeLog: * common-debug.h (struct scoped_debug_start_end) <scoped_debug_start_end>: Change start_msg/end_msg for start_prefix/end_prefix. Add format string parameter and make variadic. <~scoped_debug_start_end>: Adjust. <m_end_msg>: Rename to... <m_end_prefix>: ... this. <m_with_format>: New. <m_msg>: New. (scoped_debug_start_end): Make variadic. (scoped_debug_enter_exit): Adjust. Change-Id: I9427ce8877a246a46694b3a1fec3837dc6954d6e
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions