Bug 32357 - [gdb/cli] unit test help_doc_invariants fails for command jit-reader-load (contains full path name)
Summary: [gdb/cli] unit test help_doc_invariants fails for command jit-reader-load (co...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: cli (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 16.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-13 07:49 UTC by Tom de Vries
Modified: 2024-11-21 21:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2024-11-13 07:49:03 UTC
Since commit:
...
commit fba3b6d16c206882c3ccb98da38271cf36100629 (HEAD)
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Jun 3 09:40:47 2024 -0600

    Ensure that help text fits in 80 columns
    
    This patch adds a new unit test that ensures that all help text wraps
    at 80 columns.
...
I run into:
...
$ gdb -q -batch -ex "maint selftest help_doc_invariants"
Running selftest help_doc_invariants.
help doc broken invariant: command 'jit-reader-load' help doc has over-long line
Self test failed: self-test failed at /data/vries/gdb/src/gdb/unittests/command-def-selftests.c:121

Failures:
  help_doc_invariants

Ran 1 unit tests, 1 failed
...

Looking at the help text, this seems to be related to the dir name:
...
$ gdb
(gdb) help jit-reader-load
Load FILE as debug info reader and unwinder for JIT compiled code.
Usage: jit-reader-load FILE
Try to load file FILE as a debug info reader (and unwinder) for
JIT compiled code.  The file is loaded from /data/vries/gdb/leap-15-5/install/lib64/gdb,
relocated relative to the GDB executable if required.
...

Doing an apropos on part of the dir name:
...
(gdb) apropos leap-15-5
jit-reader-load -- Load FILE as debug info reader and unwinder for JIT compiled code.
(gdb) 
...
shows that this is probably the only help text containing a full pathname.

We could either:
- fix the unit test to skip this command,
- drop the dir from the help text for jit-reader-load, or
- not use the full pathname for the dir.
Comment 1 Tom Tromey 2024-11-13 13:06:18 UTC
Sorry about this.
Kévin noticed this yesterday, we're discussing adding
a set/show command for this instead.  JIT_READER_DIR
isn't necessarily what is actually used under the hood anyway,
it is a relocatable directory.
Comment 3 Sourceware Commits 2024-11-21 21:08:45 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=29e316d8b15f1f1874bb58d8cd8346629f4edcc4

commit 29e316d8b15f1f1874bb58d8cd8346629f4edcc4
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Nov 13 08:49:53 2024 -0700

    Don't put JIT_READER_DIR into help text
    
    The 80-column-help-string self-test can fail if gdb's install
    directory is too long, because the help for "jit-reader-load" includes
    JIT_READER_DIR.
    
    This help text is actually somewhat misleading, though.
    JIT_READER_DIR is not actually used directly -- instead the relocated
    variant is used.
    
    This patch adds a new "show jit-reader-directory" command and changes
    the help text to refer to this instead.  I considered adding a "set"
    command as well, but since absolute paths are acceptable here, and
    since this is a very niche command anyway, I figured there was no need
    to bother.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32357
    Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
    Reviewed-By: Eli Zaretskii <eliz@gnu.org>
    Approved-By: Andrew Burgess <aburgess@redhat.com>
Comment 4 Tom Tromey 2024-11-21 21:09:49 UTC
Fixed.