public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Use cmd_list_element::doc_allocated for Python commands
Date: Wed, 27 Nov 2019 15:22:00 -0000	[thread overview]
Message-ID: <8318f3c337cf46ee6309b4a7f06f3934fc94b4bd@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 8318f3c337cf46ee6309b4a7f06f3934fc94b4bd ***

commit 8318f3c337cf46ee6309b4a7f06f3934fc94b4bd
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Fri Nov 15 16:41:12 2019 -0700
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Tue Nov 26 14:20:29 2019 -0700

    Use cmd_list_element::doc_allocated for Python commands
    
    Python commands manage their "doc" string manually, but
    cmd_list_element already has doc_allocated to handle this case.  This
    changes the Python code to use the existing facility.
    
    gdb/ChangeLog
    2019-11-26  Tom Tromey  <tom@tromey.com>
    
            * python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
            (cmdpy_init): Set "doc_allocated".
    
    Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 94a8bdc8dc..821afd313d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-26  Tom Tromey  <tom@tromey.com>
+
+	* python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
+	(cmdpy_init): Set "doc_allocated".
+
 2019-11-26  Tom Tromey  <tom@tromey.com>
 
 	* gdbsupport/thread-pool.c (thread_pool::set_thread_count): Set
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 87d1888c52..e3497d6f92 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -98,10 +98,8 @@ cmdpy_destroyer (struct cmd_list_element *self, void *context)
   gdbpy_ref<cmdpy_object> cmd ((cmdpy_object *) context);
   cmd->command = NULL;
 
-  /* We allocated the name, doc string, and perhaps the prefix
-     name.  */
+  /* We allocated the name and perhaps the prefix name.  */
   xfree ((char *) self->name);
-  xfree ((char *) self->doc);
   xfree ((char *) self->prefixname);
 }
 
@@ -563,6 +561,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
       /* There appears to be no API to set this.  */
       cmd->func = cmdpy_function;
       cmd->destroyer = cmdpy_destroyer;
+      cmd->doc_allocated = 1;
 
       obj->command = cmd;
       set_cmd_context (cmd, self_ref.release ());


             reply	other threads:[~2019-11-27 15:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 15:22 gdb-buildbot [this message]
2019-11-27 15:22 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2019-11-30  8:59 ` Failures on Fedora-i686, " gdb-buildbot
2019-11-30  9:14 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2019-11-30  9:20 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-30 10:06 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-11-30 10:20 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-11-30 10:27 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2019-11-30 10:28 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-11-30 10:47 ` *** COMPILATION FAILED *** Failures on Fedora-x86_64-w64-mingw32, branch master *** BREAKAGE *** gdb-buildbot

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=8318f3c337cf46ee6309b4a7f06f3934fc94b4bd@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).