public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb/python: improve formatting of help text for user defined commands
Date: Tue, 17 May 2022 23:41:48 +0100	[thread overview]
Message-ID: <20220517224111.4mrvufw4ph7v2toq@Plymouth> (raw)
In-Reply-To: <58a7e3085365af2ac05409b78f6d15bf5240cd2c.1652784658.git.aburgess@redhat.com>

Hi,

> +/* See python-internal.h.  */
> +
> +gdb::unique_xmalloc_ptr<char>
> +gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
> +{
> +  /* A structure used to track the white-space information on each line of
> +     DOC.  */
> +  struct line_whitespace
> +  {
> +    /* Constructor.  OFFSET is the offset from the content_start of DOC, WS_COUNT
> +       is the number of whitespace characters starting at OFFSET,
> +       NON_WS_COUNT is the number of characters following WS_COUNT, this
> +       count can include additional white-space characters, but the first
> +       character of this sequence will always be non-white-space.  LAST is
> +       true if this is the last line of DOC, otherwise LAST is false.  */

It looks like the comment mentions parameters which do not exist :
NON_WS_COUNT and LAST.  Are those from a previous implementation?

> +    line_whitespace (size_t offset, int ws_count)
> +      : m_offset (offset),
> +	m_ws_count (ws_count)
> +    { /* Nothing.  */ }
> diff --git a/gdb/testsuite/gdb.python/py-doc-reformat.exp b/gdb/testsuite/gdb.python/py-doc-reformat.exp
> new file mode 100644
> index 00000000000..9c203f88b4b
> --- /dev/null
> +++ b/gdb/testsuite/gdb.python/py-doc-reformat.exp
> @@ -0,0 +1,278 @@
> [...]
> +# The INPUT_DOCS must start with 2 space characters, followed by the
> +# 3-quote characters to start the doc string, and must end with the
> +# final 3-quote characters.  If this is not true then an error is
> +# thrown, and this function immediately returns.
> +proc test { input_docs expected_output } {
> +    global idx
> +
> +    set local_idx $idx
> +    incr idx
> +
> +    with_test_prefix "test ${local_idx}" {
> +
> +	verbose -log "Start of: test_cmd ${local_idx}"
> +	verbose -log "Input:\n${input_docs}"

Are those leftover from the development?

> +
> +	if { [string range $input_docs 0 4] != "  \"\"\"" } {
> +	    perror "Input string does not start with the required pattern"
> +	    return
> +	}
> +

Best,
Lancelot.

  parent reply	other threads:[~2022-05-17 22:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 10:51 [PATCH 0/2] Improve help test for commands defined in Python Andrew Burgess
2022-05-17 10:51 ` [PATCH 1/2] gdb: use gdb::unique_xmalloc_ptr<char> for docs in cmdpy_init Andrew Burgess
2022-05-26 17:43   ` Tom Tromey
2022-05-28 10:10     ` Andrew Burgess
2022-05-17 10:51 ` [PATCH 2/2] gdb/python: improve formatting of help text for user defined commands Andrew Burgess
2022-05-17 12:19   ` Eli Zaretskii
2022-05-17 22:41   ` Lancelot SIX [this message]
2022-05-18 10:19   ` Andrew Burgess
2022-05-18 12:09     ` Eli Zaretskii
2022-05-26 17:46     ` Tom Tromey
2022-05-28 10:11       ` Andrew Burgess
2022-05-31 21:54         ` Carl Love
2022-05-31 23:10           ` Carl Love
2022-06-03 18:05             ` Carl Love
2022-06-06 11:40               ` [PUSHED] gdb/testsuite: add missing skip_python_tests call in py-doc-reformat.exp Andrew Burgess
2022-06-07 16:08                 ` Carl Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220517224111.4mrvufw4ph7v2toq@Plymouth \
    --to=lsix@lancelotsix.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).