Discussion:
[Bug c++/23371] New: Support 'set max-symbolic-offset 0' for the benefit of TUI mode
benjaminking at web dot de
2018-07-04 22:19:04 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23371

Bug ID: 23371
Summary: Support 'set max-symbolic-offset 0' for the benefit of
TUI mode
Product: gdb
Version: 8.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: benjaminking at web dot de
Target Milestone: ---

Created attachment 11116
--> https://sourceware.org/bugzilla/attachment.cgi?id=11116&action=edit
Democode with a crash + GDB 8.1 patch for Commit a543c5c

'set print max-symbolic-offset 0' has the same effect as 'set print
max-symbolic-offset unlimited' - every assembly instruction will be prepended
with a symbol name and an offset.

'set print max-symbolic-offset 1' will only do this for the first line of the
disassembly of a function.

There is no way to get rid of symbolic function names at all, though. For me,
this is an issue in TUI mode. There, all assembly instructions are aligned
vertically *after* the (optionally demangled) name of the function at the first
instruction.

My use case is maintaining a C++ codebase. The appended demo (make; gdb ./foo,
then 'run' until crash + 'tui enable' and 'layout split') contains a made up
example of a nested template class. Silly here, but much modern C++ I see is
done in this "Yo dawg, I herd you like templates"-style.

I like using TUI because GUI wrappers to gdb are often lacking regarding the
command line window. They are also unavailable to me when debugging from
remote. I am also an avid user of rr which defaults to using plain gdb for
replay. rr provides lots of value when 'stepi'ing and 'reverse-stepi'ing. I
like TUI mode when doing this. It helps me to keep from getting lost.

I'd appreciate "set print max-symbolic-offset 0" to mean 'do not print symbol
names at all', as implemented in the gdb_max_symbolic_offset.patch included in
the appended tar archive.

Alternatives I can think of:
* New knob to truncate symbol names after N chars
* New knob to show symbol names *after* the disassembly

The problem with the patch is that it fails to show a reasonable number for the
default value of the max_symbolic_offset variable, UINT_MAX. It shows
"4294967295" rather than "unlimited". It would also mess with users explicitly
defining 'set print max-symbolic-offset 0' in their .gdbinit, although I'd
guess that would be less of a problem since 'unlimited' should recreate the old
meaning.

I am at commit a543c5c, which is not the very latest, but recent. I'd be
willing to spend some more work on the patch but I have not worked on the gdb
codebase before and would need guidance.

Sidenote: The debug info in this tiny example is huuuge. When demangling is on,
'backtrace' will fill the screen with just one stack frame. I often get lost in
this, which is a (separate) problem in itself.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-07-27 14:25:44 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23371

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Benjamin King from comment #0)
Post by benjaminking at web dot de
I'd appreciate "set print max-symbolic-offset 0" to mean 'do not print
symbol names at all', as implemented in the gdb_max_symbolic_offset.patch
included in the appended tar archive.
[...]
Post by benjaminking at web dot de
I am at commit a543c5c, which is not the very latest, but recent. I'd be
willing to spend some more work on the patch but I have not worked on the
gdb codebase before and would need guidance.
Thanks for the patch.
gdb patches should be sent to the gdb-patches list.
Review and discussion happens there, and it's also a good place
to get questions answered about a patch.
See https://sourceware.org/gdb/wiki/ContributionChecklist
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...