* [review] Use cmd_list_element::doc_allocated for Python commands
@ 2019-11-16 0:03 Tom Tromey (Code Review)
2019-11-16 9:21 ` Andrew Burgess (Code Review)
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-16 0:03 UTC (permalink / raw)
To: gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661
......................................................................
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-15 Tom Tromey <tom@tromey.com>
* python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
(cmdpy_init): Set "doc_allocated".
Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
---
M gdb/ChangeLog
M gdb/python/py-cmd.c
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90a2b64..bbef23a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-15 Tom Tromey <tom@tromey.com>
+
+ * python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
+ (cmdpy_init): Set "doc_allocated".
+
2019-11-15 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Replace {posix,mingw}-strerror.c with safe-strerror.c.
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 87d1888..5b9a810 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -101,7 +101,6 @@
/* We allocated the name, doc string, and perhaps the prefix
name. */
xfree ((char *) self->name);
- xfree ((char *) self->doc);
xfree ((char *) self->prefixname);
}
@@ -563,6 +562,7 @@
/* 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 ());
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
Gerrit-Change-Number: 661
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 6+ messages in thread
* [review] Use cmd_list_element::doc_allocated for Python commands
2019-11-16 0:03 [review] Use cmd_list_element::doc_allocated for Python commands Tom Tromey (Code Review)
@ 2019-11-16 9:21 ` Andrew Burgess (Code Review)
2019-11-17 1:06 ` Tom Tromey
2019-11-17 21:52 ` [review v2] " Tom Tromey (Code Review)
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-16 9:21 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Andrew Burgess has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661
......................................................................
Patch Set 1:
(1 comment)
Minor nit but otherwise looks good.
| --- gdb/python/py-cmd.c
| +++ gdb/python/py-cmd.c
| @@ -92,19 +92,18 @@ /* Called if the gdb cmd_list_element is destroyed. */
| static void
| cmdpy_destroyer (struct cmd_list_element *self, void *context)
| {
| gdbpy_enter enter_py (get_current_arch (), current_language);
|
| /* Release our hold on the command object. */
| gdbpy_ref<cmdpy_object> cmd ((cmdpy_object *) context);
| cmd->command = NULL;
|
| /* We allocated the name, doc string, and perhaps the prefix
PS1, Line 101:
Does this comment need updating now?
| name. */
| xfree ((char *) self->name);
| - xfree ((char *) self->doc);
| xfree ((char *) self->prefixname);
| }
|
| /* Called by gdb to invoke the command. */
|
| static void
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
Gerrit-Change-Number: 661
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Comment-Date: Sat, 16 Nov 2019 09:21:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [review] Use cmd_list_element::doc_allocated for Python commands
2019-11-16 9:21 ` Andrew Burgess (Code Review)
@ 2019-11-17 1:06 ` Tom Tromey
0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2019-11-17 1:06 UTC (permalink / raw)
To: Andrew Burgess (Code Review); +Cc: Tom Tromey, gdb-patches, gnutoolchain-gerrit
>>>>> "Andrew" == Andrew Burgess (Code Review) <gerrit@gnutoolchain-gerrit.osci.io> writes:
Andrew> Does this comment need updating now?
Yeah, though it's updated again in a subsequent patch.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* [review v2] Use cmd_list_element::doc_allocated for Python commands
2019-11-16 0:03 [review] Use cmd_list_element::doc_allocated for Python commands Tom Tromey (Code Review)
2019-11-16 9:21 ` Andrew Burgess (Code Review)
@ 2019-11-17 21:52 ` Tom Tromey (Code Review)
2019-11-26 21:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-26 21:29 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-17 21:52 UTC (permalink / raw)
To: gdb-patches; +Cc: Andrew Burgess
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661
......................................................................
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-15 Tom Tromey <tom@tromey.com>
* python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
(cmdpy_init): Set "doc_allocated".
Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
---
M gdb/ChangeLog
M gdb/python/py-cmd.c
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 90a2b64..bbef23a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-15 Tom Tromey <tom@tromey.com>
+
+ * python/py-cmd.c (cmdpy_destroyer): Don't free "doc".
+ (cmdpy_init): Set "doc_allocated".
+
2019-11-15 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Replace {posix,mingw}-strerror.c with safe-strerror.c.
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 87d1888..e3497d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -98,10 +98,8 @@
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 @@
/* 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 ());
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
Gerrit-Change-Number: 661
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pushed] Use cmd_list_element::doc_allocated for Python commands
2019-11-16 0:03 [review] Use cmd_list_element::doc_allocated for Python commands Tom Tromey (Code Review)
2019-11-16 9:21 ` Andrew Burgess (Code Review)
2019-11-17 21:52 ` [review v2] " Tom Tromey (Code Review)
@ 2019-11-26 21:29 ` Sourceware to Gerrit sync (Code Review)
2019-11-26 21:29 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-26 21:29 UTC (permalink / raw)
To: Tom Tromey, gdb-patches; +Cc: Andrew Burgess
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661
......................................................................
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
---
M gdb/ChangeLog
M gdb/python/py-cmd.c
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 94a8bdc..821afd3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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
name of worker thread.
* gdbsupport/common.m4 (GDB_AC_COMMON): Check for
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 87d1888..e3497d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -98,10 +98,8 @@
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 @@
/* 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 ());
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
Gerrit-Change-Number: 661
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pushed] Use cmd_list_element::doc_allocated for Python commands
2019-11-16 0:03 [review] Use cmd_list_element::doc_allocated for Python commands Tom Tromey (Code Review)
` (2 preceding siblings ...)
2019-11-26 21:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-11-26 21:29 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 6+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-26 21:29 UTC (permalink / raw)
To: Tom Tromey, gdb-patches; +Cc: Andrew Burgess
The original change was created by Tom Tromey.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/661
......................................................................
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
---
M gdb/ChangeLog
M gdb/python/py-cmd.c
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 94a8bdc..821afd3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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
name of worker thread.
* gdbsupport/common.m4 (GDB_AC_COMMON): Check for
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 87d1888..e3497d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -98,10 +98,8 @@
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 @@
/* 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 ());
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I0014edc117b051bba1f4db267687d231e7fe9b56
Gerrit-Change-Number: 661
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-26 21:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 0:03 [review] Use cmd_list_element::doc_allocated for Python commands Tom Tromey (Code Review)
2019-11-16 9:21 ` Andrew Burgess (Code Review)
2019-11-17 1:06 ` Tom Tromey
2019-11-17 21:52 ` [review v2] " Tom Tromey (Code Review)
2019-11-26 21:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-26 21:29 ` Sourceware to Gerrit sync (Code Review)
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).